Hi Roland, On 5/19/20 10:25 AM, Roland Mieslinger wrote: > 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
alert_relabel_configs might be another option to override the severity label of alerts with specific labels (e.g. environment="qa"). I would also go for handling this in alert routing though, I agree. 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/cae39359-a4f5-3d05-f0dd-e35bd9c5a8ad%40hoffmann-christian.info.

