Search code examples
grafanaprometheus

How to calculate the average value in a Prometheus query from Grafana


I was trying to create a Prometheus graph on Grafana, but I can't find the function calculating the average value.

For example, to create a graph for read_latency, the results contain many tags. If there are 3 machines, there are 3 separate tags, for machine1, machine2, machine3. Here is a graph:

Prometheus

I want to combine these three together, so there will be only one tag, machines, and the value is the average of those three.

It seems that Prometheus query function doesn't have something like average(), so I am not sure how to do this.

I used to work on InfluxDB, and the graph works like this:

influxDB


Solution

  • I think you are searching for the avg() operation. see documentation