Prometheus 记录普罗米修斯服务器给我的客户的刮擦时间戳

Prometheus 记录普罗米修斯服务器给我的客户的刮擦时间戳,prometheus,Prometheus,每当Prometheus服务器抓取我的Python客户机时,我都会记录时间戳,以便知道抓取器访问我的客户机的确切时间 最好的方法是什么 我已经看到,由于Prometheus服务器也会刮取自己并公开自己的一些度量(在本地主机上:通常为9090/metrics),因此有一个公开的度量称为promhttp_metric_handler_requests: # HELP promhttp_metric_handler_requests_total Total number of scrapes by H

每当Prometheus服务器抓取我的Python客户机时,我都会记录时间戳,以便知道抓取器访问我的客户机的确切时间

最好的方法是什么

我已经看到,由于Prometheus服务器也会刮取自己并公开自己的一些度量(在本地主机上:通常为9090/metrics),因此有一个公开的度量称为promhttp_metric_handler_requests:

# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} x
如果我可以重用该度量并将时间戳作为标签附加在HTTP状态代码中,那么可能就没问题了。问题是我不能使用它


有什么建议吗?谢谢。

Prometheus将抓取时间戳与值一起保存默认情况下,您可以通过运行返回值数组的查询来获取它们。例如
node\u exporter\u build\u info[2m]