简体   繁体   中英

Prometheus / Grafana counter monotonicity

Is there a way to make a Prometheus counter in Grafana truly monotonic?

The counters on my server (using the Prometheus Java library) get reset whenever the server is restarted and the counter drops to zero in Grafana too. I cannot find a way in the documentation for Prometheus queries. Neither does the Java library provide a way to make a Counter persistent over restarts.

With counters, you almost never care about the value itself, but only about its rate of increase. Thus, counters are always meant to be used in combination with the rate() or increase() functions. These functions handle counter resets for you (any non-monotonic increase will be treated as a counter reset and neutralized in the rate calculation).

解决此问题的方法是使用rate功能,该功能处理计数器重置。

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