On Monday, 3 January 2022 at 03:28:37 UTC Victor Sudakov wrote:

> Isn't "(foo == N)[2d:]" what I'm looking for? I don't quite grok 
> subqueries, but the resolution parameter seems to be optional. At 
> least "(foo == N)[2d:]" seems to show the timestamps I was looking 
> for.
>

As it says here 
<https://prometheus.io/docs/prometheus/latest/querying/basics/#subquery>: 
"<resolution> is optional. Default is the global evaluation interval."

So if your global evaluation interval is 1m, then that expression is the 
same as (foo == N)[2d:1m]

What this does is evaluate the expression foo == N at the current time T, 
at time T-1m, at time T-2m etc.  In the results, this won't give you the 
*exact* time that the data point occurred: it will give you a timestamp of 
T-Nm, which will be up to 1 minute after the timestamp of the point 
itself.  (The value of a timeseries at time T is the value of the most 
recent data point on or before time T).

Also, individual scrape jobs can use different scrape intervals.  If you 
have a global eval interval of 1 minute but this particular scrape job uses 
15s, then the above expression will return (on average) 1 in every 4 data 
points.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/951138b3-6a22-4443-aa27-37f8408a3c4bn%40googlegroups.com.

Reply via email to