rate
rate(value: numeric or duration) -> value
Calculate the average per-second rate of the argument across the group.
rate by default assumes the value to be monotonically increasing, and treats decreasing values as counter resets.
When the argument is a metric defined using set_metric, rate behaves differently according to the specified metric type:
- for
gaugeandcumulativeCountermetrics,ratewill retain the default behavior of assuming monotonic increases. - for
deltametrics,ratewill sum up the values and then divide by the frame size to calculate average per-second rate.
Domain
This is an aggregate function (aggregates rows over a group in aggregate verbs).
This is a window function (calculates over a group of multiple input rows using windowing).
Categories
Examples
align 5m, requests: rate(m("requests_total"))
Computes the per-second rate of "requests_total" metric for each 5m time bins. The rate is always positive, and resets if the counter goes down.
Updated 8 days ago