当前位置: 首页>>代码示例>>Python>>正文


Python Metrology.timer方法代码示例

本文整理汇总了Python中metrology.Metrology.timer方法的典型用法代码示例。如果您正苦于以下问题:Python Metrology.timer方法的具体用法?Python Metrology.timer怎么用?Python Metrology.timer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在metrology.Metrology的用法示例。


在下文中一共展示了Metrology.timer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [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)
开发者ID:damiendube,项目名称:metrology,代码行数:9,代码来源:test_librato.py

示例2: setUp

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [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)
开发者ID:cyberdelia,项目名称:metrology,代码行数:9,代码来源:test_ganglia.py

示例3: setUp

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [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)
开发者ID:arnaudlimbourg,项目名称:metrology,代码行数:9,代码来源:test_graphite.py

示例4: setUp

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [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)
开发者ID:Motoma,项目名称:metrology,代码行数:12,代码来源:test_logger.py

示例5: __init__

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
    def __init__(self, notificationDao):
        self.notificationDao = notificationDao
        self.signal_timer = Metrology.timer('zenactiond.signals')
        self.notification_timer = Metrology.timer('zenactiond.notifications')

        # set by the constructor of queueConsumer
        self.queueConsumer = None

        self.schema = getUtility(IQueueSchema)
        self.queue = self.schema.getQueue("$Signals")
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:12,代码来源:zenactiond.py

示例6: test_send_batch

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [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()
开发者ID:kevineder,项目名称:metrology,代码行数:14,代码来源:test_graphite.py

示例7: test_send_batch

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [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()
开发者ID:zkplatlab,项目名称:metrology,代码行数:14,代码来源:test_graphite_pickle.py

示例8: __init__

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
    def __init__(self,
                 name,
                 configId=None,
                 scheduleIntervalSeconds=None,
                 taskConfig=None):
        super(ConfigurationLoaderTask, self).__init__()
        self._fetchConfigTimer = Metrology.timer('collectordaemon.configs')

        # Needed for interface
        self.name = name
        self.configId = configId if configId else name
        self.state = TaskStates.STATE_IDLE

        self._dataService = zope.component.queryUtility(IDataService)
        self._eventService = zope.component.queryUtility(IEventService)

        if taskConfig is None:
            raise TypeError("taskConfig cannot be None")
        self._prefs = taskConfig
        self.interval = self._prefs.configCycleInterval * 60
        self.options = self._prefs.options

        self._daemon = zope.component.getUtility(ICollector)
        self._daemon.heartbeatTimeout = self.options.heartbeatTimeout
        log.debug("Heartbeat timeout set to %ds", self._daemon.heartbeatTimeout)

        frameworkFactory = zope.component.queryUtility(IFrameworkFactory, self._frameworkFactoryName)
        self._configProxy = frameworkFactory.getConfigurationProxy()

        self.devices = []
        self.startDelay=0
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:33,代码来源:config.py

示例9: __init__

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
    def __init__(self, application, reporter=None, **kwargs):
        self.application = application
        self.request = Metrology.meter('request')
        self.request_time = Metrology.timer('request_time')

        # Start reporter
        if reporter:
            reporter.start()
开发者ID:cyberdelia,项目名称:metrology,代码行数:10,代码来源:wsgi.py

示例10: __init__

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
 def __init__(self, options, log):
     self.options = options
     self.transformers = _load_utilities(ICollectorEventTransformer)
     self.log = log
     self.discarded_events = 0
     # TODO: Do we want to limit the size of the clear event dictionary?
     self.clear_events_count = {}
     self._initQueues()
     self._eventsSent = Metrology.meter("collectordaemon.eventsSent")
     self._discardedEvents = Metrology.meter("collectordaemon.discardedEvent")
     self._eventTimer = Metrology.timer('collectordaemon.eventTimer')
     metricNames = {x[0] for x in registry}
     if 'collectordaemon.eventQueue' not in metricNames:
         queue = self
         class EventQueueGauge(Gauge):
             @property
             def value(self):
                 return queue.event_queue_length
         Metrology.gauge('collectordaemon.eventQueue', EventQueueGauge())
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:21,代码来源:PBDaemon.py

示例11: __init__

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
    def __init__(self, dmd):
        self.dmd = dmd
        self._manager = Manager(self.dmd)
        self._pipes = (
            EventPluginPipe(
                self._manager, IPreEventPlugin, 'PreEventPluginPipe'
            ),
            CheckInputPipe(self._manager),
            IdentifierPipe(self._manager),
            AddDeviceContextAndTagsPipe(self._manager),
            TransformAndReidentPipe(
                self._manager,
                TransformPipe(self._manager),
                [
                    UpdateDeviceContextAndTagsPipe(self._manager),
                    IdentifierPipe(self._manager),
                    AddDeviceContextAndTagsPipe(self._manager),
                ]
            ),
            AssignDefaultEventClassAndTagPipe(self._manager),
            FingerprintPipe(self._manager),
            SerializeContextPipe(self._manager),
            EventPluginPipe(
                self._manager, IPostEventPlugin, 'PostEventPluginPipe'
            ),
            ClearClassRefreshPipe(self._manager),
            CheckHeartBeatPipe(self._manager)
        )
        self._pipe_timers = {}
        for pipe in self._pipes:
            timer_name = pipe.name
            self._pipe_timers[timer_name] = Metrology.timer(timer_name)

        self.reporter = MetricReporter(prefix='zenoss.zeneventd.')
        self.reporter.start()

        if not self.SYNC_EVERY_EVENT:
            # don't call sync() more often than 1 every 0.5 sec
            # helps throughput when receiving events in bursts
            self.nextSync = time()
            self.syncInterval = 0.5
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:43,代码来源:zeneventd.py

示例12: __init__

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
    def __init__(self, modeling_paused=None):
        """Initializes a ZenHubWorklist object.

        If an argument is provided for the modeling_paused parameter,
        it should be function that takes no arguments and returns True
        to exclude modeling related priorities for job selection.
        """
        if modeling_paused is None:
            self.__modeling_paused = bool  # always False
        else:
            self.__modeling_paused = modeling_paused

        # Associate a list with each priority
        self.__worklists = {priority: [] for priority in ZenHubPriority}

        # All jobs priority selection
        self.__alljobs = _PrioritySelection(_all_priorities)

        # No ApplyDataMaps priority selection
        self.__noadmjobs = _PrioritySelection(_no_adm_priorities)

        # Metric for wait time in worklist
        self.__waitTimer = Metrology.timer("zenhub.worklist.wait_time")
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:25,代码来源:worklist.py

示例13: test_request

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
 def test_request(self):
     self.server.get('/')
     self.assertEqual(1, Metrology.meter('request').count)
     self.assertEqual(1, Metrology.timer('request_time').count)
开发者ID:cyberdelia,项目名称:metrology,代码行数:6,代码来源:test_wsgi.py

示例14: test_timer

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
 def test_timer(self):
     self.assertTrue(Metrology.timer('test') is not None)
开发者ID:cyberdelia,项目名称:metrology,代码行数:4,代码来源:test_metrology.py

示例15: _getPrepublishingTimer

# 需要导入模块: from metrology import Metrology [as 别名]
# 或者: from metrology.Metrology import timer [as 别名]
def _getPrepublishingTimer():
    global _prepublishing_timer
    if not _prepublishing_timer:
        _prepublishing_timer =  Metrology.timer("MessagePrePublishingEvents")
    return _prepublishing_timer
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:7,代码来源:publisher.py


注:本文中的metrology.Metrology.timer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。