cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.41.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/checks/promql/range_query.md

105lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# promql/range_query
8
9This check inspects range query selectors on all queries.
10It will warn if a query tries to request a time range that
11is bigger than Prometheus retention limits.
12
13By default Prometheus keeps [15 days of data](https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects),
14this can be customized by setting time or disk space limits.
15There are two main ways of configuring retention limits in Prometheus:
16* time based - Prometheus will keep last N days of metrics
17* disk based - Prometheus will try to use up to N bytes of disk space.
18
19Pint will ignore any disk space limits, since that doesn't tell us
20what the effective time retention is.
21But it will check the value of `--storage.tsdb.retention.time` flag passed
22to Prometheus and it will warn if any selector tries to query more
23data then Prometheus can store.
24
25For example if Prometheus is running with `--storage.tsdb.retention.time=30d`
26then it will store up to 30 days of historical metrics data.
27If we would try to query `foo[40d]` then that query can only return up
28to 30 days of data, it will never return more.
29
30This usually isn't really a problem but can indicate a mismatch between
31expectations of data retention and reality, and so you might think that by
32getting results of a `avg_over_time(foo[40d])` you are getting the average
33value of `foo` in the last 40 days, but in reality you're only getting
34an average value in the last 30 days, and you cannot get any more than that.
35
36## Configuration
37
38This check doesn't have any configuration options.
39
40## How to enable it
41
42This check is enabled by default for all configured Prometheus servers.
43
44Example:
45
46```js
47prometheus "prod" {
48 uri = "https://prometheus-prod.example.com"
49 timeout = "60s"
50 include = [
51 "rules/prod/.*",
52 "rules/common/.*",
53 ]
54}
55
56prometheus "dev" {
57 uri = "https://prometheus-dev.example.com"
58 timeout = "30s"
59 include = [
60 "rules/dev/.*",
61 "rules/common/.*",
62 ]
63}
64```
65
66## How to disable it
67
68You can disable this check globally by adding this config block:
69
70```js
71checks {
72 disabled = ["promql/range_query"]
73}
74```
75
76You can also disable it for all rules inside given file by adding
77a comment anywhere in that file. Example:
78
79`# pint file/disable promql/range_query`
80
81Or you can disable it per rule by adding a comment to it. Example:
82
83`# pint disable promql/range_query`
84
85If you want to disable only individual instances of this check
86you can add a more specific comment.
87
88`# pint disable promql/range_query($prometheus)`
89
90Where `$prometheus` is the name of Prometheus server to disable.
91
92Example:
93
94`# pint disable promql/range_query(prod)`
95
96## How to snooze it
97
98You can disable this check until given time by adding a comment to it. Example:
99
100`# pint snooze $TIMESTAMP promql/range_query`
101
102Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
103formatted or `YYYY-MM-DD`.
104Adding this comment will disable `promql/range_query` *until* `$TIMESTAMP`, after that
105check will be re-enabled.
106