Adapt Alarm and MQE CLI query in the E2E (#12918)

This commit is contained in:
mrproliu 2025-01-01 21:07:42 +08:00 committed by GitHub
parent 6fbd9e7400
commit 3f0d68ae61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 270 additions and 95 deletions

View File

@ -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

View File

@ -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
@ -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 }}

View File

@ -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
@ -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
@ -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
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 }}
- 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
{{- end }}
{{- end }}
{{- end }}

View File

@ -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
@ -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 }}

View File

@ -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
@ -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
@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -89,7 +89,7 @@ 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
@ -97,7 +97,7 @@ cases:
- 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

View File

@ -23,8 +23,16 @@ results:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: {{ .value }}
owner: null
traceid: null
owner:
scope: {{ .owner.scope }}
serviceid: {{ .owner.serviceid }}
servicename: {{ .owner.servicename }}
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: {{ .owner.endpointid }}
endpointname: {{ .owner.endpointname }}
{{- end}}
{{- end}}
error: null

View File

@ -0,0 +1,38 @@
# 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.
debuggingtrace: null
type: SORTED_LIST
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: {{ .value }}
traceid: null
owner:
scope: {{ .owner.scope }}
serviceid: {{ .owner.serviceid }}
servicename: {{ .owner.servicename }}
normal: true
serviceinstanceid: {{ .owner.serviceinstanceid }}
serviceinstancename: {{ .owner.serviceinstancename }}
endpointid: null
endpointname: null
{{- end}}
{{- end}}
error: null

View File

@ -23,12 +23,16 @@ results:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: "100"
owner: null
traceid: null
- id: {{ notEmpty .id }}
value: "100"
owner: null
traceid: null
owner:
scope: Endpoint
serviceid: {{ notEmpty .owner.serviceid }}
servicename: {{ notEmpty .owner.servicename }}
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: {{ notEmpty .owner.endpointid }}
endpointname: {{ notEmpty .owner.endpointname }}
{{- end }}
{{- end }}
error: null

View File

@ -22,13 +22,17 @@ results:
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: "100"
traceid: null
- id: {{ notEmpty .id }}
owner: null
value: "100"
traceid: null
owner:
scope: Service
serviceid: {{ notEmpty .owner.serviceid }}
servicename: {{ notEmpty .owner.servicename }}
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: null
endpointname: null
{{- end }}
{{- end }}
error: null

View File

@ -19,12 +19,20 @@ results:
{{- contains .results }}
- metric:
labels: []
{{- contains .values }}
values:
{{- contains .values }}
- id: vm-service
value: {{ .value }}
value: "{{ .value }}"
traceid: null
owner: null
owner:
scope: Service
serviceid: {{ b64enc "vm-service" }}.1
servicename: vm-service
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: null
endpointname: null
{{- end }}
{{- end }}
error: null

View File

@ -26,4 +26,4 @@ SW_ROVER_COMMIT=0ae8f12d6eb6cc9fa125c603ee57d0b21fc8c6d0
SW_BANYANDB_COMMIT=7f291fc5c626ea8b0d33c947563f7984cfc4886e
SW_AGENT_PHP_COMMIT=3192c553002707d344bd6774cfab5bc61f67a1d3
SW_CTL_COMMIT=6210a3b79089535af782ca51359ce6c5b68890b2
SW_CTL_COMMIT=67cbc89dd7b214d5791321a7ca992f940cb586ba