From bce7fb8984e5a5449f89f451d76be2ef14f6174c Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Sep 2024 11:52:27 +0800 Subject: [PATCH] add e2e testcase, sync ui, add tips. --- .../so11y_java_agent/so11y-instance.json | 21 ++++-- skywalking-ui | 2 +- test/e2e-v2/cases/meter/docker-compose.yml | 2 +- .../metrics-has-value-label-created_by.yml | 35 +++++++++ .../metrics-has-value-label-percentile.yml | 72 +++++++++++++++++++ test/e2e-v2/cases/meter/expected/service.yml | 17 ++--- test/e2e-v2/cases/meter/meter-cases.yaml | 12 ++++ .../e2e/controller/UserController.java | 11 ++- test/e2e-v2/script/env | 2 +- 9 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 test/e2e-v2/cases/meter/expected/metrics-has-value-label-created_by.yml create mode 100644 test/e2e-v2/cases/meter/expected/metrics-has-value-label-percentile.yml diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-instance.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-instance.json index 7e5729b4cc9e..9f63f12b7660 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-instance.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-instance.json @@ -11,7 +11,8 @@ "i": "14", "type": "Widget", "widget": { - "title": "Tracing Context Creation (Per Minute)" + "title": "Tracing Context Creation (Per Minute)", + "tips": "The number of created tracing contexts per minute, including a label created_by(value=sampler,propagated)." }, "graph": { "type": "Line", @@ -33,7 +34,8 @@ "i": "6", "type": "Widget", "widget": { - "title": "Tracing Context Creation and Completion (Per Minute)" + "title": "Tracing Context Creation and Completion (Per Minute)", + "tips": "The number of created tracing contexts and finished tracing contexts per minute." }, "graph": { "type": "Line", @@ -64,7 +66,8 @@ "i": "1", "type": "Widget", "widget": { - "title": "Ignored Context Creation (Per Minute)" + "title": "Ignored Context Creation (Per Minute)", + "tips": "The number of created ignored contexts per minute, including a label created_by(value=sampler,propagated)." }, "graph": { "type": "Line", @@ -86,7 +89,8 @@ "i": "2", "type": "Widget", "widget": { - "title": "Ignored Context Creation and Completion (Per Minute)" + "title": "Ignored Context Creation and Completion (Per Minute)", + "tips": "The number of created ignored contexts and finished ignored contexts per minute." }, "graph": { "type": "Line", @@ -117,7 +121,8 @@ "i": "11", "type": "Widget", "widget": { - "title": "Possible Leaked Context (Per Minute)" + "title": "Possible Leaked Context (Per Minute)", + "tips": "The number of detected leaked contexts per minute, including a label source(value=tracing, ignore)." }, "graph": { "type": "Line", @@ -144,7 +149,8 @@ "i": "8", "type": "Widget", "widget": { - "title": "Interceptor Error Count (Per Minute)" + "title": "Interceptor Error Count (Per Minute)", + "tips": "The number of errors happened in the interceptor logic per minute, including the label plugin_name and inter_type(constructor, inst, static)." }, "graph": { "type": "Line", @@ -179,7 +185,8 @@ "showYAxis": true }, "widget": { - "title": "Tracing Context Execution time (ms)" + "title": "Tracing Context Execution time (ms)", + "tips": "For successfully finished tracing context, it measures every interceptor's time cost." }, "expressions": [ "relabels(meter_java_agent_tracing_context_execution_time_percentile,p='50,75,90,95,99',p='50,75,90,95,99')/1000000" diff --git a/skywalking-ui b/skywalking-ui index ed0ec0ac1fec..e251626374e3 160000 --- a/skywalking-ui +++ b/skywalking-ui @@ -1 +1 @@ -Subproject commit ed0ec0ac1fec730f382915bf55a87e14b4c9f4e3 +Subproject commit e251626374e31eb26d314d32caf74bf1ed6cb19b diff --git a/test/e2e-v2/cases/meter/docker-compose.yml b/test/e2e-v2/cases/meter/docker-compose.yml index c2f919abdc26..c21f31f60e95 100644 --- a/test/e2e-v2/cases/meter/docker-compose.yml +++ b/test/e2e-v2/cases/meter/docker-compose.yml @@ -18,7 +18,7 @@ version: '2.1' services: oap: environment: - SW_METER_ANALYZER_ACTIVE_FILES: spring-micrometer,batch-meter + SW_METER_ANALYZER_ACTIVE_FILES: spring-micrometer,batch-meter,java-agent #virtual cache test case SW_SLOW_CACHE_SLOW_WRITE_THRESHOLD: default:-1 SW_SLOW_CACHE_SLOW_READ_THRESHOLD: default:-1 diff --git a/test/e2e-v2/cases/meter/expected/metrics-has-value-label-created_by.yml b/test/e2e-v2/cases/meter/expected/metrics-has-value-label-created_by.yml new file mode 100644 index 000000000000..7df745c2a446 --- /dev/null +++ b/test/e2e-v2/cases/meter/expected/metrics-has-value-label-created_by.yml @@ -0,0 +1,35 @@ +# 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. + +type: TIME_SERIES_VALUES +results: + {{- contains .results }} + - metric: + labels: + {{- contains .metric.labels }} + - key: created_by + value: {{ .value }} + {{- end}} + values: + {{- contains .values }} + - id: {{ notEmpty .id }} + value: {{ .value }} + traceid: null + - id: {{ notEmpty .id }} + value: null + traceid: null + {{- end}} + {{- end}} +error: null diff --git a/test/e2e-v2/cases/meter/expected/metrics-has-value-label-percentile.yml b/test/e2e-v2/cases/meter/expected/metrics-has-value-label-percentile.yml new file mode 100644 index 000000000000..70aa421de622 --- /dev/null +++ b/test/e2e-v2/cases/meter/expected/metrics-has-value-label-percentile.yml @@ -0,0 +1,72 @@ +# 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. + +type: TIME_SERIES_VALUES +results: + {{- contains .results }} +- metric: + labels: + - key: p + value: "50" + values: + {{- contains .values }} + - id: {{ notEmpty .id }} + value: {{ .value }} + traceid: null + - id: {{ notEmpty .id }} + value: null + traceid: null + {{- end}} +- metric: + labels: + - key: p + value: "70" + values: + {{- contains .values }} + - id: {{ notEmpty .id }} + value: {{ .value }} + traceid: null + - id: {{ notEmpty .id }} + value: null + traceid: null + {{- end}} +- metric: + labels: + - key: p + value: "90" + values: + {{- contains .values }} + - id: {{ notEmpty .id }} + value: {{ .value }} + traceid: null + - id: {{ notEmpty .id }} + value: null + traceid: null + {{- end}} +- metric: + labels: + - key: p + value: "99" + values: + {{- contains .values }} + - id: {{ notEmpty .id }} + value: {{ .value }} + traceid: null + - id: {{ notEmpty .id }} + value: null + traceid: null + {{- end}} + {{- end}} +error: null diff --git a/test/e2e-v2/cases/meter/expected/service.yml b/test/e2e-v2/cases/meter/expected/service.yml index c8338ac78d25..7ae27c824437 100644 --- a/test/e2e-v2/cases/meter/expected/service.yml +++ b/test/e2e-v2/cases/meter/expected/service.yml @@ -14,14 +14,6 @@ # limitations under the License. {{- contains . }} -- id: {{ b64enc "e2e-service-provider" }}.1 - name: e2e-service-provider - group: "" - shortname: e2e-service-provider - normal: true - layers: - - GENERAL - - id: {{ b64enc "localhost:-1" }}.0 name: localhost:-1 group: "" @@ -30,6 +22,15 @@ layers: - VIRTUAL_DATABASE +- id: {{ b64enc "e2e-service-provider" }}.1 + name: e2e-service-provider + group: "" + shortname: e2e-service-provider + normal: true + layers: + - SO11Y_JAVA_AGENT + - GENERAL + - id: {{ b64enc "GuavaCache-local" }}.0 name: GuavaCache-local group: "" diff --git a/test/e2e-v2/cases/meter/meter-cases.yaml b/test/e2e-v2/cases/meter/meter-cases.yaml index c5c5bfbe47d5..d024f391e51f 100644 --- a/test/e2e-v2/cases/meter/meter-cases.yaml +++ b/test/e2e-v2/cases/meter/meter-cases.yaml @@ -49,3 +49,15 @@ - query: | swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=database_access_resp_time --service-id=bG9jYWxob3N0Oi0x.0 expected: expected/metrics-has-value.yml + # agent so11y + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_java_agent_created_tracing_context_count --instance-name=provider1 --service-name=e2e-service-provider + expected: expected/metrics-has-value-label-created_by.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_java_agent_finished_tracing_context_count --instance-name=provider1 --service-name=e2e-service-provider + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_java_agent_created_ignored_context_count --instance-name=provider1 --service-name=e2e-service-provider + expected: expected/metrics-has-value-label-created_by.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_java_agent_finished_ignored_context_count --instance-name=provider1 --service-name=e2e-service-provider + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_java_agent_tracing_context_execution_time_percentile --instance-name=provider1 --service-name=e2e-service-provider + expected: expected/metrics-has-value-label-percentile.yml + diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java index 55d4cf4e5962..95c2de6db5e2 100644 --- a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java @@ -20,11 +20,14 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import java.io.IOException; +import java.net.URL; import lombok.RequiredArgsConstructor; import org.apache.skywalking.apm.toolkit.trace.TraceContext; import org.apache.skywalking.e2e.User; import org.apache.skywalking.e2e.UserRepo; import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -59,13 +62,19 @@ public String info() throws InterruptedException { } @PostMapping("/users") - public User createAuthor(@RequestBody final User user) throws InterruptedException { + public User createAuthor(@RequestBody final User user) throws InterruptedException, IOException { Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + new URL("http://localhost:9090/agent-so11y-scenario/case/ignore.html").getContent(); //virtual cache test case testCacheService(); return userRepo.save(user); } + @GetMapping("/ignore.html") + public String ignore() { + return "success"; + } + @PostMapping("/correlation") public String correlation() throws InterruptedException { Thread.sleep(randomSleepLong(sleepMin, sleepMax)); diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env index 8631e0da5f50..a91bbc42221e 100644 --- a/test/e2e-v2/script/env +++ b/test/e2e-v2/script/env @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -SW_AGENT_JAVA_COMMIT=c82287e1dd1593cf3e7dbc390b92f9224943252a +SW_AGENT_JAVA_COMMIT=75364241659c28e64557a3edffd53b9a8ae46188 SW_AGENT_SATELLITE_COMMIT=ea27a3f4e126a24775fe12e2aa2695bcb23d99c3 SW_AGENT_NGINX_LUA_COMMIT=c3cee4841798a147d83b96a10914d4ac0e11d0aa SW_AGENT_NODEJS_COMMIT=4f9a91dad3dfd8cfe5ba8f7bd06b39e11eb5e65e