cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.21.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/examples/config.hcl

123lines · modecode

1# Define "prod" Prometheus instance that will only be used for
2# rules defined in file matching "alerting/prod/.+" or "recording/prod/.+".
3prometheus "prod" {
4 uri = "https://prod.example.com"
5 timeout = "30s"
6
7 paths = [
8 "alerting/prod/.+",
9 "recording/prod/.+",
10 ]
11}
12
13# Define "dev" Prometheus instance that will be use for all rule checks.
14prometheus "dev" {
15 uri = "https://dev.example.com"
16 timeout = "60s"
17}
18
19rule {
20 # Disallow spaces in label/annotation keys, they're only allowed in values.
21 reject ".* +.*" {
22 label_keys = true
23 annotation_keys = true
24 }
25
26 # Disallow URLs in labels, they should go to annotations.
27 reject "https?://.+" {
28 label_keys = true
29 label_values = true
30 }
31}
32
33rule {
34 # This block will apply to all alerting rules.
35 match {
36 kind = "alerting"
37 }
38
39 # Each alert must have a 'summary' annotation on every alert.
40 annotation "summary" {
41 severity = "bug"
42 required = true
43 }
44
45 # Each alert must have a 'dashboard' annotation that links to grafana.
46 annotation "dashboard" {
47 severity = "bug"
48 value = "https://grafana.example.com/(.+)"
49 }
50
51 # Each alert must have a 'severity' annotation that's either 'critical' or 'warning'.
52 label "severity" {
53 severity = "bug"
54 value = "(critical|warning)"
55 required = true
56 }
57
58 # Check how many times each alert would fire in the last 1d.
59 alerts {
60 range = "1d"
61 step = "1m"
62 resolve = "5m"
63 }
64}
65
66rule {
67 # This block will apply to all alerting rules with severity="critical" label set.
68 match {
69 kind = "alerting"
70
71 label "severity" {
72 value = "critical"
73 }
74 }
75
76 # All severity="critical" alerts must have a runbook link as annotation.
77 annotation "runbook" {
78 severity = "bug"
79 value = "https://runbook.example.com/.+"
80 required = true
81 }
82}
83
84rule {
85 # This block will apply to all recording rules.
86 match {
87 kind = "recording"
88 }
89
90 # Ensure that all aggregations are preserving "job" label.
91 aggregate ".+" {
92 severity = "bug"
93 keep = ["job"]
94 }
95
96 # Enable cost checks that will print the number of returned time series and try
97 # to estimate total memory usage assuming that each series require 4KB of memory.
98 cost {
99 bytesPerSample = 4096
100 }
101}
102
103rule {
104 # This block will apply to all recording rules in "recording/federation" directory.
105 match {
106 kind = "recording"
107 path = "recording/federation/.+"
108 }
109
110 # All recording rules named "cluster:.+" must strip "instance" label when aggregating.
111 # Example rule that would raise a linter error:
112 # - record: cluster:http_requests:rate5m
113 # expr: sum(rate(http_requests_total[5m])) by (job, instance)
114 # Rules that would be allowed:
115 # - record: cluster:http_requests:rate5m
116 # expr: sum(rate(http_requests_total[5m])) by (job)
117 # - record: cluster:http_requests:rate5m
118 # expr: sum(rate(http_requests_total[5m]))
119 aggregate "cluster:.+" {
120 severity = "bug"
121 strip = ["instance"]
122 }
123}
124