cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.73.7

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/checks/rule/for.md

117lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# rule/for
8
9This check allows to enforce the presence of `for` or `keep_firing_for` field
10on alerting rules.
11You can configure it to enforce some minimal and/or maximum duration
12set on alerts via `for` and/or `keep_firing_for` fields.
13
14## Configuration
15
16This check doesn't have any configuration options.
17
18## How to enable it
19
20This check uses either `for` or `keep_firing_for` configuration
21blocks, depending on which alerting rule field you want to enforce.
22
23Syntax:
24
25```js
26for {
27 comment = "comment"
28 severity = "bug|warning|info"
29 min = "5m"
30 max = "10m"
31}
32keep_firing_for {
33 comment = "comment"
34 severity = "bug|warning|info"
35 min = "5m"
36 max = "10m"
37}
38```
39
40- `comment` - set a custom comment that will be added to reported problems.
41- `severity` - set custom severity for reported issues, defaults to a bug.
42- `min` - minimum required `for` value for matching alerting rules.
43 If not set minimum `for` duration won't be enforced.
44- `max` - maximum allowed `for` value for matching alerting rules.
45- If not set maximum `for` duration won't be enforced.
46
47Example:
48
49Enforce that all alerts have `for` fields of `5m` or more:
50
51```js
52for {
53 comment = "All alert rules must have for:5m (or more) to avoid flaky alerts"
54 severity = "bug"
55 min = "5m"
56}
57```
58
59Enforce that all alerts have `keep_firing_for` fields with no more than `1h`:
60
61```js
62keep_firing_for {
63 severity = "bug"
64 max = "1h"
65}
66```
67
68To enforce both at the same time:
69
70```js
71for {
72 severity = "bug"
73 min = "5m"
74 max = "10m"
75}
76
77keep_firing_for {
78 severity = "bug"
79 max = "1h"
80}
81```
82
83## How to disable it
84
85You can disable this check globally by adding this config block:
86
87```js
88checks {
89 disabled = ["rule/for"]
90}
91```
92
93You can also disable it for all rules inside given file by adding
94a comment anywhere in that file. Example:
95
96```yaml
97# pint file/disable rule/for
98```
99
100Or you can disable it per rule by adding a comment to it. Example:
101
102```yaml
103# pint disable rule/for
104```
105
106## How to snooze it
107
108You can disable this check until given time by adding a comment to it. Example:
109
110```yaml
111# pint snooze $TIMESTAMP rule/for
112```
113
114Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
115formatted or `YYYY-MM-DD`.
116Adding this comment will disable `rule/duplicate` *until* `$TIMESTAMP`, after that
117check will be re-enabled.
118