rate vs irate
rate
and irate
are based on the counter type metrics.
rate(v range-vector)
calculates the per-second average rate of increase of the time series in the range vector, for example, rate(http_request_total{method="post"}[1m])
- It’s a rate:
total(now) - total(now - 1m) / 60s
- It’s an average rate: over 1m
- Average is calculated over the time range, that’s why range vector is required.
- It provides a smoother trend.
irate(v range-vector)
calculates the per-second instant rate of increase of the time series in the range vector.
- similar to
rate
, but it’s an sensitive rate as it’s based on the last two data points. - why calculate last two points still needs [1m] range? it’s for looking back when the data point is missed
Reference:⌗
Read other posts