Hi,
It is not same. What I want to do is limit the rule to eval metrics which have the spcified label. Kind regards, Allenzh li 在 2020年12月3日 16:53,Christian Hoffmann<[email protected]> 写道: Hi, On 12/3/20 9:48 AM, Allenzh li wrote: > Exactly, I develop a API which accept prometheus rule from web. > When user create a new rule, I want to add a fixed matcher(xxId="xxx"), > which label name is fixed and label value is various. > > eg. > cpu_usage / avg_over_time(cpu_usage[5m] offset 24h) > 2 -> > cpu_usage{xxId="xxx"} / avg_over_time(cpu_usage{xxId="xxx"}[5m] offset > 24h) > 2 So it seems like your web application will only handle the alert-specific PromQL expression which ends up in the alert's "expr" field. It seems like it would be straight forward to add the static label with the dynamic value directly into the Prometheus alert using the labels: field? https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/ (Ctrl+F "severity: page") Kind regards, Christian -- 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/tencent_C7312B3EC100B4BCD59505CC%40qq.com.

