本文整理汇总了Python中prometheus_client.Info方法的典型用法代码示例。如果您正苦于以下问题:Python prometheus_client.Info方法的具体用法?Python prometheus_client.Info怎么用?Python prometheus_client.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prometheus_client
的用法示例。
在下文中一共展示了prometheus_client.Info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_metric
# 需要导入模块: import prometheus_client [as 别名]
# 或者: from prometheus_client import Info [as 别名]
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()
示例2: test_prometheus_info
# 需要导入模块: import prometheus_client [as 别名]
# 或者: from prometheus_client import Info [as 别名]
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
示例3: info
# 需要导入模块: import prometheus_client [as 别名]
# 或者: from prometheus_client import Info [as 别名]
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)
示例4: _info
# 需要导入模块: import prometheus_client [as 别名]
# 或者: from prometheus_client import Info [as 别名]
def _info(self, var, var_help):
return Info(var, var_help, registry=self._reg) # pylint: disable=unexpected-keyword-arg
示例5: info
# 需要导入模块: import prometheus_client [as 别名]
# 或者: from prometheus_client import Info [as 别名]
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)