Display sum of all gauge's values

Hello, I’m very new to Grafana and Prometheus.

I’m using Grafana v8.2.6 on Windows 10, along with Prometheus.

It scrapes a Gauge metric that is sent every 2 minutes.
I would like to display a stat that corresponds to a running sum of all values the Gauge ever had. To be a little more specific, the stat should be a sum of all seen values when clicking on Inspect and then Data.
In this case, a Counter would be more suitable, however I would like to reset it everyday, but it is not possible with a Counter. That’s why the Gauge metric was chosen.

I tried adding the increase() operation, but since the metric is a gauge it had unexpected behavior (displayed 0 even if there was data).
I also tried the sum() function, which displayed the same value as the gauge: sum(my_gauge)
I tried the Total calculation types in the Transform section, but it was displaying the same value as the Gauge.

Is there a way to achieve this?

Welcome @sgrocma

Have you tried this?

Thanks, it works.
I tried it with the wrong visualization (stat) and didn’t get the expected result.
(what a noob!)

Hey, :grafana:lad it works. We were all noobs at one point!

1 Like