简体   繁体   中英

Expose multiple metrics to Prometheus

[Prometheus] Hello!

I want to expose multiple metrics with the respective timestamps for Prometheus, for example:

test5{job_name="test05"} 15 1512982800000 test5{job_name="test05"} 10 1512986400000 test5{job_name="test05"} 6 1512990000000 test5{job_name="test05"} 20 1512990840000 test5{job_name="test05"} 25 1512993000000

test6{job_name="test06"} 2 1512987840000 test6{job_name="test06"} 3 1512991500000 test6{job_name="test06"} 4 1512991800000 test6{job_name="test06"} 5 1512991920000 test6{job_name="test06"} 6 1512992220000 test6{job_name="test06"} 6 1512996000000 test6{job_name="test06"} 7 1512996240000

test7{job_name="test07"} 1 1512909840000

test8{job_name="test08"} 2 1510317840000

However the Prometheus only scrapes the metrics that have timestamps less than an hour than the current time. Why?

Thanks!

While the metrics format suggests timestamps may be included in metrics endpoints, it seems that Prometheus's official position is that such a feature is unsupported / discouraged (Refs 1-4).

While I can't find evidence to back it up, I would speculate that Prometheus takes only the most recent metric for a given key[label] set. This could be validated by testing with different job_name label values to observe if values are stored when being treated as unique metric values.

This may be a requirement that cannot be met by Prometheus in its current form, and the additional of a bulk api remains to be implemented after nearly 3 years.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM