简体   繁体   中英

SpringBoot Actuator Maintain State

I'm pushing custom metrics to Prometheus using micrometer. So, prometheus scrapes /actuator/prometheus and stores data. But the problem is, when I redeploy my applications, all the values are resetting to 0.

Ex: I'm pushing the request count to prometheus. The request count reached to 5. For some reason I deployed a newer version of my SpringBoot application. No request count will start from 0 as actuator is in-memory. So, my prometheus graph is falling down to 0 and starting again.

How can I fix this issue?

This is expected behavior. To cite from "Prometheus Counters and how to deal with them" :

The current value of a Counter doesn't matter. What matters is, how it increases over time.

So, to fix your issue, fix your query by applying rate() or increase() .

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