What is a difference between rollup_rate (avg) and rate in MetricsQL?

331 views Asked by At

As stated in title, what is a difference between avg from rollup_rate() and rate() in MetricsQL?

It is not clear to me from the official documentation.

1

There are 1 answers

0
valyala On BEST ANSWER

Let's suppose we have a time series with the following samples on the duration d:

(v1, t1), (v2, t2), .... (vN, tN)`

Then the rate(m[d]) at tN is calculated as (vN - v1) / (tN - t1), while the avg returned from rollup_rate(m[d]) is calculated as an average value for per-sample rates (v2-v1)/(t2-t1), ..., (vN - vNminus1) / (tN - tNminus1).