From f2f22e531fc64e8e4faa58649de787ddaeb63ad0 Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 14 Sep 2024 23:27:29 +0800 Subject: [PATCH 1/6] Add SkyWalking Java Agent self observability dashboard. --- docs/en/changes/changes.md | 1 + .../backend/dashboards-so11y-java-agent.md | 32 +++ docs/menu.yml | 2 + .../oap/server/core/analysis/Layer.java | 8 +- .../ui/template/UITemplateInitializer.java | 1 + .../src/main/resources/application.yml | 2 +- .../meter-analyzer-config/java-agent.yaml | 32 +++ .../ui-initialized-templates/menu.yaml | 5 + .../so11y_java_agent/so11y-instance.json | 195 ++++++++++++++++++ .../so11y_java_agent/so11y-service.json | 62 ++++++ 10 files changed, 338 insertions(+), 2 deletions(-) create mode 100644 docs/en/setup/backend/dashboards-so11y-java-agent.md create mode 100644 oap-server/server-starter/src/main/resources/meter-analyzer-config/java-agent.yaml create mode 100644 oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-instance.json create mode 100644 oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-service.json diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 0e5e806f816a..33626b5389c3 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -66,6 +66,7 @@ * Fix `findEndpoint` query require `keyword` when using BanyanDB. * Support to analysis the ztunnel mapped IP address in eBPF Access Log Receiver. * Adapt BanyanDB Java Client 0.7.0-rc3. +* Add SkyWalking Java Agent self observability dashboard. #### UI diff --git a/docs/en/setup/backend/dashboards-so11y-java-agent.md b/docs/en/setup/backend/dashboards-so11y-java-agent.md new file mode 100644 index 000000000000..1fe9c3888759 --- /dev/null +++ b/docs/en/setup/backend/dashboards-so11y-java-agent.md @@ -0,0 +1,32 @@ +# Java Agent self observability dashboard + +SkyWalking java agent reports itself metrics by Meter APIS in order to measure tracing performance. +it also provides a dashboard to visualize the agent metrics. + +## Data flow +1. SkyWalking java agent reports metrics data internally and automatically. +2. SkyWalking OAP accept these meters through native protocols. +3. The SkyWalking OAP Server parses the expression with [MAL](../../concepts-and-designs/mal.md) to filter/calculate/aggregate and store the results. + +## Set up +Java Agent so11y is a build-in feature, it reports meters automatically after boot. + +## Self observability monitoring +Self observability monitoring provides monitoring of the runtime performance of the java agent itself. `agent.service_name` is a `Service` in Agent so11y, and land on the `Layer: SO11Y_JAVA_AGENT`. + +### Self observability metrics + +| Unit | Metric Name | Description | Data Source | +|-------------------|----------------------------------------------------------------|---------------------------------------------|-----------------------| +| Count Per Minute | meter_java_agent_created_tracing_context_count | Created Tracing Context Count (Per Minute) | SkyWalking Java Agent | +| Count Per Minute | meter_java_agent_finished_tracing_context_count | Finished Tracing Context Count (Per Minute) | SkyWalking Java Agent | +| Count Per Minute | meter_java_agent_created_ignored_context_count | Created Ignored Context Count (Per Minute) | SkyWalking Java Agent | +| Count Per Minute | meter_java_agent_finished_ignored_context_count | Finished Ignored Context Count (Per Minute) | SkyWalking Java Agent | +| Count Per Minute | meter_java_agent_possible_leaked_context_count | Possible Leak Context Count (Per Minute) | SkyWalking Java Agent | +| Count Per Minute | meter_java_agent_interceptor_error_count | Interceptor Error Count (Per Minute) | SkyWalking Java Agent | +| ms | meter_java_agent_tracing_context_execution_time_percentile | Tracing Context Execution Time (ms) | SkyWalking Java Agent | + +## Customizations +You can customize your own metrics/expression/dashboard panel. +The metrics definition and expression rules are found in `/meter-analyzer-config/java-agent.yaml` +The self observability dashboard panel configurations are found in `/config/ui-initialized-templates/so11y_java_agent`. diff --git a/docs/menu.yml b/docs/menu.yml index 50e0a2927790..88be59dac004 100644 --- a/docs/menu.yml +++ b/docs/menu.yml @@ -146,6 +146,8 @@ catalog: path: "/en/setup/backend/dashboards-so11y" - name: "Satellite self telemetry" path: "/en/setup/backend/dashboards-so11y-satellite" + - name: "SkyWalking Java Agent self telemetry" + path: "/en/setup/backend/dashboards-so11y-java-agent" - name: "Configuration Vocabulary" path: "/en/setup/backend/configuration-vocabulary" - name: "Advanced Setup" diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java index 0f9b6b8f80ec..0eb61a9bc64a 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java @@ -234,7 +234,13 @@ public enum Layer { * Cilium is open source software for providing and transparently securing network connectivity and load balancing * between application workloads such as application containers or processes. */ - CILIUM_SERVICE(38, true); + CILIUM_SERVICE(38, true), + + /** + * The self observability of SkyWalking Java Agent, + * which provides the abilities to measure the tracing performance and error statistics of plugins. + */ + SO11Y_JAVA_AGENT(39, true); private final int value; /** diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java index 7c11cee66a6b..58dcbd8328f4 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java @@ -76,6 +76,7 @@ public class UITemplateInitializer { Layer.CLICKHOUSE.name(), Layer.ACTIVEMQ.name(), Layer.CILIUM_SERVICE.name(), + Layer.SO11Y_JAVA_AGENT.name(), "custom" }; private final UITemplateManagementService uiTemplateManagementService; diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml index 44c825a3bd42..33c1607038ed 100644 --- a/oap-server/server-starter/src/main/resources/application.yml +++ b/oap-server/server-starter/src/main/resources/application.yml @@ -269,7 +269,7 @@ agent-analyzer: # Nginx and Envoy agents can't get the real remote address. # Exit spans with the component in the list would not generate the client-side instance relation metrics. noUpstreamRealAddressAgents: ${SW_NO_UPSTREAM_REAL_ADDRESS:6000,9000} - meterAnalyzerActiveFiles: ${SW_METER_ANALYZER_ACTIVE_FILES:datasource,threadpool,satellite,go-runtime,python-runtime,continuous-profiling} # Which files could be meter analyzed, files split by "," + meterAnalyzerActiveFiles: ${SW_METER_ANALYZER_ACTIVE_FILES:datasource,threadpool,satellite,go-runtime,python-runtime,continuous-profiling,java-agent} # Which files could be meter analyzed, files split by "," slowCacheReadThreshold: ${SW_SLOW_CACHE_SLOW_READ_THRESHOLD:default:20,redis:10} # The slow cache read operation thresholds. Unit ms. slowCacheWriteThreshold: ${SW_SLOW_CACHE_SLOW_WRITE_THRESHOLD:default:20,redis:10} # The slow cache write operation thresholds. Unit ms. diff --git a/oap-server/server-starter/src/main/resources/meter-analyzer-config/java-agent.yaml b/oap-server/server-starter/src/main/resources/meter-analyzer-config/java-agent.yaml new file mode 100644 index 000000000000..4086f66e3e72 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/meter-analyzer-config/java-agent.yaml @@ -0,0 +1,32 @@ +# 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. + +expSuffix: instance(['service'], ['instance'], Layer.SO11Y_JAVA_AGENT) +metricPrefix: meter_java_agent +metricsRules: + - name: created_tracing_context_count + exp: created_tracing_context_counter.sum(['created_by', 'service', 'instance']).increase('PT1M') + - name: finished_tracing_context_count + exp: finished_tracing_context_counter.sum(['service', 'instance']).increase('PT1M') + - name: created_ignored_context_count + exp: created_ignored_context_counter.sum(['created_by', 'service', 'instance']).increase('PT1M') + - name: finished_ignored_context_count + exp: finished_ignored_context_counter.sum(['service', 'instance']).increase('PT1M') + - name: possible_leaked_context_count + exp: possible_leaked_context_counter.sum(['source', 'service', 'instance']).increase('PT1M') + - name: interceptor_error_count + exp: interceptor_error_counter.sum(['plugin_name', 'inter_type', 'service', 'instance']).increase('PT1M') + - name: tracing_context_execution_time_percentile + exp: tracing_context_performance.sum(['le', 'service', 'instance']).histogram().histogram_percentile([50,70,90,99]) diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml b/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml index 6d0696d28387..7dcf95350b99 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml @@ -247,3 +247,8 @@ menus: description: "Satellite: an open-source agent designed for the cloud-native infrastructures, which provides a low-cost, high-efficient, and more secure way to collect telemetry data. It is the recommended load balancer for telemetry collecting." documentLink: https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-load-balancer/ i18nKey: self_observability_satellite + - title: SkyWalking Java Agent + layer: SO11Y_JAVA_AGENT + description: The Java Agent for Apache SkyWalking, which provides the native tracing/metrics/logging/event/profiling abilities for Java projects. + documentLink: https://skywalking.apache.org/docs/main/next/en/setup/backend/dashboards-so11y-java-agent/ + i18nKey: self_observability_java_agent 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 new file mode 100644 index 000000000000..6825961f56ce --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-instance.json @@ -0,0 +1,195 @@ +[ + { + "id": "Self-Observability-Java-Agent-Instance", + "configuration": { + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "14", + "type": "Widget", + "widget": { + "title": "Tracing Context Creation (Per Minute)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "expressions": [ + "meter_java_agent_created_tracing_context_count" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "6", + "type": "Widget", + "widget": { + "title": "Tracing Context Creation and Completion (Per Minute)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "metricConfig": [ + { + "label": "Creation" + }, + { + "label": "Completion" + } + ], + "expressions": [ + "aggregate_labels(meter_java_agent_created_tracing_context_count,sum)", + "meter_java_agent_finished_tracing_context_count" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "1", + "type": "Widget", + "widget": { + "title": "Ignored Context Creation (Per Minute)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "expressions": [ + "meter_java_agent_created_ignored_context_count" + ] + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "2", + "type": "Widget", + "widget": { + "title": "Ignored Context Creation and Completion (Per Minute)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "expressions": [ + "aggregate_labels(meter_java_agent_created_ignored_context_count,sum)", + "meter_java_agent_finished_ignored_context_count" + ], + "metricConfig": [ + { + "label": "Creation" + }, + { + "label": "Completion" + } + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "11", + "type": "Widget", + "widget": { + "title": "Possible Leaked Context (Per Minute)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "expressions": [ + "meter_java_agent_possible_leaked_context_count" + ], + "metricConfig": [ + { + "label": "count" + } + ] + }, + { + "x": 12, + "y": 13, + "w": 12, + "h": 13, + "i": "8", + "type": "Widget", + "widget": { + "title": "Interceptor Error Count (Per Minute)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "expressions": [ + "meter_java_agent_interceptor_error_count" + ], + "metricConfig": [ + { + "label": "count" + } + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "15", + "type": "Widget", + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": true, + "showXAxis": true, + "showYAxis": true + }, + "widget": { + "title": "Tracing Context Execution time (ms)" + }, + "expressions": [ + "relabels(meter_java_agent_tracing_context_execution_time_percentile,p='50,75,90,95,99',p='50,75,90,95,99')" + ] + } + ], + "layer": "SO11Y_JAVA_AGENT", + "entity": "ServiceInstance", + "name": "Self-Observability-Java-Agent-Instance", + "isRoot": false + } + } +] \ No newline at end of file diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-service.json new file mode 100644 index 000000000000..9967dcef929c --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/so11y_java_agent/so11y-service.json @@ -0,0 +1,62 @@ +[ + { + "id": "Self-Observability-Java-Agent-Service", + "configuration": { + "children": [ + { + "x": 0, + "y": 2, + "w": 24, + "h": 38, + "i": "0", + "type": "Widget", + "graph": { + "type": "InstanceList", + "dashboardName": "Self-Observability-Java-Agent-Instance", + "fontSize": 12 + }, + "metricConfig": [ + { + "label": "Context Creation", + "detailLabel": "context_creation", + "unit": "Per Minute" + }, + { + "label": "Context Completion", + "unit": "Per Minute", + "detailLabel": "context_completion" + } + ], + "expressions": [ + "avg(aggregate_labels(meter_java_agent_created_tracing_context_count,sum)+aggregate_labels(meter_java_agent_created_ignored_context_count,sum))", + "avg(meter_java_agent_finished_tracing_context_count+meter_java_agent_finished_ignored_context_count)" + ], + "subExpressions": [ + "aggregate_labels(meter_java_agent_created_tracing_context_count,sum)+aggregate_labels(meter_java_agent_created_ignored_context_count,sum)", + "meter_java_agent_finished_tracing_context_count+meter_java_agent_finished_ignored_context_count" + ] + }, + { + "x": 0, + "y": 0, + "w": 24, + "h": 2, + "i": "100", + "type": "Text", + "graph": { + "fontColor": "theme", + "backgroundColor": "theme", + "content": "The self observability of SkyWalking Java Agent, which provides the abilities to measure the tracing performance and error statistics of plugins.", + "fontSize": 14, + "textAlign": "left", + "url": "https://skywalking.apache.org/docs/main/next/en/setup/backend/dashboards-so11y-java-agent/" + } + } + ], + "layer": "SO11Y_JAVA_AGENT", + "entity": "Service", + "name": "Self-Observability-Java-Agent-Service", + "isRoot": true + } + } +] \ No newline at end of file From 1a219fcbacee1fc9c754851951e5595338469d9c Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 15 Sep 2024 17:14:38 +0800 Subject: [PATCH 2/6] update metric: meter_java_agent_tracing_context_execution_time_percentile. --- docs/en/setup/backend/dashboards-so11y-java-agent.md | 2 +- .../so11y_java_agent/so11y-instance.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/setup/backend/dashboards-so11y-java-agent.md b/docs/en/setup/backend/dashboards-so11y-java-agent.md index 1fe9c3888759..45a584a86dda 100644 --- a/docs/en/setup/backend/dashboards-so11y-java-agent.md +++ b/docs/en/setup/backend/dashboards-so11y-java-agent.md @@ -24,7 +24,7 @@ Self observability monitoring provides monitoring of the runtime performance of | Count Per Minute | meter_java_agent_finished_ignored_context_count | Finished Ignored Context Count (Per Minute) | SkyWalking Java Agent | | Count Per Minute | meter_java_agent_possible_leaked_context_count | Possible Leak Context Count (Per Minute) | SkyWalking Java Agent | | Count Per Minute | meter_java_agent_interceptor_error_count | Interceptor Error Count (Per Minute) | SkyWalking Java Agent | -| ms | meter_java_agent_tracing_context_execution_time_percentile | Tracing Context Execution Time (ms) | SkyWalking Java Agent | +| ns | meter_java_agent_tracing_context_execution_time_percentile | Tracing Context Execution Time (ns) | SkyWalking Java Agent | ## Customizations You can customize your own metrics/expression/dashboard panel. 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 6825961f56ce..7e5729b4cc9e 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 @@ -182,7 +182,7 @@ "title": "Tracing Context Execution time (ms)" }, "expressions": [ - "relabels(meter_java_agent_tracing_context_execution_time_percentile,p='50,75,90,95,99',p='50,75,90,95,99')" + "relabels(meter_java_agent_tracing_context_execution_time_percentile,p='50,75,90,95,99',p='50,75,90,95,99')/1000000" ] } ], From bce7fb8984e5a5449f89f451d76be2ef14f6174c Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Sep 2024 11:52:27 +0800 Subject: [PATCH 3/6] 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 From 22de0d6cd8ebef2c4dccca4a680d918dbfd07f81 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Sep 2024 14:05:47 +0800 Subject: [PATCH 4/6] update e2e testcase. --- test/e2e-v2/cases/meter/docker-compose.yml | 1 + test/e2e-v2/script/docker-compose/base-compose.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/e2e-v2/cases/meter/docker-compose.yml b/test/e2e-v2/cases/meter/docker-compose.yml index c21f31f60e95..fe09ee79adc6 100644 --- a/test/e2e-v2/cases/meter/docker-compose.yml +++ b/test/e2e-v2/cases/meter/docker-compose.yml @@ -37,6 +37,7 @@ services: service: provider environment: SW_METER_REPORT_INTERVAL: 5 + SW_METER_ACTIVE: 'true' # Activate guava-cache plugin for virtual cache test case command: ["bash" , "-c" , "cp /skywalking/agent/optional-plugins/apm-guava-cache-plugin*.jar /skywalking/agent/plugins/ && java -jar /services_provider.jar"] depends_on: diff --git a/test/e2e-v2/script/docker-compose/base-compose.yml b/test/e2e-v2/script/docker-compose/base-compose.yml index 6ffc9c02375a..8648cc014113 100644 --- a/test/e2e-v2/script/docker-compose/base-compose.yml +++ b/test/e2e-v2/script/docker-compose/base-compose.yml @@ -82,6 +82,7 @@ services: SW_AGENT_INSTANCE_NAME: provider1 SW_AGENT_COLLECTOR_GET_PROFILE_TASK_INTERVAL: 1 SW_AGENT_COLLECTOR_GET_AGENT_DYNAMIC_CONFIG_INTERVAL: 1 + SW_METER_ACTIVE: 'false' healthcheck: test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9090"] interval: 5s @@ -106,6 +107,7 @@ services: SW_AGENT_INSTANCE_NAME: consumer1 SW_AGENT_COLLECTOR_GET_PROFILE_TASK_INTERVAL: 1 SW_AGENT_COLLECTOR_GET_AGENT_DYNAMIC_CONFIG_INTERVAL: 1 + SW_METER_ACTIVE: 'false' healthcheck: test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9092"] interval: 5s From 8ed0aa64f698886bef334a2e5e39a47413a7de4e Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Sep 2024 15:15:21 +0800 Subject: [PATCH 5/6] update cases and dashboard tips. --- .../so11y_java_agent/so11y-instance.json | 12 ++++++------ .../skywalking/e2e/controller/UserController.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) 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 9f63f12b7660..4b87cbbb5dc5 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 @@ -12,7 +12,7 @@ "type": "Widget", "widget": { "title": "Tracing Context Creation (Per Minute)", - "tips": "The number of created tracing contexts per minute, including a label created_by(value=sampler,propagated)." + "tips": "The number of created tracing contexts, including a label created_by(value=sampler,propagated)." }, "graph": { "type": "Line", @@ -35,7 +35,7 @@ "type": "Widget", "widget": { "title": "Tracing Context Creation and Completion (Per Minute)", - "tips": "The number of created tracing contexts and finished tracing contexts per minute." + "tips": "The number of created tracing contexts and finished tracing contexts." }, "graph": { "type": "Line", @@ -67,7 +67,7 @@ "type": "Widget", "widget": { "title": "Ignored Context Creation (Per Minute)", - "tips": "The number of created ignored contexts per minute, including a label created_by(value=sampler,propagated)." + "tips": "The number of created ignored contexts, including a label created_by(value=sampler,propagated)." }, "graph": { "type": "Line", @@ -90,7 +90,7 @@ "type": "Widget", "widget": { "title": "Ignored Context Creation and Completion (Per Minute)", - "tips": "The number of created ignored contexts and finished ignored contexts per minute." + "tips": "The number of created ignored contexts and finished ignored contexts." }, "graph": { "type": "Line", @@ -122,7 +122,7 @@ "type": "Widget", "widget": { "title": "Possible Leaked Context (Per Minute)", - "tips": "The number of detected leaked contexts per minute, including a label source(value=tracing, ignore)." + "tips": "The number of detected leaked contexts, including a label source(value=tracing, ignore)." }, "graph": { "type": "Line", @@ -150,7 +150,7 @@ "type": "Widget", "widget": { "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)." + "tips": "The number of errors happened in the interceptor logic, including the label plugin_name and inter_type(constructor, inst, static)." }, "graph": { "type": "Line", 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 95c2de6db5e2..497b00677661 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 @@ -64,7 +64,7 @@ public String info() throws InterruptedException { @PostMapping("/users") 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(); + new URL("http://localhost:9090/ignore.html").getContent(); //virtual cache test case testCacheService(); return userRepo.save(user); From 74b74c7ff502e10702e57fcc779cea3a5838296a Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Sep 2024 16:04:19 +0800 Subject: [PATCH 6/6] update kafka case. --- test/e2e-v2/cases/kafka/profile/docker-compose.yml | 1 + test/e2e-v2/cases/kafka/simple-so11y/docker-compose.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/e2e-v2/cases/kafka/profile/docker-compose.yml b/test/e2e-v2/cases/kafka/profile/docker-compose.yml index b65813007e01..1d8924a5524c 100644 --- a/test/e2e-v2/cases/kafka/profile/docker-compose.yml +++ b/test/e2e-v2/cases/kafka/profile/docker-compose.yml @@ -107,6 +107,7 @@ services: SW_AGENT_INSTANCE_NAME: provider1 SW_LOGGING_OUTPUT: CONSOLE SW_METER_REPORT_INTERVAL: 5 + SW_METER_ACTIVE: 'false' depends_on: oap: condition: service_healthy diff --git a/test/e2e-v2/cases/kafka/simple-so11y/docker-compose.yml b/test/e2e-v2/cases/kafka/simple-so11y/docker-compose.yml index be85b5694c11..ee549ffd222b 100644 --- a/test/e2e-v2/cases/kafka/simple-so11y/docker-compose.yml +++ b/test/e2e-v2/cases/kafka/simple-so11y/docker-compose.yml @@ -108,6 +108,7 @@ services: SW_AGENT_NAME: e2e-service-provider SW_AGENT_INSTANCE_NAME: provider1 SW_LOGGING_OUTPUT: CONSOLE + SW_METER_ACTIVE: 'false' healthcheck: test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9090"] interval: 5s @@ -127,6 +128,7 @@ services: service: consumer environment: PROVIDER_URL: http://provider:9090 + SW_METER_ACTIVE: 'false' ports: - 9092 depends_on: