cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.75.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/checks/rule/dependency.md

87lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# rule/dependency
8
9This check only works when running `pint ci` and will validate that any
10removed recording rule isn't still being used by other rules.
11
12Removing any recording rule that is a dependency of other rules is likely
13to make them stop working, unless there's some other source of the metric
14that was produced by the removed rule.
15
16Example: consider this two rules, one generates `down:count` metric
17that is then used by the alert rule:
18
19```yaml
20groups:
21- name: ...
22 rules:
23 - record: down:count
24 expr: count(up == 0) by(job)
25 - alert: Job is down
26 expr: down:count > 0
27```
28
29If we were to edit this file and delete the recording rule:
30
31```yaml
32groups:
33- name: ...
34 rules:
35 - alert: Job is down
36 expr: down:count > 0
37```
38
39This would leave our alert rule broken because Prometheus would
40no longer have `down:count` metric.
41
42This check tries to detect scenarios like this but works across all
43files.
44
45## Configuration
46
47This check doesn't have any configuration options.
48
49## How to enable it
50
51This check is enabled by default.
52
53## How to disable it
54
55You can disable this check globally by adding this config block:
56
57```js
58checks {
59 disabled = ["rule/dependency"]
60}
61```
62
63You can also disable it for all rules inside given file by adding
64a comment anywhere in that file. Example:
65
66```yaml
67# pint file/disable rule/dependency
68```
69
70Or you can disable it per rule by adding a comment to it. Example:
71
72```yaml
73# pint disable rule/dependency
74```
75
76## How to snooze it
77
78You can disable this check until given time by adding a comment to it. Example:
79
80```yaml
81# pint snooze $TIMESTAMP rule/dependency
82```
83
84Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
85formatted or `YYYY-MM-DD`.
86Adding this comment will disable `rule/dependency` *until* `$TIMESTAMP`, after that
87check will be re-enabled.
88