rate¶
Description¶
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 - gaugeand- cumulativeCountermetrics,- 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.
Return type¶
value
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¶
Usage¶
rate(value)
| Argument | Type | Optional | Repeatable | Restrictions | 
|---|---|---|---|---|
| value | numeric or duration | no | no | none | 
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.