How to sum up a series of Gauges in Prometheus?

Viewed 11

I´m converting a statsd metric to Prometheus to be graphed in Grafana.

This is a gauge being reset every 1m, showing requests in the past 1m. Prometheus is scraping every 15 secs.

I´d like to produce a single scalar showing total requests during the time range selected.

Metrics will look like e.g. this:

67 67 67 67 70 70 70 70 55 55 55 55

So this would be metrics for the last 3 mins, showing 67 reg/min for 1 min and then 70 req/min for 1 min etc.

So, if 3 mins were selected for the dashboard in Grafana, I would like the panel to show: 192 (i.e. 67+70+55)

Now, if I do this:

sum(sum_over_time(my_requests[$__interval]))

And select 3m in the dashboard (or Explorer), I get a graph with 3 datapoints that seem correct. But how do I sum up these 3 datapoints to show as a single scalar?

0 Answers
Related