cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.13.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/checks/rule/label.md

98lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# rule/label
8
9This check works the same way as [alerts/annotation](../alerts/annotation.md) check,
10but it operates on labels instead.
11It uses static labels set on alerting or recording rule. It doesn't use
12labels on time series used in those rules.
13
14## Configuration
15
16Syntax:
17
18```js
19label "$pattern" {
20 severity = "bug|warning|info"
21 value = "..."
22 required = true|false
23}
24```
25
26- `$pattern` - regexp pattern to match label name on
27- `severity` - set custom severity for reported issues, defaults to a warning
28- `value` - optional value pattern to enforce, if not set only the
29- `required` - if `true` pint will require every rule to have this label set,
30 if `false` it will only check values where label is set
31
32## How to enable it
33
34This check is not enabled by default as it requires explicit configuration
35to work.
36To enable it add one or more `rule {...}` blocks and specify all required
37labels there.
38
39Example:
40
41Require `severity` label to be set on alert rules with two all possible values:
42
43```js
44rule {
45 match {
46 kind = "alerting"
47 }
48
49 label "severity" {
50 value = "(warning|critical)"
51 required = true
52 }
53}
54```
55
56## How to disable it
57
58You can disable this check globally by adding this config block:
59
60```js
61checks {
62 disabled = ["rule/label"]
63}
64```
65
66Or you can disable it per rule by adding a comment to it:
67
68`# pint disable rule/label`
69
70If you want to disable only individual instances of this check
71you can add a more specific comment.
72
73`# pint disable rule/label($label:$required)`
74
75Where `$label` is the label name and `$required` is the configure value
76of `required` option.
77
78```yaml
79groups:
80 - name: ...
81 rules:
82 # pint disable rule/label($pattern:$required)
83 - record: ...
84 expr: ...
85```
86
87Example rule:
88
89```js
90label "severity" {
91 value = "(warning|critical)"
92 required = true
93}
94```
95
96Example comment disabling that rule:
97
98`# pint disable rule/label(severity:true)`
99