I’ve got prometheus scraping a histogram of request latency from my API server every 1m
.
I’m then visualizing the histograms as a heatmap in Grafana. It looks like this:
My query is:
sum(http_request_duration_seconds_bucket) by (le)
-
sum(http_request_duration_seconds_bucket offset 1m) by (le)
What I understand this to be doing is: take the bucket vector at the time concerned and subtract the bucket vector 1 minute prior to get the bucket vector for that minute (histograms accumulate and don’t clear their buckets each scrape)
But the issue is, looking at my request logs, I see:
...
13:56:13 GET 304 3 ms
13:56:18 GET 304 4 ms
13:56:18 POST - -
13:56:23 GET 304 4 ms
13:56:28 GET 304 0 ms
13:56:32 GET 304 3 ms
13:56:38 GET 304 6 ms
13:56:42 GET 304 4 ms
13:56:48 GET 304 9 ms
13:56:53 GET 304 2 ms
13:56:54 POST - -
13:56:58 GET 304 2 ms
13:57:01 GET 200 2 ms
13:57:03 GET 304 6 ms
13:57:08 GET 304 4 ms
13:57:12 GET 304 3 ms
13:57:18 POST - -
13:57:21 GET 304 8 ms
13:57:21 GET 304 8 ms
13:57:23 GET 304 4 ms
...
As you can see, the first time there were requests of “Inf” runtime was in 13:56 , but if we look at the histogram, we don’t see that until 13:38 .
Why is the data shifted by 2 minutes?