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/alerts/count.md

136lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# alerts/count
8
9This check is used to estimate how many times given alert would fire.
10It will run `expr` query from every alert rule against selected Prometheus
11servers and report how many unique alerts it would generate.
12If `for` and/or `keep_firing_for` are set on alerts they will be used to adjust results.
13
14## Configuration
15
16Syntax:
17
18```js
19alerts {
20 range = "1h"
21 step = "1m"
22 resolve = "5m"
23 minCount = 0
24 comment = "..."
25 severity = "bug|warning|info"
26}
27```
28
29- `range` - query range, how far to look back, `1h` would mean that pint will
30 query last 1h of metrics.
31 Defaults to `1d`.
32- `step` - query resolution, for most accurate result use step equal
33 to `scrape_interval`, try to reduce it if that would load too many samples.
34 Defaults to `1m`.
35- `resolve` - duration after which stale alerts are resolved. Defaults to `5m`.
36- `minCount` - minimal number of alerts for this check to report it. Default to `0`.
37 Set this to a no-zero value if you want this check to report only if the estimated
38 number of alerts is high enough.
39- `comment` - set a custom comment that will be added to reported problems.
40- `severity` - set custom severity for reported issues, defaults to `info`.
41 This can be only set when `minCount` is set to a non-zero value.
42
43## How to enable it
44
45This check is not enabled by default as it requires explicit configuration
46to work.
47To enable it add one or more `prometheus {...}` blocks and a `rule {...}` block
48with this checks config.
49
50Example:
51
52```js
53prometheus "prod" {
54 uri = "https://prometheus-prod.example.com"
55 timeout = "60s"
56}
57
58rule {
59 alerts {
60 range = "1d"
61 step = "1m"
62 resolve = "5m"
63 }
64}
65```
66
67Report an error if there would be too many (>=50) alerts firing:
68
69```js
70prometheus "prod" {
71 uri = "https://prometheus-prod.example.com"
72 timeout = "60s"
73}
74
75rule {
76 alerts {
77 range = "1d"
78 step = "1m"
79 resolve = "5m"
80 minCount = 50
81 comment = "You cannot add an rule that would immediately fire 50+ alerts, fix the problem first"
82 severity = "bug"
83 }
84}
85```
86
87## How to disable it
88
89You can disable this check globally by adding this config block:
90
91```js
92checks {
93 disabled = ["alerts/count"]
94}
95```
96
97You can also disable it for all rules inside given file by adding
98a comment anywhere in that file. Example:
99
100```yaml
101# pint file/disable alerts/count
102```
103
104Or you can disable it per rule by adding a comment to it. Example:
105
106```yaml
107# pint disable alerts/count
108```
109
110If you want to disable only individual instances of this check
111you can add a more specific comment.
112
113```yaml
114# pint disable alerts/count($prometheus)
115```
116
117Where `$prometheus` is the name of Prometheus server to disable.
118
119Example:
120
121```yaml
122# pint disable alerts/count(prod)
123```
124
125## How to snooze it
126
127You can disable this check until given time by adding a comment to it. Example:
128
129```yaml
130# pint snooze $TIMESTAMP alerts/count
131```
132
133Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
134formatted or `YYYY-MM-DD`.
135Adding this comment will disable `alerts/count` *until* `$TIMESTAMP`, after that
136check will be re-enabled.
137