本文整理汇总了Python中prometheus_client.Gauge._samples方法的典型用法代码示例。如果您正苦于以下问题:Python Gauge._samples方法的具体用法?Python Gauge._samples怎么用?Python Gauge._samples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prometheus_client.Gauge
的用法示例。
在下文中一共展示了Gauge._samples方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Summary
# 需要导入模块: from prometheus_client import Gauge [as 别名]
# 或者: from prometheus_client.Gauge import _samples [as 别名]
# prometheus metrics state
request_summary = Summary(
'reststore_api_request_duration_seconds',
'Time spent processing api request',
['resource', 'method']
)
request_timer = lambda *x: request_summary.labels(*x).time()
file_count_gauge = Gauge(
'reststore_stored_files',
'Number of files in reststore',
['store']
)
file_count_gauge._samples = lambda: _counts()
file_size_summary = Summary(
'reststore_file_size_bytes',
'Size of files stored/fetched in bytes',
['store', 'direction']
)
# unfortunately do not have a way to query for current
# filestores, so we accumulate them as requests are seen
known_file_stores = set()
def _counts():
return [('', {'store': k}, len(_get_files(k))) \
for k in known_file_stores]
示例2: Summary
# 需要导入模块: from prometheus_client import Gauge [as 别名]
# 或者: from prometheus_client.Gauge import _samples [as 别名]
from restq import config
# prometheus metrics state
request_summary = Summary(
'restq_api_request_duration_seconds',
'Time spent processing api request',
['resource', 'method']
)
request_timer = lambda *x: request_summary.labels(*x).time()
job_gauge = Gauge(
'restq_queued_jobs',
'Number of jobs in restq realms/queues',
['realm', 'queue']
)
job_gauge._samples = lambda: _get_job_stats()
tag_gauge = Gauge(
'restq_queued_tags',
'Number of tags in restq realms',
['realm']
)
tag_gauge._samples = lambda: _get_tag_stats()
def _get_job_stats():
d = realms.get_status()
return [('', {'realm': name, 'queue': str(q)}, v) \
for name, detail in d.items() for q, v in detail['queues'].items()]
def _get_tag_stats():
d = realms.get_status()