cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/checks/rule/duplicate.md
102lines · modecode
| 1 | --- |
| 2 | layout: default |
| 3 | parent: Checks |
| 4 | grand_parent: Documentation |
| 5 | --- |
| 6 | |
| 7 | # rule/duplicate |
| 8 | |
| 9 | This check will find and report any duplicated recording rules. |
| 10 | |
| 11 | When Prometheus is configured with two identical recording rules that |
| 12 | are producing the exact time series it will discard results from one |
| 13 | of them. When that happens you will see warnings in logs, example: |
| 14 | |
| 15 | ```text |
| 16 | msg="Rule evaluation result discarded" err="duplicate sample for timestamp" |
| 17 | ``` |
| 18 | |
| 19 | Duplicated rule itself is not catastrophic but it will cause constant unnecessary |
| 20 | logs that might hide other issues and can lead to other problems if the |
| 21 | duplicated rule is later updated, but only in one place, not in both. |
| 22 | |
| 23 | ## Configuration |
| 24 | |
| 25 | This check doesn't have any configuration options. |
| 26 | |
| 27 | ## How to enable it |
| 28 | |
| 29 | This check is enabled by default for all configured Prometheus servers. |
| 30 | |
| 31 | Example: |
| 32 | |
| 33 | ```js |
| 34 | prometheus "prod" { |
| 35 | uri = "https://prometheus-prod.example.com" |
| 36 | timeout = "60s" |
| 37 | include = [ |
| 38 | "rules/prod/.*", |
| 39 | "rules/common/.*", |
| 40 | ] |
| 41 | } |
| 42 | |
| 43 | prometheus "dev" { |
| 44 | uri = "https://prometheus-dev.example.com" |
| 45 | timeout = "30s" |
| 46 | include = [ |
| 47 | "rules/dev/.*", |
| 48 | "rules/common/.*", |
| 49 | ] |
| 50 | } |
| 51 | ``` |
| 52 | |
| 53 | ## How to disable it |
| 54 | |
| 55 | You can disable this check globally by adding this config block: |
| 56 | |
| 57 | ```js |
| 58 | checks { |
| 59 | disabled = ["rule/duplicate"] |
| 60 | } |
| 61 | ``` |
| 62 | |
| 63 | You can also disable it for all rules inside given file by adding |
| 64 | a comment anywhere in that file. Example: |
| 65 | |
| 66 | ```yaml |
| 67 | # pint file/disable rule/duplicate |
| 68 | ``` |
| 69 | |
| 70 | Or you can disable it per rule by adding a comment to it. Example: |
| 71 | |
| 72 | ```yaml |
| 73 | # pint disable rule/duplicate |
| 74 | ``` |
| 75 | |
| 76 | If you want to disable only individual instances of this check |
| 77 | you can add a more specific comment. |
| 78 | |
| 79 | ```yaml |
| 80 | # pint disable rule/duplicate($prometheus) |
| 81 | ``` |
| 82 | |
| 83 | Where `$prometheus` is the name of Prometheus server to disable. |
| 84 | |
| 85 | Example: |
| 86 | |
| 87 | ```yaml |
| 88 | # pint disable rule/duplicate(prod) |
| 89 | ``` |
| 90 | |
| 91 | ## How to snooze it |
| 92 | |
| 93 | You can disable this check until given time by adding a comment to it. Example: |
| 94 | |
| 95 | ```yaml |
| 96 | # pint snooze $TIMESTAMP rule/duplicate |
| 97 | ``` |
| 98 | |
| 99 | Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) |
| 100 | formatted or `YYYY-MM-DD`. |
| 101 | Adding this comment will disable `rule/duplicate` *until* `$TIMESTAMP`, after that |
| 102 | check will be re-enabled. |
| 103 | |