cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/examples/selectors.hcl
41lines · modecode
| 1 | rule { |
| 2 | # Only match alerting rules. |
| 3 | match { |
| 4 | kind = "alerting" |
| 5 | } |
| 6 | |
| 7 | # All alerts using the up metric must specify the "job" label. |
| 8 | # |
| 9 | # Good: |
| 10 | # |
| 11 | # - alert: TargetDown |
| 12 | # expr: up{job="foo"} == 0 |
| 13 | # |
| 14 | # Bad: |
| 15 | # |
| 16 | # - alert: TargetDown |
| 17 | # expr: up |
| 18 | # |
| 19 | selector "up" { |
| 20 | requiredLabels = ["job"] |
| 21 | } |
| 22 | |
| 23 | # All alerts using the absent() or absent_over_time() call must specify |
| 24 | # the "team" label: |
| 25 | # |
| 26 | # Good: |
| 27 | # |
| 28 | # - alert: MetricAbsent |
| 29 | # expr: absent(my_metric{team="foo"}) |
| 30 | # |
| 31 | # Bad: |
| 32 | # |
| 33 | # - alert: MetricAbsent |
| 34 | # expr: absent(my_metric{}) |
| 35 | # |
| 36 | call "absent|absent_over_time" { |
| 37 | selector ".+" { |
| 38 | requiredLabels = ["team"] |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |