File tree Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 90
90
91
91
.PHONY : test
92
92
test : $(PROMTOOL_BIN ) prometheus_alerts.yaml prometheus_rules.yaml
93
- @$(PROMTOOL_BIN ) test rules tests.yaml
93
+ @$(PROMTOOL_BIN ) test rules tests/ * .yaml
94
94
95
95
$(BIN_DIR ) :
96
96
mkdir -p $(BIN_DIR )
Original file line number Diff line number Diff line change
1
+ rule_files :
2
+ - ../prometheus_alerts.yaml
3
+ - ../prometheus_rules.yaml
4
+
5
+ evaluation_interval : 1m
6
+
7
+ tests :
8
+ - name : calculate apiserver request total increase 1h rate
9
+ interval : 1m
10
+ input_series :
11
+ # 100 requests in the overall interval, 99 successful and 1 error
12
+ - series : ' apiserver_request_total{job="kube-apiserver",verb="GET",code="200"}'
13
+ values : ' 0 10 20 50 90 99'
14
+ - series : ' apiserver_request_total{job="kube-apiserver",verb="GET",code="500"}'
15
+ values : ' 0x2 1x2'
16
+
17
+ promql_expr_test :
18
+ - eval_time : 5m
19
+ expr : code_verb:apiserver_request_total:increase1h{verb="GET"}
20
+ exp_samples :
21
+ - labels : ' code_verb:apiserver_request_total:increase1h{code="200", verb="GET"}'
22
+ value : 99.0
23
+ - labels : ' code_verb:apiserver_request_total:increase1h{code="500", verb="GET"}'
24
+ value : 1.0
25
+
26
+ - name : calculate apiserver request total increase 30d rate
27
+ interval : 1m
28
+ input_series :
29
+ - series : code_verb:apiserver_request_total:increase1h{verb="GET",code="200"}
30
+ values : ' 10+10x9'
31
+ - series : code_verb:apiserver_request_total:increase1h{verb="GET",code="500"}
32
+ values : ' 0+1x9'
33
+
34
+ promql_expr_test :
35
+ - eval_time : 10m
36
+ expr : code_verb:apiserver_request_total:increase30d{verb="GET"}
37
+ exp_samples :
38
+ - labels : ' code_verb:apiserver_request_total:increase30d{code="200", verb="GET"}'
39
+ value : 3.96e+4 # average of the input series values times 24 (hours) times 30 (days)
40
+ - labels : ' code_verb:apiserver_request_total:increase30d{code="500", verb="GET"}'
41
+ value : 3.24e+3
Original file line number Diff line number Diff line change 1
1
rule_files :
2
- - prometheus_alerts.yaml
3
- - prometheus_rules.yaml
2
+ - ../ prometheus_alerts.yaml
3
+ - ../ prometheus_rules.yaml
4
4
5
5
evaluation_interval : 1m
6
6
You can’t perform that action at this time.
0 commit comments