This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new a24efcf ShardingSphere plugins conflict among themselves. (#4921)
a24efcf is described below
commit a24efcf5e9107a8ebc6e7ddcb5e3c8cdf29a0d5e
Author: xiaoyu <[email protected]>
AuthorDate: Sun Jun 14 18:48:07 2020 +0800
ShardingSphere plugins conflict among themselves. (#4921)
* Fix shardingSphere plugin test fail if have some same ENHANCE_CLASS
define.
* support 4.1.0 and 4.1.1
* support 4.1.0 and 4.1.1
---
.github/workflows/plugins-test.2.yaml | 4 ++
CHANGES.md | 2 +-
.../sharding-sphere-4.1.0-plugin/pom.xml | 2 +-
.../shardingsphere/v41/ExecuteInterceptor.java | 7 ++--
.../v41/JDBCRootInvokeInterceptor.java | 5 ++-
.../v41/ProxyRootInvokeInterceptor.java | 5 ++-
.../AbstractShardingSphere41Instrumentation.java | 29 +++++++++++++
.../v41/define/ExecuteInstrumentation.java | 3 +-
.../v41/define/JDBCRootInvokeInstrumentation.java | 3 +-
.../v41/define/ProxyRootInvokeInstrumentation.java | 3 +-
.../v41/threadlocal/ContextThreadLocal.java | 48 ----------------------
.../AbstractShardingSphereV4R3Instrumentation.java | 29 +++++++++++++
.../v4rc3/define/ExecuteInstrumentation.java | 3 +-
.../define/JDBCRootInvokeInstrumentation.java | 3 +-
.../define/ProxyRootInvokeInstrumentation.java | 3 +-
.../AbstractShardingSphereV4Instrumentation.java | 29 +++++++++++++
.../v4/define/ExecuteInstrumentation.java | 3 +-
.../v4/define/JDBCRootInvokeInstrumentation.java | 3 +-
.../v4/define/ProxyRootInvokeInstrumentation.java | 3 +-
.../service-agent/java-agent/Supported-list.md | 2 +-
.../scenarios/shardingsphere-4.x-scenario/pom.xml | 8 ++--
.../service/utility/config/DataSourceUtil.java | 3 +-
.../support-version.list | 4 +-
23 files changed, 119 insertions(+), 85 deletions(-)
diff --git a/.github/workflows/plugins-test.2.yaml
b/.github/workflows/plugins-test.2.yaml
index 76098da..75a0a30 100644
--- a/.github/workflows/plugins-test.2.yaml
+++ b/.github/workflows/plugins-test.2.yaml
@@ -42,6 +42,10 @@ jobs:
- { name: 'resttemplate-4.x-scenario', title: 'RestTemplate
4.0.0.RELEASE-4.3.26.RELEASE (57)' }
- { name: 'servicecomb-0.x-scenario', title: 'ServiceComb 0.x (5)' }
- { name: 'servicecomb-1.x-scenario', title: 'ServiceComb 1.x (5)' }
+ - { name: 'shardingsphere-3.x-scenario', title: 'ShardingSphere
3.0.0 (1)' }
+ - { name: 'shardingsphere-4.x-RC1-RC2-scenario', title:
'ShardingSphere 4.0.0-RC1-4.0.0-RC2 (2)' }
+ - { name: 'shardingsphere-4.x-RC3-scenario', title: 'ShardingSphere
4.0.0-RC3 (1)' }
+ - { name: 'shardingsphere-4.x-scenario', title: 'ShardingSphere
4.1.0-4.1.1 (2)' }
- { name: 'sofarpc-scenario', title: 'SofaRPC 5.4.0-5.6.2 (23)' }
- { name: 'solrj-7.x-scenario', title: 'SolrJ 7.x (12)' }
- { name: 'spring-3.0.x-scenario', title: 'Spring 3.0.x (8)' }
diff --git a/CHANGES.md b/CHANGES.md
index fa785d7..956fa3d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,7 +12,7 @@ Release Notes.
* Support Prometheus network protocol. Metrics in Prometheus format could be
transferred into SkyWalking.
* Python agent provided.
* All inventory caches have been removed.
-* Apache ShardingSphere(4.0.0, 4.1.1) agent plugin provided.
+* Apache ShardingSphere(4.1.0, 4.1.1) agent plugin provided.
#### Java Agent
* Add MariaDB plugin.
diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/pom.xml
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/pom.xml
index 30dbcc1..7e48e02 100644
--- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/pom.xml
@@ -32,7 +32,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <shardingsphere.version>[4.0.0,4.1.1]</shardingsphere.version>
+ <shardingsphere.version>4.1.0</shardingsphere.version>
</properties>
<dependencies>
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ExecuteInterceptor.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ExecuteInterceptor.java
index 3381446..72fa54b 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ExecuteInterceptor.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ExecuteInterceptor.java
@@ -20,13 +20,14 @@ package org.apache.skywalking.apm.plugin.shardingsphere.v41;
import java.lang.reflect.Method;
import java.util.Map;
+
+import org.apache.shardingsphere.underlying.executor.engine.ExecutorDataMap;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
-import
org.apache.skywalking.apm.plugin.shardingsphere.v41.threadlocal.ContextThreadLocal;
/**
* {@link ExecuteInterceptor} enhances. {@link
org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback}
@@ -38,7 +39,7 @@ public class ExecuteInterceptor implements
InstanceMethodsAroundInterceptor {
public void beforeMethod(EnhancedInstance objInst, Method method, Object[]
allArguments, Class<?>[] argumentsTypes,
MethodInterceptResult result) {
ContextManager.createLocalSpan("/ShardingSphere/executeSQL/").setComponent(ComponentsDefine.SHARDING_SPHERE);
- ContextSnapshot contextSnapshot = (ContextSnapshot)
ContextThreadLocal.getValue()
+ ContextSnapshot contextSnapshot = (ContextSnapshot)
ExecutorDataMap.getValue()
.get(Constant.CONTEXT_SNAPSHOT);
if (null == contextSnapshot) {
contextSnapshot = (ContextSnapshot) ((Map)
allArguments[2]).get(Constant.CONTEXT_SNAPSHOT);
@@ -52,7 +53,6 @@ public class ExecuteInterceptor implements
InstanceMethodsAroundInterceptor {
public Object afterMethod(EnhancedInstance objInst, Method method,
Object[] allArguments, Class<?>[] argumentsTypes,
Object ret) {
ContextManager.stopSpan();
- ContextThreadLocal.remove();
return ret;
}
@@ -60,6 +60,5 @@ public class ExecuteInterceptor implements
InstanceMethodsAroundInterceptor {
public void handleMethodException(EnhancedInstance objInst, Method method,
Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
- ContextThreadLocal.remove();
}
}
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/JDBCRootInvokeInterceptor.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/JDBCRootInvokeInterceptor.java
index b7ed611..d468d97 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/JDBCRootInvokeInterceptor.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/JDBCRootInvokeInterceptor.java
@@ -19,12 +19,13 @@
package org.apache.skywalking.apm.plugin.shardingsphere.v41;
import java.lang.reflect.Method;
+
+import org.apache.shardingsphere.underlying.executor.engine.ExecutorDataMap;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
-import
org.apache.skywalking.apm.plugin.shardingsphere.v41.threadlocal.ContextThreadLocal;
/**
* {@link JDBCRootInvokeInterceptor} enhances {@link
org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor},
@@ -37,7 +38,7 @@ public class JDBCRootInvokeInterceptor implements
InstanceMethodsAroundIntercept
MethodInterceptResult result) {
ContextManager.createLocalSpan("/ShardingSphere/JDBCRootInvoke/")
.setComponent(ComponentsDefine.SHARDING_SPHERE);
- ContextThreadLocal.getValue().put(Constant.CONTEXT_SNAPSHOT,
ContextManager.capture());
+ ExecutorDataMap.getValue().put(Constant.CONTEXT_SNAPSHOT,
ContextManager.capture());
}
@Override
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ProxyRootInvokeInterceptor.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ProxyRootInvokeInterceptor.java
index 2dc29fd..35e30e8 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ProxyRootInvokeInterceptor.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/ProxyRootInvokeInterceptor.java
@@ -19,12 +19,13 @@
package org.apache.skywalking.apm.plugin.shardingsphere.v41;
import java.lang.reflect.Method;
+
+import org.apache.shardingsphere.underlying.executor.engine.ExecutorDataMap;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
-import
org.apache.skywalking.apm.plugin.shardingsphere.v41.threadlocal.ContextThreadLocal;
/**
* ProxyRootInvokeInterceptor enhances. skywalking intercepts
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask
@@ -37,7 +38,7 @@ public class ProxyRootInvokeInterceptor implements
InstanceMethodsAroundIntercep
MethodInterceptResult result) {
ContextManager.createLocalSpan("/ShardingSphere/ProxyRootInvoke/")
.setComponent(ComponentsDefine.SHARDING_SPHERE);
- ContextThreadLocal.getValue().put(Constant.CONTEXT_SNAPSHOT,
ContextManager.capture());
+ ExecutorDataMap.getValue().put(Constant.CONTEXT_SNAPSHOT,
ContextManager.capture());
}
@Override
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/AbstractShardingSphere41Instrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/AbstractShardingSphere41Instrumentation.java
new file mode 100644
index 0000000..69b8439
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/AbstractShardingSphere41Instrumentation.java
@@ -0,0 +1,29 @@
+/*
+ * 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.skywalking.apm.plugin.shardingsphere.v41.define;
+
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+public abstract class AbstractShardingSphere41Instrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+ public static final String WITHNESS_CLASSES =
"org.apache.shardingsphere.sql.parser.SQLParserEngine";
+
+ @Override
+ protected final String[] witnessClasses() {
+ return new String[] {WITHNESS_CLASSES};
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ExecuteInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ExecuteInstrumentation.java
index 61f3990..4771806 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ExecuteInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ExecuteInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link ExecuteInstrumentation} presents that skywalking intercepts. {@link
org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback}.
*/
-public class ExecuteInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class ExecuteInstrumentation extends
AbstractShardingSphere41Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/JDBCRootInvokeInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/JDBCRootInvokeInstrumentation.java
index 6305e0a..a92283f 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/JDBCRootInvokeInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/JDBCRootInvokeInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts.
{@link
org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
*/
-public class JDBCRootInvokeInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class JDBCRootInvokeInstrumentation extends
AbstractShardingSphere41Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ProxyRootInvokeInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ProxyRootInvokeInstrumentation.java
index 6aa51ae..8427ae8 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ProxyRootInvokeInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/define/ProxyRootInvokeInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* ProxyRootInvokeInstrumentation presents that skywalking intercepts.
skywalking intercepts
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.
*/
-public class ProxyRootInvokeInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class ProxyRootInvokeInstrumentation extends
AbstractShardingSphere41Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/threadlocal/ContextThreadLocal.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/threadlocal/ContextThreadLocal.java
deleted file mode 100644
index 12e4e1d..0000000
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.1.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v41/threadlocal/ContextThreadLocal.java
+++ /dev/null
@@ -1,48 +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.skywalking.apm.plugin.shardingsphere.v41.threadlocal;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-/**
- * Context thread local for skywalking.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ContextThreadLocal {
-
- private static ThreadLocal<Map<String, Object>> CONTEXT_DATA_MAP =
ThreadLocal.withInitial(LinkedHashMap::new);
-
- /**
- * Get value.
- *
- * @return data map
- */
- public static Map<String, Object> getValue() {
- return CONTEXT_DATA_MAP.get();
- }
-
- /**
- * remove for thread local for gc.
- */
- public static void remove() {
- CONTEXT_DATA_MAP.remove();
- }
-}
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java
new file mode 100644
index 0000000..c44965a
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java
@@ -0,0 +1,29 @@
+/*
+ * 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.skywalking.apm.plugin.shardingsphere.v4rc3.define;
+
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+public abstract class AbstractShardingSphereV4R3Instrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+ public static final String WITHNESS_CLASSES =
"org.apache.shardingsphere.core.route.router.sharding.ShardingRouter";
+
+ @Override
+ protected final String[] witnessClasses() {
+ return new String[] {WITHNESS_CLASSES};
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java
index 1ffddf2..7ca76d0 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link ExecuteInstrumentation} presents that skywalking intercepts {@link
org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback}.
*/
-public class ExecuteInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class ExecuteInstrumentation extends
AbstractShardingSphereV4R3Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java
index 74126f7..5c8c15a 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -32,7 +31,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
* {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts
{@link
* org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
*/
-public class JDBCRootInvokeInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class JDBCRootInvokeInstrumentation extends
AbstractShardingSphereV4R3Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java
index 84762ad..80c6311 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* ProxyRootInvokeInstrumentation presents that skywalking intercepts
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.
*/
-public class ProxyRootInvokeInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class ProxyRootInvokeInstrumentation extends
AbstractShardingSphereV4R3Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java
new file mode 100644
index 0000000..aadb174
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java
@@ -0,0 +1,29 @@
+/*
+ * 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.skywalking.apm.plugin.shardingsphere.v4.define;
+
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+public abstract class AbstractShardingSphereV4Instrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+ public static final String WITHNESS_CLASSES =
"org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter";
+
+ @Override
+ protected final String[] witnessClasses() {
+ return new String[] {WITHNESS_CLASSES};
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java
index 97e091b..394e212 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link ExecuteInstrumentation} presents that skywalking intercepts {@link
org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback}.
*/
-public class ExecuteInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class ExecuteInstrumentation extends
AbstractShardingSphereV4Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java
index 04f67f7..bfd9deb 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -32,7 +31,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
* {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts
{@link
* org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
*/
-public class JDBCRootInvokeInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class JDBCRootInvokeInstrumentation extends
AbstractShardingSphereV4Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";
diff --git
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java
index 6270f2e..062c6d8 100644
---
a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java
@@ -22,7 +22,6 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
-import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
@@ -31,7 +30,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* ProxyRootInvokeInstrumentation presents that skywalking intercepts
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.
*/
-public class ProxyRootInvokeInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class ProxyRootInvokeInstrumentation extends
AbstractShardingSphereV4Instrumentation {
private static final String ENHANCE_CLASS =
"org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask";
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md
b/docs/en/setup/service-agent/java-agent/Supported-list.md
index 467e3cd..1047985 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -30,7 +30,7 @@
* Oracle Driver (Optional¹)
* H2 Driver 1.3.x -> 1.4.x
* [Sharding-JDBC](https://github.com/shardingjdbc/sharding-jdbc) 1.5.x
- * [ShardingSphere](https://github.com/apache/shardingsphere) 3.0.0,
4.0.0-RC1, 4.0.0 -> 4.1.1
+ * [ShardingSphere](https://github.com/apache/shardingsphere) 3.0.0,
4.0.0-RC1, 4.1.0, 4.1.1
* PostgreSQL Driver 8.x, 9.x, 42.x
* Mariadb Driver 2.x, 1.8
* RPC Frameworks
diff --git a/test/plugin/scenarios/shardingsphere-4.x-scenario/pom.xml
b/test/plugin/scenarios/shardingsphere-4.x-scenario/pom.xml
index 31bfe95..0aaa872 100644
--- a/test/plugin/scenarios/shardingsphere-4.x-scenario/pom.xml
+++ b/test/plugin/scenarios/shardingsphere-4.x-scenario/pom.xml
@@ -29,7 +29,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <test.framework.version>[4.0.0, 4.1.1]</test.framework.version>
+ <test.framework.version>4.1.0</test.framework.version>
<log4j.version>2.6.2</log4j.version>
<spring.version>4.3.8.RELEASE</spring.version>
@@ -48,9 +48,9 @@
<version>${test.framework.version}</version>
</dependency>
<dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.4</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git
a/test/plugin/scenarios/shardingsphere-4.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java
b/test/plugin/scenarios/shardingsphere-4.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java
index dae97c4..530e7b5 100644
---
a/test/plugin/scenarios/shardingsphere-4.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java
+++
b/test/plugin/scenarios/shardingsphere-4.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java
@@ -18,13 +18,14 @@
package
org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config;
+import org.apache.commons.dbcp2.BasicDataSource;
+
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
-import org.apache.commons.dbcp.BasicDataSource;
public class DataSourceUtil {
diff --git
a/test/plugin/scenarios/shardingsphere-4.x-scenario/support-version.list
b/test/plugin/scenarios/shardingsphere-4.x-scenario/support-version.list
index ad03f53..b88e756 100644
--- a/test/plugin/scenarios/shardingsphere-4.x-scenario/support-version.list
+++ b/test/plugin/scenarios/shardingsphere-4.x-scenario/support-version.list
@@ -14,7 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-4.0.0
-4.0.1
4.1.0
-4.1.1
\ No newline at end of file
+4.1.1