Do I understand Prometheus's rate vs increase functions ...
stackoverflow.com › questions › 54494394Feb 02, 2019 · If you query rate (counter [5s]) OTOH, Prometheus will pick all the samples in the range [now () - 5s, now] (5 samples, covering approximately 4 seconds on average, say [t1, v1], [t2, v2], [t3, v3], [t4, v4], [t5, v5]) and (assuming your counter doesn't reset within the interval) will return (v5 - v1) / (t5 - t1).
Prometheus rate functions and interval selections - Stack ...
stackoverflow.com › questions › 38915018In this case Prometheus takes the difference between the last and first points in each interval (your actual counter increase), divides it by the time difference between the 2 points (on average 45 seconds), then extrapolates that to 1 minute (essentially overestimating it by a factor of 1.(3) -- I'm eyeballing an increase of ~200k over ~50 minutes, so an average rate of about 67 QPS, whereas rate() returns something closer to 90 QPS). This is what happens in the second half of your graph.