-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvalidation.yaml
148 lines (136 loc) · 3.91 KB
/
validation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# customExcludeAnnotation: my_disable_annotation
# customDisableComment: my_disable_comment
prometheus:
url: https://prometheus.demo.do.prometheus.io
timeout: 0.5s
bearerTokenFile: ./bearer.token
validationRules:
- name: check-severity-label
scope: Alert
validations:
- type: hasLabels
params:
labels: ["severity"]
- type: labelHasAllowedValue
paramsFromFile: ./allowed_values_params.yaml
- type: exclusiveLabels
params:
firstLabel: severity
firstLabelValue: info
secondLabel: page
# FIXME: Disabled until demo.do.prometheus.io is back online, see https://github.com/prometheus/demo-site/issues/114
# - type: expressionCanBeEvaluated
# params:
# timeSeriesLimit: 20
# evaluationDurationLimit: 10s
# - type: expressionUsesExistingLabels
# - type: expressionSelectorsMatchesAnything
- type: expressionDoesNotUseIrate
additionalDetails: "Just do as I say!"
- type: expressionDoesNotUseOlderDataThan
params:
limit: "6h"
- name: check-team-label
scope: Alert
validations:
- type: hasLabels
params:
labels: ["xxx"]
- type: labelHasAllowedValue
params:
label: "team"
allowedValues:
ignoreTemplatedValues: true
- name: check-playbook-annotation
scope: Alert
validations:
- type: hasAnyOfAnnotations
params:
annotations: ["playbook", "link"]
- type: annotationIsValidURL
params:
annotation: "link"
resolveUrl: true
- name: check-alert-title
scope: Alert
validations:
- type: hasAnnotations
params:
annotations: ["title"]
- name: check-prometheus-limitations
scope: All rules
validations:
- type: expressionDoesNotUseExperimentalFunctions
- type: expressionUsesUnderscoresInLargeNumbers
- type: expressionDoesNotUseOlderDataThan
params:
limit: "6h"
- type: expressionDoesNotUseLabels
params:
labels: ["cluster", "locality", "prometheus-type", "replica"]
- name: check-metric-name
scope: Alert
validations:
- type: expressionWithNoMetricName
- type: validateLabelTemplates
- type: keepFiringForIsNotLongerThan
params:
limit: "1h"
- name: check-groups
scope: Group
validations:
- type: hasAllowedEvaluationInterval
params:
minimum: "20s"
intervalMustBeSet: false
- type: maxRulesPerGroup
params:
limit: 10
- type: hasAllowedLimit
params:
limit: 100
- name: check-formatting
scope: All rules
validations:
- type: expressionIsWellFormatted
params:
showExpectedForm: true
skipExpressionsWithComments: true
- type: expressionDoesNotUseClassicHistogramBucketOperations
- name: check-recording-rules
scope: Recording rule
validations:
- type: recordedMetricNameDoesNotMatchRegexp
params:
regexp: "foo_bar"
- type: recordedMetricNameMatchesRegexp
params:
regexp: "[^:]+:[^:]+:[^:]+"
negative: true
- name: check-labels-in-expr
scope: All rules
validations:
- type: expressionUsesOnlyAllowedLabelValuesForMetricRegexp
params:
metricNameRegexp: up
allowedLabelValues:
job: ["prometheus"]
- type: expressionDoesNotUseLabelsForMetricRegexp
params:
metricNameRegexp: up
labels: ["app"]
- name: test-onlyif
scope: Alert
onlyIf:
- type: labelMatchesRegexp
params:
label: "severity"
regexp: "critical"
- type: maxRulesPerGroup
params:
limit: 1
validations:
- type: hasLabels
params:
labels: ["escalate"]