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


Python metrology.Metrology类代码示例

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


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

示例1: __init__

    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,代码行数:8,代码来源:wsgi.py

示例2: setUp

    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)
        Metrology.histogram('histogram').update(1.5)
开发者ID:Motoma,项目名称:metrology,代码行数:8,代码来源:test_graphite.py

示例3: __init__

    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,代码行数:10,代码来源:zenactiond.py

示例4: test_send_batch

    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,代码行数:12,代码来源:test_graphite_pickle.py

示例5: register_metrics_on_worklist

def register_metrics_on_worklist(worklist):
    metricNames = {x[0] for x in registry}

    for metricName, priority in _gauge_priority_map.iteritems():
        if metricName not in metricNames:
            gauge = PriorityListLengthGauge(worklist, priority)
            Metrology.gauge(metricName, gauge)

    # Original metric name
    if "zenhub.workList" not in metricNames:
        gauge = WorklistLengthGauge(worklist)
        Metrology.gauge("zenhub.workList", gauge)
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:12,代码来源:worklist.py

示例6: test_send_batch

    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,代码行数:12,代码来源:test_graphite.py

示例7: __init__

    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")
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:53,代码来源:zenmodeler.py

示例8: setUp

    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,代码行数:7,代码来源:test_ganglia.py

示例9: setUp

    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,代码行数:7,代码来源:test_librato.py

示例10: __init__

    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,代码行数:31,代码来源:config.py

示例11: setUp

    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,代码行数:10,代码来源:test_logger.py

示例12: __init__

 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,代码行数:19,代码来源:PBDaemon.py

示例13: __init__

    def __init__(self, reactor):
        """Initialize a ZenHubWorker instance."""
        ZCmdBase.__init__(self)

        self.__reactor = reactor

        if self.options.profiling:
            self.profiler = ContinuousProfiler('ZenHubWorker', log=self.log)
            self.profiler.start()
            reactor.addSystemEventTrigger(
                'before', 'shutdown', self.profiler.stop,
            )

        self.instanceId = self.options.workerid
        self.current = IDLE
        self.currentStart = 0
        self.numCalls = Metrology.meter("zenhub.workerCalls")

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)

        serviceFactory = ServiceReferenceFactory(self)
        self.__registry = HubServiceRegistry(self.dmd, serviceFactory)

        # Configure/initialize the ZenHub client
        creds = UsernamePassword(
            self.options.hubusername, self.options.hubpassword,
        )
        endpointDescriptor = "tcp:{host}:{port}".format(
            host=self.options.hubhost, port=self.options.hubport,
        )
        endpoint = clientFromString(reactor, endpointDescriptor)
        self.__client = ZenHubClient(reactor, endpoint, creds, self, 10.0)

        # Setup Metric Reporting
        self.log.debug("Creating async MetricReporter")
        self._metric_manager = MetricManager(
            daemon_tags={
                'zenoss_daemon': 'zenhub_worker_%s' % self.options.workerid,
                'zenoss_monitor': self.options.monitor,
                'internal': True,
            },
        )
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:43,代码来源:zenhubworker.py

示例14: __init__

    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,代码行数:41,代码来源:zeneventd.py

示例15: __init__

    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,代码行数:23,代码来源:worklist.py


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