Hi - must be a common problem but I cannot work it out - I have lots of services registering timers, and I get <timer>_count
metrics exposed. I want to keep a running total of requests running through a system over a 24h period, but if I restart a service halfway through that period, the <timer>
restarts and the count resets to 0, thus blowing away my daily counter. How do I create an external “running counter” that I can increment with the <timer>_count
value every scrape?
[Grafana]Creating an external “running counter” that I can increment with the `[timer](timer)_count`
That’s what the Prometheus increase
function is there for (and rate
which gives you the average increase per second for the given range vector (i.e. period). increase
is a convenience method for rate
that multiplies it by the duration in the period, so that’s the one you want to use here) https://prometheus.io/docs/prometheus/latest/querying/functions/#increase
increase(<timer>_count[24h])
D’uh! Thanks - I had taken the increase
off the counter, completely missed it.