On Sun, 2 Jan 2022 at 20:43, Brian Candler <[email protected]> wrote:
[...]
> A subquery doesn't cut it here, because it resamples the data.  The subquery 
> "(foo == N)[2d:1s]" gives an approximation, but for a given point you'll see 
> multiple points at 1 second intervals (until the time where foo != N)

If you don't mind the resampling then you can usefully make use of the
experimental '@' modifier[1] to avoid needing to query for N first:

max_over_time(foo[2d] @ end()) == foo

For example, that is easily graphable like so:
https://prometheus.demo.do.prometheus.io/graph?g0.expr=max_over_time(node_filefd_allocated%5B1d%5D%20%40%20end())%20%3D%3D%20node_filefd_allocated&g0.tab=0&g0.stacked=0&g0.range_input=1d&g0.step_input=10

(But note I had to put the step at 10s; the range vector can find
values that your step may otherwise skip over.)

[1]: https://prometheus.io/docs/prometheus/latest/querying/basics/#modifier

-- 
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/CAP9KPhAfHxSLCSQrNorOkymoLpswpfXL1wT5zg8kmfaeRuGtvA%40mail.gmail.com.

Reply via email to