cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.74.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

internal/checks/alerts_comparison_test.snap

328lines · modecode

1
2[TestComparisonCheck/(foo_>_0)_or_vector(0) - 1]
3- description: (foo > 0) or vector(0)
4 content: |
5 - alert: Foo Is Down
6 expr: (foo > 0) or vector(0)
7 output: |
8 2 | expr: (foo > 0) or vector(0)
9 ^^^^^^^^^ If other parts of this query don't return anything then this part will always return a result and so this alert will fire.
10 problem:
11 reporter: alerts/comparison
12 summary: always firing alert
13 details: |-
14 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
15 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
16 In most cases this can be achieved by having some condition in the query expression.
17 For example `up == 0` or `rate(error_total[2m]) > 0`.
18 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
19 diagnostics:
20 - message: If other parts of this query don't return anything then this part will always return a result and so this alert will fire.
21 pos:
22 - line: 2
23 firstcolumn: 9
24 lastcolumn: 30
25 firstcolumn: 14
26 lastcolumn: 22
27 kind: 0
28 lines:
29 first: 2
30 last: 2
31 severity: 1
32 anchor: 0
33
34---
35
36[TestComparisonCheck/(foo_>_1)_>_bool_1 - 1]
37[]
38
39---
40
41[TestComparisonCheck/(foo_or_vector(0))_/_bar_<=_0 - 1]
42[]
43
44---
45
46[TestComparisonCheck/(foo_or_vector(0))_/_bar_>_0 - 1]
47[]
48
49---
50
51[TestComparisonCheck/absent(foo)_or_vector(0) - 1]
52- description: absent(foo) or vector(0)
53 content: |
54 - alert: Foo Is Down
55 expr: (foo > 0) or vector(0)
56 output: |
57 2 | expr: (foo > 0) or vector(0)
58 ^^^^^^^^^ If other parts of this query don't return anything then this part will always return a result and so this alert will fire.
59 problem:
60 reporter: alerts/comparison
61 summary: always firing alert
62 details: |-
63 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
64 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
65 In most cases this can be achieved by having some condition in the query expression.
66 For example `up == 0` or `rate(error_total[2m]) > 0`.
67 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
68 diagnostics:
69 - message: If other parts of this query don't return anything then this part will always return a result and so this alert will fire.
70 pos:
71 - line: 2
72 firstcolumn: 9
73 lastcolumn: 30
74 firstcolumn: 14
75 lastcolumn: 22
76 kind: 0
77 lines:
78 first: 2
79 last: 2
80 severity: 1
81 anchor: 0
82
83---
84
85[TestComparisonCheck/absent_or_absent - 1]
86[]
87
88---
89
90[TestComparisonCheck/absent_or_absent_or_absent - 1]
91[]
92
93---
94
95[TestComparisonCheck/alert_expr_with_==_condition - 1]
96[]
97
98---
99
100[TestComparisonCheck/alert_expr_with_>=_condition - 1]
101[]
102
103---
104
105[TestComparisonCheck/alert_expr_with_>_condition - 1]
106[]
107
108---
109
110[TestComparisonCheck/alert_expr_with_bool - 1]
111- description: alert expr with bool
112 content: |
113 - alert: Error rate is high
114 expr: rate(error_count[5m]) > bool 5
115 output: |
116 2 | expr: rate(error_count[5m]) > bool 5
117 ^^^^^^^^^^^^^^^ Results of this query are using the `bool` modifier, which means it will always return a result and the alert will always fire.
118 problem:
119 reporter: alerts/comparison
120 summary: always firing alert
121 details: |-
122 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
123 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
124 In most cases this can be achieved by having some condition in the query expression.
125 For example `up == 0` or `rate(error_total[2m]) > 0`.
126 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
127 diagnostics:
128 - message: Results of this query are using the `bool` modifier, which means it will always return a result and the alert will always fire.
129 pos:
130 - line: 2
131 firstcolumn: 9
132 lastcolumn: 38
133 firstcolumn: 6
134 lastcolumn: 20
135 kind: 0
136 lines:
137 first: 2
138 last: 2
139 severity: 1
140 anchor: 0
141
142---
143
144[TestComparisonCheck/alert_expr_with_bool_and_condition - 1]
145[]
146
147---
148
149[TestComparisonCheck/alert_expr_without_any_condition - 1]
150- description: alert expr without any condition
151 content: |
152 - alert: Foo Is Down
153 expr: up{job="foo"}
154 output: |
155 2 | expr: up{job="foo"}
156 ^^^^^^^^^^^^^ This query doesn't have any condition and so this alert will always fire if it matches anything.
157 problem:
158 reporter: alerts/comparison
159 summary: always firing alert
160 details: |-
161 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
162 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
163 In most cases this can be achieved by having some condition in the query expression.
164 For example `up == 0` or `rate(error_total[2m]) > 0`.
165 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
166 diagnostics:
167 - message: This query doesn't have any condition and so this alert will always fire if it matches anything.
168 pos:
169 - line: 2
170 firstcolumn: 9
171 lastcolumn: 21
172 firstcolumn: 1
173 lastcolumn: 13
174 kind: 0
175 lines:
176 first: 2
177 last: 2
178 severity: 1
179 anchor: 0
180
181---
182
183[TestComparisonCheck/alert_on_absent - 1]
184[]
185
186---
187
188[TestComparisonCheck/alert_on_absent_over_time - 1]
189[]
190
191---
192
193[TestComparisonCheck/alert_unless_condition - 1]
194[]
195
196---
197
198[TestComparisonCheck/deep_level_comparison - 1]
199[]
200
201---
202
203[TestComparisonCheck/deep_level_without_comparison - 1]
204- description: deep level without comparison
205 content: |4
206 - alert: High_UDP_Receive_Errors
207 expr: quantile_over_time(0.7,(irate(udp_packets_drops[2m]))[10m:2m])
208 AND ON (instance)
209 rate(node_netstat_Udp_RcvbufErrors[5m])+rate(node_netstat_Udp6_RcvbufErrors[5m])
210 output: |
211 3 | expr: quantile_over_time(0.7,(irate(udp_packets_drops[2m]))[10m:2m])
212 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This query doesn't have any condition and so this alert will always fire if it matches anything.
213 4 | AND ON (instance)
214 5 | rate(node_netstat_Udp_RcvbufErrors[5m])+rate(node_netstat_Udp6_RcvbufErrors[5m])
215 problem:
216 reporter: alerts/comparison
217 summary: always firing alert
218 details: |-
219 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
220 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
221 In most cases this can be achieved by having some condition in the query expression.
222 For example `up == 0` or `rate(error_total[2m]) > 0`.
223 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
224 diagnostics:
225 - message: This query doesn't have any condition and so this alert will always fire if it matches anything.
226 pos:
227 - line: 3
228 firstcolumn: 9
229 lastcolumn: 71
230 - line: 4
231 firstcolumn: 9
232 lastcolumn: 26
233 - line: 5
234 firstcolumn: 9
235 lastcolumn: 88
236 firstcolumn: 24
237 lastcolumn: 61
238 kind: 0
239 lines:
240 first: 3
241 last: 5
242 severity: 1
243 anchor: 0
244
245---
246
247[TestComparisonCheck/ignores_recording_rules - 1]
248[]
249
250---
251
252[TestComparisonCheck/ignores_rules_with_syntax_errors - 1]
253[]
254
255---
256
257[TestComparisonCheck/max()_*_group_right_label_replace(...) - 1]
258[]
259
260---
261
262[TestComparisonCheck/vector(0) - 1]
263- description: vector(0)
264 content: |
265 - alert: Foo Is Down
266 expr: vector(0)
267 output: |
268 2 | expr: vector(0)
269 ^^^^^^^^^ This query will always return a result and so this alert will always fire.
270 problem:
271 reporter: alerts/comparison
272 summary: always firing alert
273 details: |-
274 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
275 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
276 In most cases this can be achieved by having some condition in the query expression.
277 For example `up == 0` or `rate(error_total[2m]) > 0`.
278 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
279 diagnostics:
280 - message: This query will always return a result and so this alert will always fire.
281 pos:
282 - line: 2
283 firstcolumn: 9
284 lastcolumn: 17
285 firstcolumn: 1
286 lastcolumn: 9
287 kind: 0
288 lines:
289 first: 2
290 last: 2
291 severity: 1
292 anchor: 0
293
294---
295
296[TestComparisonCheck/vector(0)_or_(foo_>_0) - 1]
297- description: vector(0) or (foo > 0)
298 content: |
299 - alert: Foo Is Down
300 expr: (foo > 0) or vector(0)
301 output: |
302 2 | expr: (foo > 0) or vector(0)
303 ^^^^^^^^^ If other parts of this query don't return anything then this part will always return a result and so this alert will fire.
304 problem:
305 reporter: alerts/comparison
306 summary: always firing alert
307 details: |-
308 Prometheus alerting rules will trigger an alert for each query that returns *any* result.
309 Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
310 In most cases this can be achieved by having some condition in the query expression.
311 For example `up == 0` or `rate(error_total[2m]) > 0`.
312 Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).
313 diagnostics:
314 - message: If other parts of this query don't return anything then this part will always return a result and so this alert will fire.
315 pos:
316 - line: 2
317 firstcolumn: 9
318 lastcolumn: 30
319 firstcolumn: 14
320 lastcolumn: 22
321 kind: 0
322 lines:
323 first: 2
324 last: 2
325 severity: 1
326 anchor: 0
327
328---
329