3
votes

I'm using Grafana to chart Prometheus data. I have a set of data in gauges and it's displaying just fine on line charts. When I try and use a pie chart it only seems to show the most recent data point, not the sum for the whole time range selected in the dashboard.

I'm trying this:

sum(successful_requests)

Is there something I need to do to get it to sum all the data in the time range?

Thanks,

Ian

1
The question I have is why are you using a gauge and not a counter for total requests. Is this the result of a recorded rule? Otherwise you're walking on very shaky ground. - Alin Sînpălean

1 Answers

3
votes

Ok - I just figured it out thanks to an article about sum_over_time. You can do it like this:

sum(sum_over_time(total_requests[$__interval]))

The outer sum is good if you are trying to aggregate multiple series together, otherwise you can do without:

sum_over_time(total_requests[$__interval])

Ian