All rule evaluations are instant queries. You do all the "reducer functions" in PromQL itself.
For example, you can use subquery syntax to do something like `avg_over_time()`. On Sat, Feb 3, 2024 at 5:02 PM 'Andrew Dedesko' via Prometheus Users < [email protected]> wrote: > Hi, > > I'm wondering whether prometheus uses instant queries or range queries > when evaluating alert expressions? The context about why I'm asking might > help clarify my question. > > I'm comparing Grafana Cloud's alerting functionality with prometheus. > From Grafana Cloud we're querying Google Cloud Metrics with PromQL (it's > Google's Monarch DB with a PromQL interface). Grafana Cloud's alerting > system takes your PromQL query and performs a *range query* against > Google Cloud Metrics, returning multiple data points over the range you > have selected (e.g. 10 minutes ago to now). Then you need to choose a > reducer function to turn the time series into an instant scalar (e.g. min, > max, last, mean). > > Prometheus alerts don't seem to have an option for specifying a range and > also don't have a reducer option. So this leads me to believe prometheus > uses instant queries to evaluate alert expressions. But I'd like to know > for sure. > > Thanks for reading! > > Here's the Grafana Cloud documentation on alert query ranges and reducers: > > https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-grafana-managed-rule/ > > -- > 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/ef0e2ee6-a32e-479e-bbe4-10499372715cn%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/ef0e2ee6-a32e-479e-bbe4-10499372715cn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CABbyFmrzw8pqkgd3Kicn_BpR5TXWu5QwVVPeqV3Yf3KYyeXZSA%40mail.gmail.com.

