-
Notifications
You must be signed in to change notification settings - Fork 9
/
validation.yaml
118 lines (108 loc) · 3.09 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
# customExcludeAnnotation: my_disable_annotation
# customDisableComment: my_disable_comment
prometheus:
url: https://prometheus.demo.do.prometheus.io
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
- type: expressionCanBeEvaluated
params:
timeSeriesLimit: 20
evaluationDurationLimit: 10s
- type: expressionUsesExistingLabels
- type: expressionDoesNotUseIrate
additionalDetails: "Just do as I say!"
- type: expressionSelectorsMatchesAnything
- 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