storage e2e: make topn result more predictable (#12921)

This commit is contained in:
Wan Kai 2025-01-02 12:12:26 +08:00 committed by GitHub
parent 3f0d68ae61
commit 1a1454e922
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 45 additions and 29 deletions

View File

@ -18,7 +18,6 @@
package org.apache.skywalking.oap.server.core.alarm;
import com.google.gson.Gson;
import lombok.Getter;
import lombok.Setter;
import org.apache.skywalking.oap.server.core.analysis.Stream;
@ -46,7 +45,6 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.AL
@SQLDatabase.ExtraColumn4AdditionalEntity(additionalTable = AlarmRecord.ADDITIONAL_TAG_TABLE, parentColumn = TIME_BUCKET)
@BanyanDB.TimestampColumn(AlarmRecord.START_TIME)
public class AlarmRecord extends Record {
private static final Gson GSON = new Gson();
public static final String INDEX_NAME = "alarm_record";
public static final String ADDITIONAL_TAG_TABLE = "alarm_record_tag";
public static final String SCOPE = "scope";

View File

@ -48,5 +48,5 @@ verify:
cases:
- includes:
- ../storage-cases.yaml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des,attr0='GENERAL',attr1!='Not_exist')/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',attr1!='Not_exist')/100"
expected: ../expected/topN-OP-service.yml

View File

@ -48,5 +48,5 @@ verify:
cases:
- includes:
- ../storage-cases.yaml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des,attr0='GENERAL',attr1!='Not_exist')/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',attr1!='Not_exist')/100"
expected: ../expected/topN-OP-service.yml

View File

@ -48,3 +48,5 @@ verify:
cases:
- includes:
- ../../storage-cases.yaml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_resp_time,3,des,attr0='GENERAL',attr1!='Not_exist')/100"
expected: ../../expected/topN-OP-service.yml

View File

@ -16,23 +16,31 @@
debuggingtrace: null
type: SORTED_LIST
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: "100"
- id: "e2e-service-consumer - POST:/users"
value: "{{ (index (index .results 0).values 0).value }}"
traceid: null
owner:
scope: Endpoint
serviceid: {{ notEmpty .owner.serviceid }}
servicename: {{ notEmpty .owner.servicename }}
serviceid: {{ b64enc "e2e-service-consumer"}}.1
servicename: e2e-service-consumer
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: {{ notEmpty .owner.endpointid }}
endpointname: {{ notEmpty .owner.endpointname }}
{{- end }}
{{- end }}
endpointid: {{ b64enc "e2e-service-consumer" }}.1_{{ b64enc "POST:/users" }}
endpointname: POST:/users
- id: "e2e-service-provider - POST:/users"
value: "{{ (index (index .results 0).values 1).value }}"
traceid: null
owner:
scope: Endpoint
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "POST:/users" }}
endpointname: POST:/users
error: null

View File

@ -16,23 +16,31 @@
debuggingtrace: null
type: SORTED_LIST
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: "100"
- id: e2e-service-consumer
value: "{{ (index (index .results 0).values 0).value }}"
traceid: null
owner:
scope: Service
serviceid: {{ notEmpty .owner.serviceid }}
servicename: {{ notEmpty .owner.servicename }}
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:
scope: Service
serviceid: {{ b64enc "e2e-service-provider"}}.1
servicename: e2e-service-provider
normal: true
serviceinstanceid: null
serviceinstancename: null
endpointid: null
endpointname: null
{{- end }}
{{- end }}
error: null

View File

@ -48,5 +48,5 @@ verify:
cases:
- includes:
- ../storage-cases.yaml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des,attr0='GENERAL',attr1!='Not_exist')/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',attr1!='Not_exist')/100"
expected: ../expected/topN-OP-service.yml

View File

@ -161,18 +161,18 @@ cases:
)
expected: expected/trace-users-detail.yml
# topN-OP-service Global
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(service_sla,3,des)/100"
- 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')"
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')"
expected: expected/topN-OP-service.yml
# topN-OP-endpoint Global
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(endpoint_sla,3,des)/100"
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(endpoint_resp_time,3,des)"
expected: expected/topN-OP-endpoint.yml
# topN-OP-endpoint Global with attrs
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(endpoint_sla,3,des,attr0='GENERAL')/100"
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(endpoint_resp_time,3,des,attr0='GENERAL')"
expected: expected/topN-OP-endpoint.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(endpoint_sla,3,des,attr0!='Not_GENERAL')/100"
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="top_n(endpoint_resp_time,3,des,attr0!='Not_GENERAL')"
expected: expected/topN-OP-endpoint.yml