Python prometheus_client.Info() Examples

The following are 5 code examples of prometheus_client.Info(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module prometheus_client , or try the search function .
Example #1
Source File: monitor.py    From CrawlerMonitor with MIT License 7 votes vote down vote up
def create_metric(self):
        # record app conf
        self.conf_info = Info('celery_conf_info','APP_CONF')
        self.conf_info_c = CollectorRegistry()

        # monitor worker info
        self.workers_info = Info('celery_workers_info', 'WORKER_INFO')
        self.workers_info_c = CollectorRegistry()

        # monitor worker info real-time
        self.workers_state = Gauge('celery_workers_state', 'WORKER_STATE', ['worker'])
        self.workers_state_c = CollectorRegistry()
        self.workers_processed = Gauge('celery_processed_tasks_total', 'WORKER_TASKS_PROCESSED', ['worker'])
        self.workers_processed_c = CollectorRegistry()
        self.workers_active = Gauge('celery_active_tasks_total', 'WORKER_TASKS_ACTIVE', ['worker'])
        self.workers_active_c = CollectorRegistry()

        # monitor tasks info
        self.tasks_counter = Counter('celery_tasks_total', 'TASK_COUNT_INFO', ['worker','task','result'])
        self.tasks_counter_c = CollectorRegistry()
        self.tasks_runtime = Summary('celery_tasks_seconds', 'TASK_RUNTIME', ['worker', 'task'])
        self.tasks_runtime_c = CollectorRegistry()
        self.tasks_info = Info('celery_tasks_info', 'TASK_INFO')
        self.tasks_info_c = CollectorRegistry() 
Example #2
Source File: test_resources.py    From dagster with Apache License 2.0 6 votes vote down vote up
def test_prometheus_info():
    @solid(required_resource_keys={'prometheus'})
    def prometheus_solid(context):
        i = Info(
            'my_build_version',
            'Description of info',
            registry=context.resources.prometheus.registry,
        )
        info_labels = {'version': '1.2.3', 'buildhost': 'foo@bar'}
        i.info(info_labels)
        metric = None
        for metric in context.resources.prometheus.registry.collect():
            if metric.name == 'my_build_version':
                break
        assert metric and metric.samples[0].labels == info_labels

    assert execute_solid(prometheus_solid, run_config=ENV, mode_def=MODE).success 
Example #3
Source File: metrics.py    From client_python with Apache License 2.0 5 votes vote down vote up
def info(self, val):
        """Set info metric."""
        if self._labelname_set.intersection(val.keys()):
            raise ValueError('Overlapping labels for Info metric, metric: %s child: %s' % (
                self._labelnames, val))
        with self._lock:
            self._value = dict(val) 
Example #4
Source File: faucet_metrics.py    From faucet with Apache License 2.0 5 votes vote down vote up
def _info(self, var, var_help):
        return Info(var, var_help, registry=self._reg) # pylint: disable=unexpected-keyword-arg 
Example #5
Source File: metrics.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def info(self, val):
        '''Set info metric.'''
        if self._labelname_set.intersection(val.keys()):
            raise ValueError('Overlapping labels for Info metric, metric: %s child: %s' % (
                self._labelnames, val))
        with self._lock:
            self._value = dict(val)