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/2883a76e-8221-d626-32cd-abc7233e686d%40hoffmann-christian.info.

Reply via email to