cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/examples/alerts_count.hcl
36lines · modecode
| 1 | # Example alerts/count configuration to catch rules that would fire |
| 2 | # too many alerts. This runs the alert query against Prometheus and |
| 3 | # estimates how many unique alerts it would generate. |
| 4 | |
| 5 | prometheus "prod" { |
| 6 | uri = "https://prometheus-prod.example.com" |
| 7 | } |
| 8 | |
| 9 | # Informational count for all alerting rules. |
| 10 | rule { |
| 11 | match { |
| 12 | kind = "alerting" |
| 13 | } |
| 14 | |
| 15 | alerts { |
| 16 | range = "1d" |
| 17 | step = "1m" |
| 18 | resolve = "5m" |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | # Fail CI if a new alert rule would immediately fire 50+ alerts. |
| 23 | rule { |
| 24 | match { |
| 25 | kind = "alerting" |
| 26 | } |
| 27 | |
| 28 | alerts { |
| 29 | range = "1d" |
| 30 | step = "1m" |
| 31 | resolve = "5m" |
| 32 | minCount = 50 |
| 33 | comment = "This alert would fire 50+ times immediately, narrow the query" |
| 34 | severity = "bug" |
| 35 | } |
| 36 | } |
| 37 | |