cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.27.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/examples/config.hcl

133lines · 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 # Validate all links to ensure they point to pages that do exist.
66 link "https?://(.+)" {
67 severity = "warning"
68 timeout = "30s"
69 # Pass custom headers to all requests
70 headers = {
71 X-Auth = "secret key"
72 }
73 }
74}
75
76rule {
77 # This block will apply to all alerting rules with severity="critical" label set.
78 match {
79 kind = "alerting"
80
81 label "severity" {
82 value = "critical"
83 }
84 }
85
86 # All severity="critical" alerts must have a runbook link as annotation.
87 annotation "runbook" {
88 severity = "bug"
89 value = "https://runbook.example.com/.+"
90 required = true
91 }
92}
93
94rule {
95 # This block will apply to all recording rules.
96 match {
97 kind = "recording"
98 }
99
100 # Ensure that all aggregations are preserving "job" label.
101 aggregate ".+" {
102 severity = "bug"
103 keep = ["job"]
104 }
105
106 # Enable cost checks that will print the number of returned time series and try
107 # to estimate total memory usage assuming that each series require 4KB of memory.
108 cost {
109 bytesPerSample = 4096
110 }
111}
112
113rule {
114 # This block will apply to all recording rules in "recording/federation" directory.
115 match {
116 kind = "recording"
117 path = "recording/federation/.+"
118 }
119
120 # All recording rules named "cluster:.+" must strip "instance" label when aggregating.
121 # Example rule that would raise a linter error:
122 # - record: cluster:http_requests:rate5m
123 # expr: sum(rate(http_requests_total[5m])) by (job, instance)
124 # Rules that would be allowed:
125 # - record: cluster:http_requests:rate5m
126 # expr: sum(rate(http_requests_total[5m])) by (job)
127 # - record: cluster:http_requests:rate5m
128 # expr: sum(rate(http_requests_total[5m]))
129 aggregate "cluster:.+" {
130 severity = "bug"
131 strip = ["instance"]
132 }
133}
134