Skip to content

Commit 3f0d68a

Browse files
authored
Adapt Alarm and MQE CLI query in the E2E (#12918)
1 parent 6fbd9e7 commit 3f0d68a

17 files changed

+270
-95
lines changed

test/e2e-v2/cases/alarm/alarm-cases.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
# before silence alarm list level=CRITICAL,receivers=zhangsan
2626
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags level=CRITICAL,receivers=zhangsan
2727
expected: expected/silence-before-graphql-critical.yml
28+
# query auto complete tag key and value
29+
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm autocomplete-keys
30+
expected: expected/tag-keys.yml
31+
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm autocomplete-values --key=level
32+
expected: expected/tag-values.yml
2833
# before silence webhook
2934
- query: curl -s -XPOST http://${provider_host}:${provider_9090}/alarm/read
3035
expected: expected/silence-before-webhook.yml

test/e2e-v2/cases/alarm/expected/silence-after-graphql-critical.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ msgs:
1818
- starttime: {{ gt .starttime 0 }}
1919
scope: Service
2020
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
21+
name: e2e-service-provider
2122
message: Service e2e-service-provider response time is more than 10ms and sla is more than 1%.
2223
tags:
2324
- key: level
@@ -39,28 +40,22 @@ msgs:
3940
endtime: {{ gt .endtime 0 }}
4041
layer: GENERAL
4142
{{- end }}
42-
- starttime: {{ gt .starttime 0 }}
43-
scope: Service
44-
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
45-
message: Service e2e-service-provider response time is more than 10ms and sla is more than 1%.
46-
tags:
47-
- key: level
48-
value: CRITICAL
49-
- key: receivers
50-
value: zhangsan
51-
events:
52-
{{- contains .events }}
53-
- uuid: {{ notEmpty .uuid }}
54-
source:
55-
service: e2e-service-provider
56-
serviceinstance: ""
57-
endpoint: ""
58-
name: Alarm
59-
type: ""
60-
message: {{ notEmpty .message}}
61-
parameters: []
62-
starttime: {{ gt .starttime 0 }}
63-
endtime: {{ gt .endtime 0 }}
64-
layer: GENERAL
43+
snapshot:
44+
expression: sum((service_resp_time > 10) * (service_sla > 100)) >= 1
45+
metrics:
46+
{{- contains .snapshot.metrics }}
47+
- name: service_resp_time
48+
results:
49+
{{- contains .results }}
50+
- metric:
51+
labels: []
52+
values:
53+
{{- contains .values }}
54+
- id: {{ notEmpty .id }}
55+
owner: null
56+
value: {{ .value }}
57+
traceid: null
58+
{{- end }}
59+
{{- end }}
6560
{{- end }}
6661
{{- end }}

test/e2e-v2/cases/alarm/expected/silence-after-graphql-warn.yml

Lines changed: 40 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ msgs:
1818
- starttime: {{ gt .starttime 0 }}
1919
scope: Service
2020
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
21+
name: e2e-service-provider
2122
message: Percentile response time of service e2e-service-provider alarm in 3 minutes of last 10 minutes, due to more than one condition of p50 > 10, p75 > 10, p90 > 10, p95 > 10, p99 > 10.
2223
tags:
2324
- key: level
@@ -39,9 +40,30 @@ msgs:
3940
endtime: {{ gt .endtime 0 }}
4041
layer: GENERAL
4142
{{- end }}
43+
snapshot:
44+
expression: sum(service_percentile{p='50,75,90,95,99'} > 10) >= 3
45+
metrics:
46+
{{- contains .snapshot.metrics }}
47+
- name: service_percentile
48+
results:
49+
{{- contains .results }}
50+
- metric:
51+
labels:
52+
- key: p
53+
value: "50"
54+
values:
55+
{{- contains .values }}
56+
- id: {{ notEmpty .id }}
57+
owner: null
58+
value: "{{ .value }}"
59+
traceid: null
60+
{{- end }}
61+
{{- end }}
62+
{{- end }}
4263
- starttime: {{ gt .starttime 0 }}
4364
scope: Service
4465
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
66+
name: e2e-service-provider
4567
message: Response time of service e2e-service-provider is increase/decrease in 1 minutes of last 10 minutes.
4668
tags:
4769
- key: level
@@ -63,52 +85,22 @@ msgs:
6385
endtime: {{ gt .endtime 0 }}
6486
layer: GENERAL
6587
{{- end }}
66-
- starttime: {{ gt .starttime 0 }}
67-
scope: Service
68-
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
69-
message: Percentile response time of service e2e-service-provider alarm in 3 minutes of last 10 minutes, due to more than one condition of p50 > 10, p75 > 10, p90 > 10, p95 > 10, p99 > 10.
70-
tags:
71-
- key: level
72-
value: WARNING
73-
- key: receivers
74-
value: lisi
75-
events:
76-
{{- contains .events }}
77-
- uuid: {{ notEmpty .uuid }}
78-
source:
79-
service: e2e-service-provider
80-
serviceinstance: ""
81-
endpoint: ""
82-
name: Alarm
83-
type: ""
84-
message: {{ notEmpty .message }}
85-
parameters: []
86-
starttime: {{ gt .starttime 0 }}
87-
endtime: {{ gt .endtime 0 }}
88-
layer: GENERAL
89-
{{- end }}
90-
- starttime: {{ gt .starttime 0 }}
91-
scope: Service
92-
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
93-
message: Response time of service e2e-service-provider is increase/decrease in 1 minutes of last 10 minutes.
94-
tags:
95-
- key: level
96-
value: WARNING
97-
- key: receivers
98-
value: lisi
99-
events:
100-
{{- contains .events }}
101-
- uuid: {{ notEmpty .uuid }}
102-
source:
103-
service: e2e-service-provider
104-
serviceinstance: ""
105-
endpoint: ""
106-
name: Alarm
107-
type: ""
108-
message: {{ notEmpty .message}}
109-
parameters: []
110-
starttime: {{ gt .starttime 0 }}
111-
endtime: {{ gt .endtime 0 }}
112-
layer: GENERAL
88+
snapshot:
89+
expression: sum(abs(increase(service_resp_time,1)) > 0) >= 1
90+
metrics:
91+
{{- contains .snapshot.metrics }}
92+
- name: service_resp_time
93+
results:
94+
{{- contains .results }}
95+
- metric:
96+
labels: []
97+
values:
98+
{{- contains .values }}
99+
- id: {{ notEmpty .id }}
100+
owner: null
101+
value: {{ .value }}
102+
traceid: null
103+
{{- end }}
104+
{{- end }}
113105
{{- end }}
114-
{{- end }}
106+
{{- end }}

test/e2e-v2/cases/alarm/expected/silence-before-graphql-critical.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ msgs:
1818
- starttime: {{ gt .starttime 0 }}
1919
scope: Service
2020
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
21+
name: e2e-service-provider
2122
message: Service e2e-service-provider response time is more than 10ms and sla is more than 1%.
2223
tags:
2324
- key: level
@@ -39,4 +40,22 @@ msgs:
3940
endtime: {{ gt .endtime 0 }}
4041
layer: GENERAL
4142
{{- end }}
43+
snapshot:
44+
expression: sum((service_resp_time > 10) * (service_sla > 100)) >= 1
45+
metrics:
46+
{{- contains .snapshot.metrics }}
47+
- name: service_resp_time
48+
results:
49+
{{- contains .results }}
50+
- metric:
51+
labels: []
52+
values:
53+
{{- contains .values }}
54+
- id: {{ notEmpty .id }}
55+
owner: null
56+
value: {{ .value }}
57+
traceid: null
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
4261
{{- end }}

test/e2e-v2/cases/alarm/expected/silence-before-graphql-warn.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ msgs:
1818
- starttime: {{ gt .starttime 0 }}
1919
scope: Service
2020
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
21+
name: e2e-service-provider
2122
message: Percentile response time of service e2e-service-provider alarm in 3 minutes of last 10 minutes, due to more than one condition of p50 > 10, p75 > 10, p90 > 10, p95 > 10, p99 > 10.
2223
tags:
2324
- key: level
@@ -39,9 +40,30 @@ msgs:
3940
endtime: {{ gt .endtime 0 }}
4041
layer: GENERAL
4142
{{- end }}
43+
snapshot:
44+
expression: sum(service_percentile{p='50,75,90,95,99'} > 10) >= 3
45+
metrics:
46+
{{- contains .snapshot.metrics }}
47+
- name: service_percentile
48+
results:
49+
{{- contains .results }}
50+
- metric:
51+
labels:
52+
- key: p
53+
value: "50"
54+
values:
55+
{{- contains .values }}
56+
- id: {{ notEmpty .id }}
57+
owner: null
58+
value: "{{ .value }}"
59+
traceid: null
60+
{{- end }}
61+
{{- end }}
62+
{{- end }}
4263
- starttime: {{ gt .starttime 0 }}
4364
scope: Service
4465
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
66+
name: e2e-service-provider
4567
message: Response time of service e2e-service-provider is increase/decrease in 1 minutes of last 10 minutes.
4668
tags:
4769
- key: level
@@ -63,4 +85,22 @@ msgs:
6385
endtime: {{ gt .endtime 0 }}
6486
layer: GENERAL
6587
{{- end }}
88+
snapshot:
89+
expression: sum(abs(increase(service_resp_time,1)) > 0) >= 1
90+
metrics:
91+
{{- contains .snapshot.metrics }}
92+
- name: service_resp_time
93+
results:
94+
{{- contains .results }}
95+
- metric:
96+
labels: []
97+
values:
98+
{{- contains .values }}
99+
- id: {{ notEmpty .id }}
100+
owner: null
101+
value: {{ .value }}
102+
traceid: null
103+
{{- end }}
104+
{{- end }}
105+
{{- end }}
66106
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
{{- contains . }}
17+
- level
18+
- receivers
19+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
{{- contains . }}
17+
- WARNING
18+
- CRITICAL
19+
{{- end }}

test/e2e-v2/cases/mqe/expected/topN-OP-instance.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ results:
2020
labels: []
2121
values:
2222
- id: provider1
23-
value: "100"
23+
value: "{{ (index (index .results 0).values 0).value }}"
2424
traceid: null
25-
owner: null
25+
owner:
26+
scope: ServiceInstance
27+
serviceid: {{ b64enc "e2e-service-provider"}}.1
28+
servicename: e2e-service-provider
29+
normal: true
30+
serviceinstanceid: {{ b64enc "e2e-service-provider"}}.1_{{ b64enc "provider1"}}
31+
serviceinstancename: provider1
32+
endpointid: null
33+
endpointname: null
2634
error: null

test/e2e-v2/cases/mqe/expected/topN-OP-service.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,25 @@ results:
2222
- id: e2e-service-consumer
2323
value: "{{ (index (index .results 0).values 0).value }}"
2424
traceid: null
25-
owner: null
25+
owner:
26+
scope: Service
27+
serviceid: {{ b64enc "e2e-service-consumer"}}.1
28+
servicename: e2e-service-consumer
29+
normal: true
30+
serviceinstanceid: null
31+
serviceinstancename: null
32+
endpointid: null
33+
endpointname: null
2634
- id: e2e-service-provider
2735
value: "{{ (index (index .results 0).values 1).value }}"
2836
traceid: null
29-
owner: null
37+
owner:
38+
scope: Service
39+
serviceid: {{ b64enc "e2e-service-provider"}}.1
40+
servicename: e2e-service-provider
41+
normal: true
42+
serviceinstanceid: null
43+
serviceinstancename: null
44+
endpointid: null
45+
endpointname: null
3046
error: null

test/e2e-v2/cases/mqe/mqe-cases.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ cases:
4040
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_resp_time,3,des)"
4141
expected: expected/topN-OP-service.yml
4242
# topN-OP-service Global with attrs
43-
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des,attr0='GENERAL')/100"
43+
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_resp_time,3,des,attr0='GENERAL')/100"
4444
expected: expected/topN-OP-service.yml
45-
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des,attr0!='Not_GENERAL')/100"
45+
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_resp_time,3,des,attr0!='Not_GENERAL')/100"
4646
expected: expected/topN-OP-service.yml
4747

4848
# topN-OP-isntance
49-
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_instance_sla,3,des)/100" --service-name=e2e-service-provider
49+
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_instance_resp_time,3,des)/100" --service-name=e2e-service-provider
5050
expected: expected/topN-OP-instance.yml
5151

5252
# select labels and relabels

0 commit comments

Comments
 (0)