muffel
muffel

Reputation: 7380

PromQL default behaviour when no time range was given

When I was querying a Prometheus server with quite high scrape intervals, I stumbled across a behaviour I wasn't expecting: If I was omitting a time range, metrics weren't continuous, which could best be seen from the Graph window:

enter image description here

My assumption was, that if I queried for up{job="prometheus"}, it would simply return the latest metric scraped, independent of when this has been. But this just doesn't seem to be the case - especially as all scrapes have been successful to this target.

As I haven't found a good explanation, can you please tell me what the actual outcome is, if I just queried for a metric without a time range like the one in the example above?

[Edit]

Even places like the Promlabs Cheat Sheet say

enter image description here

Upvotes: 2

Views: 887

Answers (1)

Sascha Doerdelmann
Sascha Doerdelmann

Reputation: 846

See valyala's answer to "Why is the moving average higher than the actual series in prometheus".

The query from Grafana to Prometheus includes some step parameter, so in fact you'll always get discrete points. Prometheus then delivers the latest value at each of these step points with a maximum look-behind of 5 minutes.

Upvotes: 1

Related Questions