【发布时间】:2018-05-11 08:16:58
【问题描述】:
我正在尝试使用 prometheus 监控一个简单的应用程序,但不知道从哪里开始。
我创建了一个简单的测试函数,它将休眠 10 秒,并使用 prometheus - 摘要指标进行跟踪。
from prometheus_client import Summary
import time
from datetime import datetime
TF_CALL_SUMMARY = Summary("call_seconds", "Time spent inside test function")
def test():
while True:
t1 = datetime.now()
time.sleep(10)
t2 = datetime.now()
delta = t2 - t1
TF_CALL_SUMMARY.observe(delta.total_seconds())
print delta
print 'start application'
test()
print 'end application'
现在这不是一个可以有 /metric 端点的 Web 应用程序。
如何将此指标导出到我的 prometheus 服务器?
【问题讨论】:
标签: prometheus