I understand that rate(xyz[5m]) * 60
is the rate of xyz per minute, averaged over 5 mins.
- See New in Grafana 7.2: $__rate_interval for Prometheus rate queries that just work.
- Rate is always per second. See Prometheus documentation for the rate function.
- Click on Query options, then click on the Info-Symbol. An explanation will be displayed.
- To get rate per minute, just multiply the rate with 60.
Edit: ($__rate_interval
and $__interval
)
Prometheus periodically fetches data from your application. Grafana periodically fetches Data from Prometheus. Grafana does not know, how often Prometheus polls your application for data. Grafana will estimate this time by looking at the configuration and assuming that every scrape gives us one data point. The $__interval
variable then expands to the duration between two data points in the graph (Note that this is only true for small time ranges and high resolution as the intended use case for $__interval
is reducing the number of data points when the time range is wide. See Approximate Calculation of $__interval.)
If the time-distance between every two data points in each series is 15 seconds, it does not make sense to use anything less than [15s]
as interval in the rate function. The rate function works best with at least 4 data points. Therefore [1m]
would be much better than anything betweeen [15s]
and [1m]
. This is what $__rate_interval
tries to achieve: guessing a minimal sensible interval for the rate function.
Personally, I think, this does not always work if your application delivers sparse data (less than one data point per scrape). I prefer using fixed intervals like 10m or even 1h or 1d in these situations. The interval need to be great enough to get you enough data points for the metric to work with the rate function.
A different approach would be to use any of $__rate_interval
and $__interval
but also set the Min step parameter for the query in the Grafana UI to be big enough.
© 2022 - 2024 — McMap. All rights reserved.