本文整理汇总了Python中metrology.Metrology.counter方法的典型用法代码示例。如果您正苦于以下问题:Python Metrology.counter方法的具体用法?Python Metrology.counter怎么用?Python Metrology.counter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类metrology.Metrology
的用法示例。
在下文中一共展示了Metrology.counter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def setUp(self):
self.reporter = LibratoReporter("<email>", "<token>")
Metrology.meter('meter').mark()
Metrology.counter('counter').increment()
Metrology.timer('timer').update(1.5)
Metrology.utilization_timer('utimer').update(1.5)
示例2: setUp
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def setUp(self):
self.reporter = GraphiteReporter('localhost', 3333)
Metrology.meter('meter').mark()
Metrology.counter('counter').increment()
Metrology.timer('timer').update(1.5)
Metrology.utilization_timer('utimer').update(1.5)
示例3: setUp
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def setUp(self):
self.reporter = GangliaReporter("Group Name", "localhost", 8649)
Metrology.meter('meter').mark()
Metrology.counter('counter').increment()
Metrology.timer('timer').update(5)
Metrology.utilization_timer('utimer').update(5)
示例4: setUp
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def setUp(self):
self.output = StringIO()
logging.basicConfig(stream=self.output, level=logging.INFO)
self.reporter = LoggerReporter()
Metrology.meter('meter').mark()
Metrology.counter('counter').increment()
Metrology.timer('timer').update(1.5)
Metrology.utilization_timer('utimer').update(1.5)
示例5: test_send_batch
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def test_send_batch(self, mock):
self.reporter = GraphiteReporter('localhost', 3333, batch_size=2)
Metrology.meter('meter').mark()
Metrology.counter('counter').increment()
Metrology.timer('timer').update(5)
Metrology.utilization_timer('utimer').update(5)
Metrology.histogram('histogram').update(5)
self.reporter.write()
self.assertTrue(mock.send.assert_called())
self.assertEqual(25, len(mock.sendall.call_args_list))
self.reporter.stop()
示例6: test_send_batch
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def test_send_batch(self, mock):
self.reporter = GraphiteReporter("localhost", 3334, pickle=True, batch_size=2)
Metrology.meter("meter").mark()
Metrology.counter("counter").increment()
Metrology.timer("timer").update(5)
Metrology.utilization_timer("utimer").update(5)
Metrology.histogram("histogram").update(5)
self.reporter.write()
self.assertTrue(mock.sendall.assert_called())
self.assertEqual(25, len(mock.sendall.call_args_list))
self.reporter.stop()
示例7: __init__
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def __init__(self, single=False ):
"""
Initalizer
@param single: collect from a single device?
@type single: boolean
"""
PBDaemon.__init__(self)
# FIXME: cleanup --force option #2660
self.options.force = True
self.start = None
self.startat = None
self.rrdStats = DaemonStats()
self.single = single
if self.options.device:
self.single = True
self.modelerCycleInterval = self.options.cycletime
# get the minutes and convert to fraction of a day
self.collage = float( self.options.collage ) / 1440.0
self.pendingNewClients = False
self.clients = []
self.finished = []
self.devicegen = None
self.counters = collections.Counter()
self.configFilter = None
self.configLoaded = False
# Make sendEvent() available to plugins
zope.component.provideUtility(self, IEventService)
# Delay start for between 10 and 60 seconds when run as a daemon.
self.started = False
self.startDelay = 0
self.immediate = 1
if self.options.daemon or self.options.cycle:
if self.options.now:
self.log.debug('option "now" specified, starting immediately.')
else:
# self.startDelay = randint(10, 60) * 60
self.startDelay = randint(10, 60) * 1
self.immediate = 0
self.log.info('option "now" not specified, waiting %s seconds to start.' %
self.startDelay)
else:
self.log.debug("Run in foreground, starting immediately.")
# ZEN-26637
self.collectorLoopIteration = 0
self.mainLoopGotDeviceList = False
self._modeledDevicesMetric = Metrology.meter("zenmodeler.modeledDevices")
self._failuresMetric = Metrology.counter("zenmodeler.failures")
示例8: test_counter
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def test_counter(self):
self.assertTrue(Metrology.counter('test') is not None)
示例9: test_get
# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import counter [as 别名]
def test_get(self):
Metrology.counter('test')
self.assertTrue(Metrology.get('test') is not None)