Skip to content

Commit

Permalink
Adapt Alarm and MQE CLI query in the E2E (#12918)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrproliu authored Jan 1, 2025
1 parent 6fbd9e7 commit 3f0d68a
Show file tree
Hide file tree
Showing 17 changed files with 270 additions and 95 deletions.
5 changes: 5 additions & 0 deletions test/e2e-v2/cases/alarm/alarm-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
# before silence alarm list level=CRITICAL,receivers=zhangsan
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags level=CRITICAL,receivers=zhangsan
expected: expected/silence-before-graphql-critical.yml
# query auto complete tag key and value
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm autocomplete-keys
expected: expected/tag-keys.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm autocomplete-values --key=level
expected: expected/tag-values.yml
# before silence webhook
- query: curl -s -XPOST http://${provider_host}:${provider_9090}/alarm/read
expected: expected/silence-before-webhook.yml
Expand Down
41 changes: 18 additions & 23 deletions test/e2e-v2/cases/alarm/expected/silence-after-graphql-critical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ msgs:
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
message: Service e2e-service-provider response time is more than 10ms and sla is more than 1%.
tags:
- key: level
Expand All @@ -39,28 +40,22 @@ msgs:
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
message: Service e2e-service-provider response time is more than 10ms and sla is more than 1%.
tags:
- key: level
value: CRITICAL
- key: receivers
value: zhangsan
events:
{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-service-provider
serviceinstance: ""
endpoint: ""
name: Alarm
type: ""
message: {{ notEmpty .message}}
parameters: []
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
layer: GENERAL
snapshot:
expression: sum((service_resp_time > 10) * (service_sla > 100)) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}
88 changes: 40 additions & 48 deletions test/e2e-v2/cases/alarm/expected/silence-after-graphql-warn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ msgs:
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
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.
tags:
- key: level
Expand All @@ -39,9 +40,30 @@ msgs:
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
snapshot:
expression: sum(service_percentile{p='50,75,90,95,99'} > 10) >= 3
metrics:
{{- contains .snapshot.metrics }}
- name: service_percentile
results:
{{- contains .results }}
- metric:
labels:
- key: p
value: "50"
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: "{{ .value }}"
traceid: null
{{- end }}
{{- end }}
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
message: Response time of service e2e-service-provider is increase/decrease in 1 minutes of last 10 minutes.
tags:
- key: level
Expand All @@ -63,52 +85,22 @@ msgs:
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
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.
tags:
- key: level
value: WARNING
- key: receivers
value: lisi
events:
{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-service-provider
serviceinstance: ""
endpoint: ""
name: Alarm
type: ""
message: {{ notEmpty .message }}
parameters: []
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
message: Response time of service e2e-service-provider is increase/decrease in 1 minutes of last 10 minutes.
tags:
- key: level
value: WARNING
- key: receivers
value: lisi
events:
{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-service-provider
serviceinstance: ""
endpoint: ""
name: Alarm
type: ""
message: {{ notEmpty .message}}
parameters: []
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
layer: GENERAL
snapshot:
expression: sum(abs(increase(service_resp_time,1)) > 0) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ msgs:
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
message: Service e2e-service-provider response time is more than 10ms and sla is more than 1%.
tags:
- key: level
Expand All @@ -39,4 +40,22 @@ msgs:
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
snapshot:
expression: sum((service_resp_time > 10) * (service_sla > 100)) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}
40 changes: 40 additions & 0 deletions test/e2e-v2/cases/alarm/expected/silence-before-graphql-warn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ msgs:
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
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.
tags:
- key: level
Expand All @@ -39,9 +40,30 @@ msgs:
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
snapshot:
expression: sum(service_percentile{p='50,75,90,95,99'} > 10) >= 3
metrics:
{{- contains .snapshot.metrics }}
- name: service_percentile
results:
{{- contains .results }}
- metric:
labels:
- key: p
value: "50"
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: "{{ .value }}"
traceid: null
{{- end }}
{{- end }}
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
message: Response time of service e2e-service-provider is increase/decrease in 1 minutes of last 10 minutes.
tags:
- key: level
Expand All @@ -63,4 +85,22 @@ msgs:
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
snapshot:
expression: sum(abs(increase(service_resp_time,1)) > 0) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions test/e2e-v2/cases/alarm/expected/tag-keys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- contains . }}
- level
- receivers
{{- end }}
19 changes: 19 additions & 0 deletions test/e2e-v2/cases/alarm/expected/tag-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- contains . }}
- WARNING
- CRITICAL
{{- end }}
12 changes: 10 additions & 2 deletions test/e2e-v2/cases/mqe/expected/topN-OP-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ results:
labels: []
values:
- id: provider1
value: "100"
value: "{{ (index (index .results 0).values 0).value }}"
traceid: null
owner: null
owner:
scope: ServiceInstance
serviceid: {{ b64enc "e2e-service-provider"}}.1
servicename: e2e-service-provider
normal: true
serviceinstanceid: {{ b64enc "e2e-service-provider"}}.1_{{ b64enc "provider1"}}
serviceinstancename: provider1
endpointid: null
endpointname: null
error: null
20 changes: 18 additions & 2 deletions test/e2e-v2/cases/mqe/expected/topN-OP-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,25 @@ results:
- id: e2e-service-consumer
value: "{{ (index (index .results 0).values 0).value }}"
traceid: null
owner: null
owner:
scope: Service
serviceid: {{ b64enc "e2e-service-consumer"}}.1
servicename: e2e-service-consumer
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: null
endpointname: null
- id: e2e-service-provider
value: "{{ (index (index .results 0).values 1).value }}"
traceid: null
owner: null
owner:
scope: Service
serviceid: {{ b64enc "e2e-service-provider"}}.1
servicename: e2e-service-provider
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: null
endpointname: null
error: null
6 changes: 3 additions & 3 deletions test/e2e-v2/cases/mqe/mqe-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ cases:
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_resp_time,3,des)"
expected: expected/topN-OP-service.yml
# topN-OP-service Global with attrs
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des,attr0='GENERAL')/100"
- 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"
expected: expected/topN-OP-service.yml
- 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"
- 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"
expected: expected/topN-OP-service.yml

# topN-OP-isntance
- 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
- 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
expected: expected/topN-OP-instance.yml

# select labels and relabels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ cases:
swctl --display yaml --base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql metrics exec --expression=kubernetes_service_instance_http_call_cpm --service-name=reviews.default --instance-name=$instance_name
expected: expected/metrics-has-value.yml
- query: swctl --display yaml --base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql metrics exec --expression="top_n(kubernetes_service_instance_write_l4_time,10,des)" --service-name=details.default
expected: expected/metrics-sorted-has-value.yml
expected: expected/metrics-sorted-has-value-instance.yml

# service endpoint level metrics
- query: swctl --display yaml --base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql metrics exec --expression=kubernetes_service_endpoint_call_cpm --service-name=details.default --endpoint-name=GET:/details/0
expected: expected/metrics-has-value.yml
- query: swctl --display yaml --base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql metrics exec --expression=kubernetes_service_endpoint_http_call_cpm --service-name=details.default --endpoint-name=GET:/details/0
expected: expected/metrics-has-value.yml
- query: swctl --display yaml --base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql metrics exec --expression="top_n(kubernetes_service_endpoint_call_time,10,des)" --service-name=details.default
expected: expected/metrics-sorted-has-value.yml
expected: expected/metrics-sorted-has-value-endpoint.yml

# service relation metrics
- query: swctl --display yaml --base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql metrics exec --expression=kubernetes_service_relation_connect_cpm --service-name=productpage.default --dest-service-name=details.default
Expand Down
Loading

0 comments on commit 3f0d68a

Please sign in to comment.