cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/checks/promql/impossible.md
69lines · modecode
| 1 | --- |
| 2 | layout: default |
| 3 | parent: Checks |
| 4 | grand_parent: Documentation |
| 5 | --- |
| 6 | |
| 7 | # promql/impossible |
| 8 | |
| 9 | This check will report PromQL queries that can never return anything. |
| 10 | |
| 11 | Example query: |
| 12 | |
| 13 | ```js |
| 14 | foo{job="bar"} unless sum(foo) |
| 15 | ``` |
| 16 | |
| 17 | The right hand side (`unless sum(foo)`) cannot ever match any time series returned by the left hand side |
| 18 | (`foo{job="bar"}`) because `sum()` strips away all labels. This means that we end up with left hand side |
| 19 | having at least the `job` label, while the right hand side has no labels, so we end up with: |
| 20 | |
| 21 | ```js |
| 22 | foo{job="bar"} unless {} |
| 23 | ``` |
| 24 | |
| 25 | Both sides can only match if they have the same label set, see [Prometheus docs](https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching). A result with `{job="bar"}` will never be matched with empty label set `{}`. |
| 26 | |
| 27 | ## Configuration |
| 28 | |
| 29 | This check doesn't have any configuration options. |
| 30 | |
| 31 | ## How to enable it |
| 32 | |
| 33 | This check is enabled by default. |
| 34 | |
| 35 | ## How to disable it |
| 36 | |
| 37 | You can disable this check globally by adding this config block: |
| 38 | |
| 39 | ```js |
| 40 | checks { |
| 41 | disabled = ["promql/impossible"] |
| 42 | } |
| 43 | ``` |
| 44 | |
| 45 | You can also disable it for all rules inside given file by adding |
| 46 | a comment anywhere in that file. Example: |
| 47 | |
| 48 | ```yaml |
| 49 | # pint file/disable promql/impossible |
| 50 | ``` |
| 51 | |
| 52 | Or you can disable it per rule by adding a comment to it. Example: |
| 53 | |
| 54 | ```yaml |
| 55 | # pint disable promql/impossible |
| 56 | ``` |
| 57 | |
| 58 | ## How to snooze it |
| 59 | |
| 60 | You can disable this check until given time by adding a comment to it. Example: |
| 61 | |
| 62 | ```yaml |
| 63 | # pint snooze $TIMESTAMP promql/impossible |
| 64 | ``` |
| 65 | |
| 66 | Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) |
| 67 | formatted or `YYYY-MM-DD`. |
| 68 | Adding this comment will disable `promql/impossible` *until* `$TIMESTAMP`, after that |
| 69 | check will be re-enabled. |
| 70 | |