cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.44.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/checks/promql/range_query.md

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