cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.69.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/checks/promql/vector_matching.md

128lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# promql/vector_matching
8
9This check will try to find queries that try to
10[match vectors](https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching)
11but have different sets of labels on both side of the query.
12
13Consider these two time series:
14
15```js
16http_errors{job="node-exporter", cluster="prod", instance="server1"}
17```
18
19and
20
21```js
22cluster:http_errors{job="node-exporter", cluster="prod"}
23```
24
25One of them tracks specific instance and one aggregates series for the whole cluster.
26Because they have different set of labels if we want to calculate some value using both
27of them, for example:
28
29```js
30http_errors / cluster:http_errors
31```
32
33we wouldn't get any results. To fix that we need ignore extra labels:
34
35```js
36http_errors / ignoring(instance) cluster:http_errors
37```
38
39This check aims to find all queries that using vector matching where both sides
40of the query have different sets of labels causing no results to be returned.
41
42**NOTE**: it's impossible for this check to inspect all time series in Prometheus
43against all other series as it would be too expensive.
44It will first check if given query returns anything, and
45only if it doesn't it will run extra checks. When running extra checks it will sample
46only a few time series from each side of the query, so it might not find all possible
47issues.
48
49## Configuration
50
51This check doesn't have any configuration options.
52
53## How to enable it
54
55This check is enabled by default for all configured Prometheus servers.
56
57Example:
58
59```js
60prometheus "prod" {
61 uri = "https://prometheus-prod.example.com"
62 timeout = "60s"
63 include = [
64 "rules/prod/.*",
65 "rules/common/.*",
66 ]
67}
68
69prometheus "dev" {
70 uri = "https://prometheus-dev.example.com"
71 timeout = "30s"
72 include = [
73 "rules/dev/.*",
74 "rules/common/.*",
75 ]
76}
77```
78
79## How to disable it
80
81You can disable this check globally by adding this config block:
82
83```js
84checks {
85 disabled = ["promql/vector_matching"]
86}
87```
88
89You can also disable it for all rules inside given file by adding
90a comment anywhere in that file. Example:
91
92```yaml
93# pint file/disable promql/vector_matching
94```
95
96Or you can disable it per rule by adding a comment to it. Example:
97
98```yaml
99# pint disable promql/vector_matching
100```
101
102If you want to disable only individual instances of this check
103you can add a more specific comment.
104
105```yaml
106# pint disable promql/vector_matching($prometheus)
107```
108
109Where `$prometheus` is the name of Prometheus server to disable.
110
111Example:
112
113```yaml
114# pint disable promql/vector_matching(prod)
115```
116
117## How to snooze it
118
119You can disable this check until given time by adding a comment to it. Example:
120
121```yaml
122# pint snooze $TIMESTAMP promql/vector_matching
123```
124
125Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
126formatted or `YYYY-MM-DD`.
127Adding this comment will disable `promql/vector_matching` *until* `$TIMESTAMP`, after that
128check will be re-enabled.
129