cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/checks/alerts/comparison.md
68lines · modecode
| 1 | --- |
| 2 | layout: default |
| 3 | parent: Checks |
| 4 | grand_parent: Documentation |
| 5 | --- |
| 6 | |
| 7 | # alerts/comparison |
| 8 | |
| 9 | This check enforces use of a comparison operator in alert queries. |
| 10 | Any result returned by alerting rule query will trigger an alert, so it's |
| 11 | recommended for all alert queries to have some condition `errors > 10`, so we |
| 12 | only get `errors` series if the value is above 10. |
| 13 | If we would remove `> 10` part query would always return `errors` and so it |
| 14 | would always trigger an alert, even when `errors` value is `0`. |
| 15 | |
| 16 | In some cases time series or specific label values will only be exported to |
| 17 | Prometheus under some conditions, for example `http_responses_total{code="504"}` |
| 18 | might only be exported if there's at least one 504 error observed. |
| 19 | This means that an alert with a query `http_responses_total{code="504"}` might |
| 20 | work perfectly fine, since in practice we'll never have this specific time |
| 21 | series in Prometheus with zero value. |
| 22 | But this setup is fragile and unpredictable, so it's highly recommended to |
| 23 | have always set conditions on alerts, especially that adding `> 0` shouldn't |
| 24 | have any negative side effects. |
| 25 | |
| 26 | ## Configuration |
| 27 | |
| 28 | This check doesn't have any configuration options. |
| 29 | |
| 30 | ## How to enable it |
| 31 | |
| 32 | This check is enabled by default. |
| 33 | |
| 34 | ## How to disable it |
| 35 | |
| 36 | You can disable this check globally by adding this config block: |
| 37 | |
| 38 | ```js |
| 39 | checks { |
| 40 | disabled = ["alerts/comparison"] |
| 41 | } |
| 42 | ``` |
| 43 | |
| 44 | You can also disable it for all rules inside given file by adding |
| 45 | a comment anywhere in that file. Example: |
| 46 | |
| 47 | ```yaml |
| 48 | # pint file/disable alerts/comparison |
| 49 | ``` |
| 50 | |
| 51 | Or you can disable it per rule by adding a comment to it. Example: |
| 52 | |
| 53 | ```yaml |
| 54 | # pint disable alerts/comparison |
| 55 | ``` |
| 56 | |
| 57 | ## How to snooze it |
| 58 | |
| 59 | You can disable this check until given time by adding a comment to it. Example: |
| 60 | |
| 61 | ```yaml |
| 62 | # pint snooze $TIMESTAMP alerts/comparison |
| 63 | ``` |
| 64 | |
| 65 | Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) |
| 66 | formatted or `YYYY-MM-DD`. |
| 67 | Adding this comment will disable `alerts/comparison` *until* `$TIMESTAMP`, after that |
| 68 | check will be re-enabled. |
| 69 | |