This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a1454e922 storage e2e: make topn result more predictable (#12921)
1a1454e922 is described below

commit 1a1454e922abcd6ca620498644f712a28f235c58
Author: Wan Kai <[email protected]>
AuthorDate: Thu Jan 2 12:12:26 2025 +0800

    storage e2e: make topn result more predictable (#12921)
---
 .../oap/server/core/alarm/AlarmRecord.java         |  2 --
 test/e2e-v2/cases/storage/banyandb/e2e.yaml        |  2 +-
 test/e2e-v2/cases/storage/es/e2e.yaml              |  2 +-
 test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml  |  2 ++
 .../cases/storage/expected/topN-OP-endpoint.yml    | 28 ++++++++++++++--------
 .../cases/storage/expected/topN-OP-service.yml     | 24 ++++++++++++-------
 test/e2e-v2/cases/storage/opensearch/e2e.yaml      |  2 +-
 test/e2e-v2/cases/storage/storage-cases.yaml       | 12 +++++-----
 8 files changed, 45 insertions(+), 29 deletions(-)

diff --git 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java
 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java
index c15c3afb7e..302866f294 100644
--- 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java
+++ 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java
@@ -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";
diff --git a/test/e2e-v2/cases/storage/banyandb/e2e.yaml 
b/test/e2e-v2/cases/storage/banyandb/e2e.yaml
index 62aec344db..4e0ed14188 100644
--- a/test/e2e-v2/cases/storage/banyandb/e2e.yaml
+++ b/test/e2e-v2/cases/storage/banyandb/e2e.yaml
@@ -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
diff --git a/test/e2e-v2/cases/storage/es/e2e.yaml 
b/test/e2e-v2/cases/storage/es/e2e.yaml
index a238ae9722..1e8dd5ccac 100644
--- a/test/e2e-v2/cases/storage/es/e2e.yaml
+++ b/test/e2e-v2/cases/storage/es/e2e.yaml
@@ -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
diff --git a/test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml 
b/test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml
index 214270be44..13dbfb34e1 100644
--- a/test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml
+++ b/test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml
@@ -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
diff --git a/test/e2e-v2/cases/storage/expected/topN-OP-endpoint.yml 
b/test/e2e-v2/cases/storage/expected/topN-OP-endpoint.yml
index d42453ed2d..fc6fb3974f 100644
--- a/test/e2e-v2/cases/storage/expected/topN-OP-endpoint.yml
+++ b/test/e2e-v2/cases/storage/expected/topN-OP-endpoint.yml
@@ -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
diff --git a/test/e2e-v2/cases/storage/expected/topN-OP-service.yml 
b/test/e2e-v2/cases/storage/expected/topN-OP-service.yml
index b3a0ed1586..5f8e1e69c5 100644
--- a/test/e2e-v2/cases/storage/expected/topN-OP-service.yml
+++ b/test/e2e-v2/cases/storage/expected/topN-OP-service.yml
@@ -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
diff --git a/test/e2e-v2/cases/storage/opensearch/e2e.yaml 
b/test/e2e-v2/cases/storage/opensearch/e2e.yaml
index a238ae9722..1e8dd5ccac 100644
--- a/test/e2e-v2/cases/storage/opensearch/e2e.yaml
+++ b/test/e2e-v2/cases/storage/opensearch/e2e.yaml
@@ -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
diff --git a/test/e2e-v2/cases/storage/storage-cases.yaml 
b/test/e2e-v2/cases/storage/storage-cases.yaml
index 6ca86119cb..74fa7a8587 100644
--- a/test/e2e-v2/cases/storage/storage-cases.yaml
+++ b/test/e2e-v2/cases/storage/storage-cases.yaml
@@ -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

Reply via email to