pyrra-dev / pyrra

Making SLOs with Prometheus manageable, accessible, and easy to use for everyone!
https://demo.pyrra.dev
Apache License 2.0
1.21k stars 108 forks source link

Specify labels for alerts #749

Open verejoel opened 1 year ago

verejoel commented 1 year ago

It would be good if we could add labels to the generated alerts, such that we can group and route them better in the AlertManager.

This is actually a blocking feature for our use case - if Pyrra had this functionality we could use it. Unfortunately we have to go with Sloth for now.

metalmatze commented 1 year ago

That actually works with Pyrra today.

Adding labels works like so:

apiVersion: pyrra.dev/v1alpha1
kind: ServiceLevelObjective
metadata:
  name: pyrra-api-errors
  namespace: monitoring
  labels:
    prometheus: k8s
    role: alert-rules
+   pyrra.dev/team: operations # Any labels prefixed with 'pyrra.dev/' will be propagated as Prometheus labels, while stripping the prefix.
spec:
...

This label will show up in the rules and alerts as team=operations. :relieved: