you can try:
severity: '{{ if eq $labels.environment "qa" }} warn {{ else }} page {{ end
}}'
On Tuesday, May 19, 2020 at 3:25:01 PM UTC+7, Roland Mieslinger wrote:
>
> Hi,
>
> we are using the same set of alert rules for both, our production and qa
> environment, with the severity label set to a value based on what is
> appropriate for production.
> As a consequence, alert severity is too high for most alerts in our qa
> environment.
>
> The environment is available as a label form every metric, I could of
> course duplicate all alert rules, filter by environment label, and set the
> appropriate severity label; very tedious in the long run, but so far the
> only solution that came to my mind,
>
> Are there better ways to achieve this, what am I missing?
>
> Something like the ternary operator would be helpful in this case, e. g.:
> labels:
> severity: environment=="qa" ? "warn" : "page"
>
> Alternativly some kind of "functional if " could solve this as well:
> labels:
> severity: iff(environment=="qa", "warn", "page")
> note: depending on the implementation this could cause performance issues
> if the expression engine requires
> evaluation of all parameters passed to the function
>
>
>
>
>
--
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/b1a54c2e-22dc-4ba2-807b-04bb62ccd952%40googlegroups.com.