Hi,
To give an actual PromQL answer to a PromQL question:
If I understand your question correctly, you may want to take a look at the new experimental "@" modifier for selectors + subqueries, which was added in Prometheus 2.25 and can be turned on via the "--enable-feature=promql-at-modifier" command-line flag:
It's designed for these kinds of situations where you want to evaluate specific vector selectors or subqueries at a fixed point in time (e.g. the end of the graph range, via "foo @ end()"), rather than relative to each resolution step.
So e.g. for a 1-hour graph where you wanted to select the per-cluster-averaged CPU utilizations only for those clusters whose overall average within that graphed last hour was <= 10%, you could write something like:
----------------
avg by(cluster_id) (cpu_utilization)
and
max_over_time(
avg by(cluster_id) (cpu_utilization)[1h:] @ end()
) <= 10
----------------
Depending on what exactly you want as your filter criterium, you may want to switch max_over_time() for avg_over_time() instead (requiring the max over the graph range to be <= 10% vs. requiring the average over the graph range to be <= 10%).
----------------
avg by(cluster_id) (cpu_utilization)
and
max_over_time(
avg by(cluster_id) (cpu_utilization)[$__range:] @ end()
) <= 10
----------------
Regards,
Julius