This is an automated email from the ASF dual-hosted git repository.
jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 113c77ccc66 Remove the test module from tracing (#24904)
113c77ccc66 is described below
commit 113c77ccc66de2968a6709025b83a19a0eab5df6
Author: jiangML <[email protected]>
AuthorDate: Fri Mar 31 10:20:33 2023 +0800
Remove the test module from tracing (#24904)
* add AgentExtension
* optimize agent test
* optimize test of tracing
* optimize test of metric and tracing
* Move TargetAdviceObjectFixture to fixture directory
---
.../core/advice/RouteResultCountAdviceTest.java | 2 +-
.../core/advice/SQLParseCountAdviceTest.java | 2 +-
.../core/advice/SQLRouteCountAdviceTest.java | 2 +-
.../jdbc/AbstractExecuteCountAdviceTest.java | 2 +-
.../jdbc/AbstractExecuteErrorsCountAdviceTest.java | 2 +-
.../AbstractExecuteLatencyHistogramAdviceTest.java | 2 +-
.../jdbc/AbstractTransactionsCountAdviceTest.java | 2 +-
.../proxy/CommitTransactionsCountAdviceTest.java | 2 +-
.../proxy/CurrentConnectionsCountAdviceTest.java | 2 +-
.../advice/proxy/ExecuteErrorsCountAdviceTest.java | 2 +-
.../proxy/ExecuteLatencyHistogramAdviceTest.java | 2 +-
.../core/advice/proxy/RequestsCountAdviceTest.java | 2 +-
.../proxy/RollbackTransactionsCountAdviceTest.java | 2 +-
.../core/fixture/TargetAdviceObjectFixture.java | 3 +
agent/plugins/pom.xml | 1 -
agent/plugins/tracing/pom.xml | 2 -
agent/plugins/tracing/test/pom.xml | 86 ----------------
.../plugin/tracing/TracingAgentExtension.java | 90 -----------------
.../AbstractJDBCExecutorCallbackAdviceTest.java | 110 ---------------------
.../advice/AbstractSQLParserEngineAdviceTest.java | 57 -----------
.../OpenTelemetryJDBCExecutorCallbackAdvice.java | 4 +-
.../advice/OpenTelemetryRootSpanAdvice.java | 3 +-
.../advice/OpenTelemetrySQLParserEngineAdvice.java | 4 +-
...penTelemetryJDBCExecutorCallbackAdviceTest.java | 86 ++++++++++++----
.../advice/OpenTelemetryRootSpanAdviceTest.java | 38 +++----
.../OpenTelemetrySQLParserEngineAdviceTest.java | 41 ++++----
.../fixture/JDBCExecutorCallbackFixture.java | 52 ++++++++++
.../fixture/TargetAdviceObjectFixture.java} | 17 ++--
agent/plugins/tracing/type/pom.xml | 7 --
29 files changed, 188 insertions(+), 439 deletions(-)
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
index a3d7aa2c9c1..c8bb4a26511 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.apache.shardingsphere.infra.route.context.RouteContext;
import org.apache.shardingsphere.infra.route.context.RouteMapper;
import org.apache.shardingsphere.infra.route.context.RouteUnit;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
index e69647b63ea..c5aace1f5b4 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.RegisterStorageUnitStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowStorageUnitsStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rul.sql.FormatStatement;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
index a4c676a1929..159f7f377c3 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.apache.shardingsphere.infra.binder.QueryContext;
import
org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;
import org.apache.shardingsphere.infra.context.ConnectionContext;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdviceTest.java
index edec28a464e..70e9600a1ef 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdviceTest.java
index c396c37ce21..516863f1c92 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
index 0615fae8f05..feabb4f0554 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdviceTest.java
index 02906214ab4..d3f56fc0cd8 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
index d33e6988fbf..1d3e3915fdd 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
index 9a4ad030cd2..f88827fea97 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
index 7a793ee62bf..33d4d9c05a8 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
index 99799775b94..91e328456a8 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
index 0550eda303f..1617ccf71d0 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
index c209686a532..0d4127e47b2 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/TargetAdviceObjectFixture.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/TargetAdviceObjectFixture.java
index 4f3b5596b52..0d2357cce8d 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/TargetAdviceObjectFixture.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/TargetAdviceObjectFixture.java
@@ -21,6 +21,9 @@ import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
+/**
+ * Target advice object fixture.
+ */
@Getter
@Setter
public final class TargetAdviceObjectFixture implements TargetAdviceObject {
diff --git a/agent/plugins/pom.xml b/agent/plugins/pom.xml
index e0fd02f0248..827b972372b 100644
--- a/agent/plugins/pom.xml
+++ b/agent/plugins/pom.xml
@@ -30,7 +30,6 @@
<modules>
<module>core</module>
-
<module>metrics</module>
<module>tracing</module>
<module>logging</module>
diff --git a/agent/plugins/tracing/pom.xml b/agent/plugins/tracing/pom.xml
index 64c0cd479c4..f7a3f97b8d7 100644
--- a/agent/plugins/tracing/pom.xml
+++ b/agent/plugins/tracing/pom.xml
@@ -31,8 +31,6 @@
<modules>
<module>core</module>
<module>type</module>
-
- <module>test</module>
</modules>
<properties>
diff --git a/agent/plugins/tracing/test/pom.xml
b/agent/plugins/tracing/test/pom.xml
deleted file mode 100644
index c249ee03339..00000000000
--- a/agent/plugins/tracing/test/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-plugin-tracing</artifactId>
- <version>5.3.3-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-agent-tracing-test</artifactId>
- <name>${project.artifactId}</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-proxy-frontend-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.opentracing</groupId>
- <artifactId>opentracing-util</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>io.opentracing</groupId>
- <artifactId>opentracing-mock</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-test-util</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-junit-jupiter</artifactId>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/TracingAgentExtension.java
b/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/TracingAgentExtension.java
deleted file mode 100644
index ce61832821f..00000000000
---
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/TracingAgentExtension.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.plugin.tracing;
-
-import net.bytebuddy.ByteBuddy;
-import net.bytebuddy.agent.ByteBuddyAgent;
-import net.bytebuddy.agent.builder.AgentBuilder;
-import net.bytebuddy.agent.builder.ResettableClassFileTransformer;
-import net.bytebuddy.dynamic.scaffold.TypeValidation;
-import net.bytebuddy.implementation.FieldAccessor;
-import net.bytebuddy.jar.asm.Opcodes;
-import net.bytebuddy.matcher.ElementMatchers;
-import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
-import org.apache.shardingsphere.agent.plugin.tracing.advice.AdviceTestBase;
-import org.junit.jupiter.api.extension.AfterAllCallback;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
-import org.junit.jupiter.api.extension.BeforeEachCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-
-/**
- * Tracing agent extension.
- */
-public final class TracingAgentExtension implements BeforeAllCallback,
AfterAllCallback, BeforeEachCallback {
-
- private static final String EXTRA_DATA = "_$EXTRA_DATA$_";
-
- private static ResettableClassFileTransformer byteBuddyAgent;
-
- private static final String[] ENHANCEMENT_CLASSES = {
-
"org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask",
-
"org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback",
-
"org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine"
- };
-
- @Override
- public void beforeAll(final ExtensionContext context) {
- ByteBuddyAgent.install();
- Collection<String> classes = new
HashSet<>(Arrays.asList(ENHANCEMENT_CLASSES));
- byteBuddyAgent = new AgentBuilder.Default()
- .with(new ByteBuddy().with(TypeValidation.ENABLED))
- .type(ElementMatchers.namedOneOf(ENHANCEMENT_CLASSES))
- .transform((builder, typeDescription, classLoader, module) -> {
- if (classes.contains(typeDescription.getTypeName())) {
- return builder.defineField(EXTRA_DATA, Object.class,
Opcodes.ACC_PRIVATE | Opcodes.ACC_VOLATILE)
- .implement(TargetAdviceObject.class)
- .intercept(FieldAccessor.ofField(EXTRA_DATA));
- }
- return builder;
- }).installOnByteBuddyAgent();
- // load them into current classloader
- classes.forEach(each -> {
- try {
- Class.forName(each);
- } catch (final ClassNotFoundException ignored) {
- }
- });
- }
-
- @Override
- public void afterAll(final ExtensionContext context) {
- byteBuddyAgent.reset(ByteBuddyAgent.getInstrumentation(),
AgentBuilder.RedefinitionStrategy.RETRANSFORMATION);
- }
-
- @Override
- public void beforeEach(final ExtensionContext context) {
- Object testInstance = context.getRequiredTestInstance();
- if (testInstance instanceof AdviceTestBase) {
- ((AdviceTestBase) testInstance).prepare();
- }
- }
-}
diff --git
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AbstractJDBCExecutorCallbackAdviceTest.java
b/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AbstractJDBCExecutorCallbackAdviceTest.java
deleted file mode 100644
index 2ac8ccc6969..00000000000
---
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AbstractJDBCExecutorCallbackAdviceTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.plugin.tracing.advice;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.SneakyThrows;
-import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
-import org.apache.shardingsphere.agent.plugin.tracing.TracingAgentExtension;
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
-import org.apache.shardingsphere.infra.executor.sql.context.SQLUnit;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.internal.configuration.plugins.Plugins;
-import org.mockito.invocation.InvocationOnMock;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-@ExtendWith(TracingAgentExtension.class)
-@Getter
-public abstract class AbstractJDBCExecutorCallbackAdviceTest implements
AdviceTestBase {
-
- public static final String DATA_SOURCE_NAME = "mock.db";
-
- public static final String SQL = "SELECT 1";
-
- private final Map<String, Object> extraMap = new HashMap<>();
-
- private TargetAdviceObject targetObject;
-
- @Getter(AccessLevel.NONE)
- private Object attachment;
-
- private JDBCExecutionUnit executionUnit;
-
- @Getter(AccessLevel.NONE)
- private Map<String, DatabaseType> storageTypes;
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- @SneakyThrows({ReflectiveOperationException.class, SQLException.class})
- @Override
- public void prepare() {
- Statement statement = mock(Statement.class);
- Connection connection = mock(Connection.class);
- DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class);
- when(databaseMetaData.getURL()).thenReturn("mock_url");
- when(connection.getMetaData()).thenReturn(databaseMetaData);
- when(statement.getConnection()).thenReturn(connection);
- executionUnit = new JDBCExecutionUnit(new
ExecutionUnit(DATA_SOURCE_NAME, new SQLUnit(SQL, Collections.emptyList())),
null, statement);
- JDBCExecutorCallback mockedJDBCExecutorCallback =
mock(JDBCExecutorCallback.class, this::mockAttachment);
- Map<String, DataSourceMetaData> cachedDatasourceMetaData =
(Map<String, DataSourceMetaData>) Plugins.getMemberAccessor()
-
.get(JDBCExecutorCallback.class.getDeclaredField("CACHED_DATASOURCE_METADATA"),
mockedJDBCExecutorCallback);
- cachedDatasourceMetaData.put("mock_url",
mock(DataSourceMetaData.class));
- storageTypes = Collections.singletonMap(DATA_SOURCE_NAME, new
MySQLDatabaseType());
-
Plugins.getMemberAccessor().set(JDBCExecutorCallback.class.getDeclaredField("storageTypes"),
mockedJDBCExecutorCallback, storageTypes);
- targetObject = (TargetAdviceObject) mockedJDBCExecutorCallback;
- }
-
- // CHECKSTYLE:OFF
- private Object mockAttachment(final InvocationOnMock invocation) throws
Throwable {
- // CHECKSTYLE:ON
- switch (invocation.getMethod().getName()) {
- case "getAttachment":
- return attachment;
- case "setAttachment":
- attachment = invocation.getArguments()[0];
- return null;
- default:
- return invocation.callRealMethod();
- }
- }
-
- /**
- * Get database type.
- *
- * @param databaseName database name
- * @return database type
- */
- public String getDatabaseType(final String databaseName) {
- return null == storageTypes ? "" :
storageTypes.get(databaseName).getType();
- }
-}
diff --git
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AbstractSQLParserEngineAdviceTest.java
b/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AbstractSQLParserEngineAdviceTest.java
deleted file mode 100644
index f35ce854147..00000000000
---
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AbstractSQLParserEngineAdviceTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.plugin.tracing.advice;
-
-import lombok.Getter;
-import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
-import org.apache.shardingsphere.agent.plugin.tracing.TracingAgentExtension;
-import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.invocation.InvocationOnMock;
-
-import static org.mockito.Mockito.mock;
-
-@ExtendWith(TracingAgentExtension.class)
-public abstract class AbstractSQLParserEngineAdviceTest implements
AdviceTestBase {
-
- @Getter
- private TargetAdviceObject targetObject;
-
- private Object attachment;
-
- @SuppressWarnings("ConstantConditions")
- @Override
- public final void prepare() {
- Object parserEngine = mock(ShardingSphereSQLParserEngine.class,
this::mockAttachment);
- targetObject = (TargetAdviceObject) parserEngine;
- }
-
- // CHECKSTYLE:OFF
- private Object mockAttachment(final InvocationOnMock invocation) throws
Throwable {
- // CHECKSTYLE:ON
- switch (invocation.getMethod().getName()) {
- case "getAttachment":
- return attachment;
- case "setAttachment":
- attachment = invocation.getArguments()[0];
- return null;
- default:
- return invocation.callRealMethod();
- }
- }
-}
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdvice.java
b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdvice.java
index 846a49e916d..485babb90e7 100644
---
a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdvice.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdvice.java
@@ -56,7 +56,9 @@ public final class OpenTelemetryJDBCExecutorCallbackAdvice
extends TracingJDBCEx
@Override
public void afterMethod(final TargetAdviceObject target, final Method
method, final Object[] args, final Object result, final String pluginType) {
- ((Span) target.getAttachment()).end();
+ Span span = (Span) target.getAttachment();
+ span.setStatus(StatusCode.OK);
+ span.end();
}
@Override
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdvice.java
b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdvice.java
index 827f8e1c364..aa0263b8b4a 100644
---
a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdvice.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdvice.java
@@ -44,12 +44,13 @@ public final class OpenTelemetryRootSpanAdvice extends
TracingRootSpanAdvice<Spa
@Override
protected void finishRootSpan(final Span rootSpan, final
TargetAdviceObject target) {
+ rootSpan.setStatus(StatusCode.OK);
rootSpan.end();
}
@Override
protected void recordException(final Span rootSpan, final
TargetAdviceObject target, final Throwable throwable) {
rootSpan.setStatus(StatusCode.ERROR).recordException(throwable);
- finishRootSpan(rootSpan, target);
+ rootSpan.end();
}
}
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdvice.java
b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdvice.java
index fb1391c2099..ab3bd90b714 100644
---
a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdvice.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdvice.java
@@ -50,7 +50,9 @@ public final class OpenTelemetrySQLParserEngineAdvice extends
TracingSQLParserEn
@Override
public void afterMethod(final TargetAdviceObject target, final Method
method, final Object[] args, final Object result, final String pluginType) {
- ((Span) target.getAttachment()).end();
+ Span span = (Span) target.getAttachment();
+ span.setStatus(StatusCode.OK);
+ span.end();
}
@Override
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java
index 44132885e40..4a16a33ab11 100644
---
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java
@@ -27,72 +27,118 @@ import
io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter;
import io.opentelemetry.sdk.trace.SdkTracerProvider;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.agent.plugin.tracing.advice.AbstractJDBCExecutorCallbackAdviceTest;
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.plugin.tracing.core.RootSpanContext;
import
org.apache.shardingsphere.agent.plugin.tracing.core.constant.AttributeConstants;
import
org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.constant.OpenTelemetryConstants;
+import
org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.fixture.JDBCExecutorCallbackFixture;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
+import org.apache.shardingsphere.infra.executor.sql.context.SQLUnit;
+import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
+import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.internal.configuration.plugins.Plugins;
import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Collections;
import java.util.List;
+import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
-@Slf4j
-class OpenTelemetryJDBCExecutorCallbackAdviceTest extends
AbstractJDBCExecutorCallbackAdviceTest {
+class OpenTelemetryJDBCExecutorCallbackAdviceTest {
+
+ public static final String DATA_SOURCE_NAME = "mock.db";
+
+ public static final String SQL = "SELECT 1";
+
+ private static final String DB_TYPE = "MySQL";
private final InMemorySpanExporter testExporter =
InMemorySpanExporter.create();
private Span parentSpan;
+ private TargetAdviceObject targetObject;
+
+ private JDBCExecutionUnit executionUnit;
+
@BeforeEach
void setup() {
SdkTracerProvider tracerProvider =
SdkTracerProvider.builder().addSpanProcessor(SimpleSpanProcessor.create(testExporter)).build();
OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).buildAndRegisterGlobal().getTracer(OpenTelemetryConstants.TRACER_NAME);
parentSpan =
GlobalOpenTelemetry.getTracer(OpenTelemetryConstants.TRACER_NAME).spanBuilder("parent").startSpan();
RootSpanContext.set(parentSpan);
+ prepare();
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ @SneakyThrows({ReflectiveOperationException.class, SQLException.class})
+ private void prepare() {
+ Statement statement = mock(Statement.class);
+ Connection connection = mock(Connection.class);
+ DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class);
+ when(databaseMetaData.getURL()).thenReturn("mock_url");
+ when(connection.getMetaData()).thenReturn(databaseMetaData);
+ when(statement.getConnection()).thenReturn(connection);
+ executionUnit = new JDBCExecutionUnit(new
ExecutionUnit(DATA_SOURCE_NAME, new SQLUnit(SQL, Collections.emptyList())),
null, statement);
+ JDBCExecutorCallback jdbcExecutorCallback = new
JDBCExecutorCallbackFixture(new MySQLDatabaseType(),
Collections.singletonMap("ds", new MySQLDatabaseType()),
+ new MySQLSelectStatement(), true);
+ Map<String, DataSourceMetaData> cachedDatasourceMetaData =
(Map<String, DataSourceMetaData>) Plugins.getMemberAccessor()
+
.get(JDBCExecutorCallback.class.getDeclaredField("CACHED_DATASOURCE_METADATA"),
jdbcExecutorCallback);
+ cachedDatasourceMetaData.put("mock_url",
mock(DataSourceMetaData.class));
+ Map<String, DatabaseType> storageTypes =
Collections.singletonMap(DATA_SOURCE_NAME, new MySQLDatabaseType());
+
Plugins.getMemberAccessor().set(JDBCExecutorCallback.class.getDeclaredField("storageTypes"),
jdbcExecutorCallback, storageTypes);
+ targetObject = (TargetAdviceObject) jdbcExecutorCallback;
}
@AfterEach
void clean() {
- parentSpan.end();
GlobalOpenTelemetry.resetForTest();
+ parentSpan.end();
testExporter.reset();
}
@Test
void assertMethod() {
OpenTelemetryJDBCExecutorCallbackAdvice advice = new
OpenTelemetryJDBCExecutorCallbackAdvice();
- advice.beforeMethod(getTargetObject(), null, new
Object[]{getExecutionUnit(), false, getExtraMap()}, "OpenTelemetry");
- advice.afterMethod(getTargetObject(), null, new
Object[]{getExecutionUnit(), false, getExtraMap()}, null, "OpenTelemetry");
+ advice.beforeMethod(targetObject, null, new Object[]{executionUnit,
false}, "OpenTelemetry");
+ advice.afterMethod(targetObject, null, new Object[]{executionUnit,
false}, null, "OpenTelemetry");
List<SpanData> spanItems = testExporter.getFinishedSpanItems();
- assertThat(spanItems.size(), is(1));
- SpanData spanData = spanItems.get(0);
- assertThat(spanData.getName(), is("/ShardingSphere/executeSQL/"));
- Attributes attributes = spanData.getAttributes();
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.COMPONENT)),
is(AttributeConstants.COMPONENT_NAME));
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_TYPE)),
is(getDatabaseType(DATA_SOURCE_NAME)));
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_INSTANCE)),
is(DATA_SOURCE_NAME));
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_STATEMENT)),
is(SQL));
+ assertCommonData(spanItems);
+ assertThat(spanItems.iterator().next().getStatus().getStatusCode(),
is(StatusCode.OK));
}
@Test
void assertExceptionHandle() {
OpenTelemetryJDBCExecutorCallbackAdvice advice = new
OpenTelemetryJDBCExecutorCallbackAdvice();
- advice.beforeMethod(getTargetObject(), null, new
Object[]{getExecutionUnit(), false, getExtraMap()}, "OpenTelemetry");
- advice.onThrowing(getTargetObject(), null, new
Object[]{getExecutionUnit(), false, getExtraMap()}, new IOException(),
"OpenTelemetry");
+ advice.beforeMethod(targetObject, null, new Object[]{executionUnit,
false}, "OpenTelemetry");
+ advice.onThrowing(targetObject, null, new Object[]{executionUnit,
false}, new IOException(), "OpenTelemetry");
List<SpanData> spanItems = testExporter.getFinishedSpanItems();
+ assertCommonData(spanItems);
+ assertThat(spanItems.iterator().next().getStatus().getStatusCode(),
is(StatusCode.ERROR));
+ }
+
+ private void assertCommonData(final List<SpanData> spanItems) {
assertThat(spanItems.size(), is(1));
- SpanData spanData = spanItems.get(0);
+ SpanData spanData = spanItems.iterator().next();
assertThat(spanData.getName(), is("/ShardingSphere/executeSQL/"));
- assertThat(spanData.getStatus().getStatusCode(), is(StatusCode.ERROR));
Attributes attributes = spanData.getAttributes();
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.COMPONENT)),
is(AttributeConstants.COMPONENT_NAME));
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_TYPE)),
is(getDatabaseType(DATA_SOURCE_NAME)));
+
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_TYPE)),
is(DB_TYPE));
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_INSTANCE)),
is(DATA_SOURCE_NAME));
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_STATEMENT)),
is(SQL));
}
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java
index ae355c06718..ad4c6582ed1 100644
---
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.advice;
-import io.netty.util.DefaultAttributeMap;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.trace.StatusCode;
@@ -26,18 +25,13 @@ import
io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter;
import io.opentelemetry.sdk.trace.SdkTracerProvider;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
-import org.apache.shardingsphere.agent.plugin.tracing.TracingAgentExtension;
import
org.apache.shardingsphere.agent.plugin.tracing.core.constant.AttributeConstants;
import
org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.constant.OpenTelemetryConstants;
-import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import
org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.fixture.TargetAdviceObjectFixture;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
-import org.apache.shardingsphere.transaction.api.TransactionType;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -52,22 +46,17 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-@ExtendWith({TracingAgentExtension.class, AutoMockExtension.class})
+@ExtendWith(AutoMockExtension.class)
@StaticMockSettings(ProxyContext.class)
class OpenTelemetryRootSpanAdviceTest {
private final InMemorySpanExporter testExporter =
InMemorySpanExporter.create();
- private TargetAdviceObject targetObject;
-
@BeforeEach
void setup() {
SdkTracerProvider tracerProvider =
SdkTracerProvider.builder().addSpanProcessor(SimpleSpanProcessor.create(testExporter)).build();
OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).buildAndRegisterGlobal().getTracer(OpenTelemetryConstants.TRACER_NAME);
when(ProxyContext.getInstance().getContextManager()).thenReturn(mock(ContextManager.class,
RETURNS_DEEP_STUBS));
- ConnectionSession connectionSession = new
ConnectionSession(mock(MySQLDatabaseType.class), TransactionType.BASE, new
DefaultAttributeMap());
- Object executorTask = new CommandExecutorTask(null, connectionSession,
null, null);
- targetObject = (TargetAdviceObject) executorTask;
}
@AfterEach
@@ -79,27 +68,28 @@ class OpenTelemetryRootSpanAdviceTest {
@Test
void assertMethod() {
OpenTelemetryRootSpanAdvice advice = new OpenTelemetryRootSpanAdvice();
- advice.beforeMethod(targetObject, null, new Object[]{},
"OpenTelemetry");
- advice.afterMethod(targetObject, null, new Object[]{}, null,
"OpenTelemetry");
+ advice.beforeMethod(new TargetAdviceObjectFixture(), null, new
Object[]{}, "OpenTelemetry");
+ advice.afterMethod(new TargetAdviceObjectFixture(), null, new
Object[]{}, null, "OpenTelemetry");
List<SpanData> spanItems = testExporter.getFinishedSpanItems();
- assertThat(spanItems.size(), is(1));
- SpanData spanData = spanItems.get(0);
- assertThat(spanData.getName(), is("/ShardingSphere/rootInvoke/"));
-
assertThat(spanData.getAttributes().get(AttributeKey.stringKey(AttributeConstants.COMPONENT)),
is(AttributeConstants.COMPONENT_NAME));
-
assertThat(spanData.getAttributes().get(AttributeKey.stringKey(AttributeConstants.SPAN_KIND)),
is(AttributeConstants.SPAN_KIND_CLIENT));
+ assertCommonData(spanItems);
+ assertThat(spanItems.iterator().next().getStatus().getStatusCode(),
is(StatusCode.OK));
}
@Test
void assertExceptionHandle() {
OpenTelemetryRootSpanAdvice advice = new OpenTelemetryRootSpanAdvice();
- advice.beforeMethod(targetObject, null, new Object[]{},
"OpenTelemetry");
- advice.onThrowing(targetObject, null, new Object[]{}, new
IOException(), "OpenTelemetry");
+ advice.beforeMethod(new TargetAdviceObjectFixture(), null, new
Object[]{}, "OpenTelemetry");
+ advice.onThrowing(new TargetAdviceObjectFixture(), null, new
Object[]{}, new IOException(), "OpenTelemetry");
List<SpanData> spanItems = testExporter.getFinishedSpanItems();
+ assertCommonData(spanItems);
+ assertThat(spanItems.iterator().next().getStatus().getStatusCode(),
is(StatusCode.ERROR));
+ }
+
+ private void assertCommonData(final List<SpanData> spanItems) {
assertThat(spanItems.size(), is(1));
- SpanData spanData = spanItems.get(0);
+ SpanData spanData = spanItems.iterator().next();
assertThat(spanData.getName(), is("/ShardingSphere/rootInvoke/"));
assertThat(spanData.getAttributes().get(AttributeKey.stringKey(AttributeConstants.COMPONENT)),
is(AttributeConstants.COMPONENT_NAME));
assertThat(spanData.getAttributes().get(AttributeKey.stringKey(AttributeConstants.SPAN_KIND)),
is(AttributeConstants.SPAN_KIND_CLIENT));
- assertThat(spanData.getStatus().getStatusCode(), is(StatusCode.ERROR));
}
}
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java
index 92b3e601700..7a1ececc36a 100644
---
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java
@@ -27,10 +27,10 @@ import
io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter;
import io.opentelemetry.sdk.trace.SdkTracerProvider;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-import
org.apache.shardingsphere.agent.plugin.tracing.advice.AbstractSQLParserEngineAdviceTest;
import org.apache.shardingsphere.agent.plugin.tracing.core.RootSpanContext;
import
org.apache.shardingsphere.agent.plugin.tracing.core.constant.AttributeConstants;
import
org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.constant.OpenTelemetryConstants;
+import
org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.fixture.TargetAdviceObjectFixture;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -41,9 +41,9 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-class OpenTelemetrySQLParserEngineAdviceTest extends
AbstractSQLParserEngineAdviceTest {
+class OpenTelemetrySQLParserEngineAdviceTest {
- private static final String SQL_STATEMENT = "select 1";
+ private static final String SQL = "select 1";
private final InMemorySpanExporter testExporter =
InMemorySpanExporter.create();
@@ -59,37 +59,40 @@ class OpenTelemetrySQLParserEngineAdviceTest extends
AbstractSQLParserEngineAdvi
@AfterEach
void clean() {
- parentSpan.end();
GlobalOpenTelemetry.resetForTest();
+ parentSpan.end();
testExporter.reset();
}
@Test
void assertMethod() {
+ TargetAdviceObjectFixture adviceObjectFixture = new
TargetAdviceObjectFixture();
OpenTelemetrySQLParserEngineAdvice advice = new
OpenTelemetrySQLParserEngineAdvice();
- advice.beforeMethod(getTargetObject(), null, new
Object[]{SQL_STATEMENT, true}, "OpenTelemetry");
- advice.afterMethod(getTargetObject(), null, new
Object[]{SQL_STATEMENT, true}, null, "OpenTelemetry");
+ advice.beforeMethod(adviceObjectFixture, null, new Object[]{SQL,
true}, "OpenTelemetry");
+ advice.afterMethod(adviceObjectFixture, null, new Object[]{SQL, true},
null, "OpenTelemetry");
List<SpanData> spanItems = testExporter.getFinishedSpanItems();
- assertThat(spanItems.size(), is(1));
- assertThat(spanItems.get(0).getName(),
is("/ShardingSphere/parseSQL/"));
- assertThat(spanItems.get(0).getParentSpanId(),
is(parentSpan.getSpanContext().getSpanId()));
- Attributes attributes = spanItems.get(0).getAttributes();
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.COMPONENT)),
is(AttributeConstants.COMPONENT_NAME));
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_STATEMENT)),
is(SQL_STATEMENT));
+ assertCommonData(spanItems);
+ assertThat(spanItems.iterator().next().getStatus().getStatusCode(),
is(StatusCode.OK));
}
@Test
void assertExceptionHandle() {
+ TargetAdviceObjectFixture adviceObjectFixture = new
TargetAdviceObjectFixture();
OpenTelemetrySQLParserEngineAdvice advice = new
OpenTelemetrySQLParserEngineAdvice();
- advice.beforeMethod(getTargetObject(), null, new
Object[]{SQL_STATEMENT, true}, "OpenTelemetry");
- advice.onThrowing(getTargetObject(), null, new Object[]{SQL_STATEMENT,
true}, new IOException(), "OpenTelemetry");
+ advice.beforeMethod(adviceObjectFixture, null, new Object[]{SQL,
true}, "OpenTelemetry");
+ advice.onThrowing(adviceObjectFixture, null, new Object[]{SQL, true},
new IOException(), "OpenTelemetry");
List<SpanData> spanItems = testExporter.getFinishedSpanItems();
+ assertCommonData(spanItems);
+ assertThat(spanItems.iterator().next().getStatus().getStatusCode(),
is(StatusCode.ERROR));
+ }
+
+ private void assertCommonData(final List<SpanData> spanItems) {
assertThat(spanItems.size(), is(1));
- assertThat(spanItems.get(0).getName(),
is("/ShardingSphere/parseSQL/"));
- assertThat(spanItems.get(0).getStatus().getStatusCode(),
is(StatusCode.ERROR));
- assertThat(spanItems.get(0).getParentSpanId(),
is(parentSpan.getSpanContext().getSpanId()));
- Attributes attributes = spanItems.get(0).getAttributes();
+ SpanData spanData = spanItems.iterator().next();
+ assertThat(spanData.getName(), is("/ShardingSphere/parseSQL/"));
+ assertThat(spanData.getParentSpanId(),
is(parentSpan.getSpanContext().getSpanId()));
+ Attributes attributes = spanItems.iterator().next().getAttributes();
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.COMPONENT)),
is(AttributeConstants.COMPONENT_NAME));
-
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_STATEMENT)),
is(SQL_STATEMENT));
+
assertThat(attributes.get(AttributeKey.stringKey(AttributeConstants.DB_STATEMENT)),
is(SQL));
}
}
diff --git
a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java
new file mode 100644
index 00000000000..fc5672a733a
--- /dev/null
+++
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.fixture;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
+import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+import java.util.Optional;
+
+@Getter
+@Setter
+public final class JDBCExecutorCallbackFixture extends
JDBCExecutorCallback<Object> implements TargetAdviceObject {
+
+ private Object attachment;
+
+ public JDBCExecutorCallbackFixture(final DatabaseType protocolType, final
Map<String, DatabaseType> storageTypes, final SQLStatement sqlStatement, final
boolean isExceptionThrown) {
+ super(protocolType, storageTypes, sqlStatement, isExceptionThrown);
+ }
+
+ @Override
+ protected Object executeSQL(final String sql, final Statement statement,
final ConnectionMode connectionMode, final DatabaseType storageType) throws
SQLException {
+ return null;
+ }
+
+ @Override
+ protected Optional<Object> getSaneResult(final SQLStatement sqlStatement,
final SQLException ex) {
+ return Optional.empty();
+ }
+}
diff --git
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/TargetAdviceObjectFixture.java
similarity index 70%
rename from
agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java
rename to
agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/TargetAdviceObjectFixture.java
index db31bdf2452..04ee58295ad 100644
---
a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java
+++
b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/TargetAdviceObjectFixture.java
@@ -15,15 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.plugin.tracing.advice;
+package org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.fixture;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
/**
- * Advice test base.
+ * Target advice object fixture.
*/
-public interface AdviceTestBase {
+@Getter
+@Setter
+public final class TargetAdviceObjectFixture implements TargetAdviceObject {
- /**
- * Prepare env for testing.
- */
- void prepare();
+ private Object attachment;
}
diff --git a/agent/plugins/tracing/type/pom.xml
b/agent/plugins/tracing/type/pom.xml
index 772724e4366..73b58fb6212 100644
--- a/agent/plugins/tracing/type/pom.xml
+++ b/agent/plugins/tracing/type/pom.xml
@@ -55,12 +55,5 @@
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-tracing-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>