You can break down your query into parts to find out what's happening.
If you go to the PromQL web interface, you can enter a range query like
requests_total[10m15s]
and you'll see the raw, timestamped data points in that time window. (You must be in the "Table" view rather than the "Graph" view). Similarly you can do subqueries like
rate(requests_total[5m15s])[10m:5m])
And finally you can average those values by hand, and compare to running avg_over_time on that expression.
Of course, set the query evaluation time to be a fixed point in time, so they all align.
What I'd expect to see is:
- 41 data points in the first range query: let's call them x0 to x40 (from oldest to newest)
- a rate calculated between x0 and x20, which I'd expect equals (x20-x0)/300 in the absence of counter resets
- a rate calculated between x20 and x40, which I'd expect equals (x40-x20)/300
If you average these two rates you should get ((x20-x0)/300 + (x40-x20)/300)/2 = (x40-x0)/600 which is the rate you're looking for
By doing each of the steps by hand, you should be able to work out where your assumptions are falling down.