PossibleFound represents a value, which may exist or not.
+ * The PossibleFound represents a value, which may needEnhance or not.
*
* @author wusheng
*/
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/AbstractClassEnhancePluginDefine.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/AbstractClassEnhancePluginDefine.java
index 008d49e8b..87b573d2b 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/AbstractClassEnhancePluginDefine.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/AbstractClassEnhancePluginDefine.java
@@ -2,6 +2,7 @@ package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.dynamic.DynamicType;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
@@ -65,9 +66,9 @@ public abstract class AbstractClassEnhancePluginDefine {
/**
* Define the classname of target class.
*
- * @return class full name.
+ * @return {@link ClassMatch}
*/
- protected abstract String enhanceClassName();
+ protected abstract ClassMatch enhanceClass();
/**
* Witness classname list. Why need witness classname? Let's see like this: A library existed two released versions
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginFinder.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginFinder.java
index 45ce1d5b5..baeffb06a 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginFinder.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginFinder.java
@@ -1,46 +1,89 @@
package org.skywalking.apm.agent.core.plugin;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import net.bytebuddy.description.NamedElement;
+import net.bytebuddy.description.annotation.AnnotationDescription;
+import net.bytebuddy.description.annotation.AnnotationList;
+import net.bytebuddy.description.type.TypeDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.skywalking.apm.agent.core.plugin.bytebuddy.judge.AbstractJunction;
+import org.skywalking.apm.agent.core.plugin.match.AnnotationMatch;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
+import org.skywalking.apm.agent.core.plugin.match.NameMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.isInterface;
+import static net.bytebuddy.matcher.ElementMatchers.not;
/**
* The PluginFinder represents a finder , which assist to find the one
- * from the given {@link AbstractClassEnhancePluginDefine} list, by name match.
+ * from the given {@link AbstractClassEnhancePluginDefine} list.
*
* @author wusheng
*/
public class PluginFinder {
- private final Map
- * Created by wusheng on 16/7/31.
- */
-public class SkyWalkingEnhanceMatcheroracle.jdbc.OracleDriver
* .
@@ -8,7 +12,7 @@ package org.skywalking.apm.plugin.jdbc.define;
*/
public class OracleInstrumentation extends AbstractDatabaseInstrumentation {
@Override
- protected String enhanceClassName() {
- return "oracle.jdbc.driver.OracleDriver";
+ protected ClassMatch enhanceClass() {
+ return byName("oracle.jdbc.driver.OracleDriver");
}
}
diff --git a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisClusterInstrumentation.java b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisClusterInstrumentation.java
index 5a9ebd9f3..5e928d02d 100644
--- a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisClusterInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisClusterInstrumentation.java
@@ -6,6 +6,7 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.jedis.v2.JedisClusterConstructorWithHostAndPortArgInterceptor;
import org.skywalking.apm.plugin.jedis.v2.JedisClusterConstructorWithListHostAndPortArgInterceptor;
import org.skywalking.apm.plugin.jedis.v2.JedisMethodInterceptor;
@@ -13,6 +14,7 @@ import org.skywalking.apm.plugin.jedis.v2.RedisMethodMatch;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static org.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link JedisClusterInstrumentation} presents that skywalking intercepts all constructors and methods of {@link
@@ -32,8 +34,8 @@ public class JedisClusterInstrumentation extends ClassInstanceMethodsEnhancePlug
private static final String CONSTRUCTOR_WITH_HOSTANDPORT_ARG_INTERCEPT_CLASS = "org.skywalking.apm.plugin.jedis.v2.JedisClusterConstructorWithHostAndPortArgInterceptor";
@Override
- public String enhanceClassName() {
- return ENHANCE_CLASS;
+ public ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisInstrumentation.java b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisInstrumentation.java
index 93e14fc4d..9a9e24cb5 100644
--- a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jedis/v2/define/JedisInstrumentation.java
@@ -6,6 +6,7 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.jedis.v2.JedisConstructorWithShardInfoArgInterceptor;
import org.skywalking.apm.plugin.jedis.v2.JedisConstructorWithUriArgInterceptor;
import org.skywalking.apm.plugin.jedis.v2.JedisMethodInterceptor;
@@ -13,6 +14,7 @@ import org.skywalking.apm.plugin.jedis.v2.RedisMethodMatch;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static org.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link JedisInstrumentation} presents that skywalking intercept all constructors and methods of {@link
@@ -34,8 +36,8 @@ public class JedisInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
private static final String JEDIS_METHOD_INTERCET_CLASS = "org.skywalking.apm.plugin.jedis.v2.JedisMethodInterceptor";
@Override
- public String enhanceClassName() {
- return ENHANCE_CLASS;
+ public ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-3.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v3/define/MongoDBInstrumentation.java b/apm-sniffer/apm-sdk-plugin/mongodb-3.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v3/define/MongoDBInstrumentation.java
index 5dba13495..9ce9154cd 100644
--- a/apm-sniffer/apm-sdk-plugin/mongodb-3.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v3/define/MongoDBInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/mongodb-3.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v3/define/MongoDBInstrumentation.java
@@ -6,9 +6,11 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
public class MongoDBInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
@@ -56,8 +58,8 @@ public class MongoDBInstrumentation extends ClassInstanceMethodsEnhancePluginDef
}
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
}
diff --git a/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanConsumerInstrumentation.java b/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanConsumerInstrumentation.java
index 4eb8b5334..8b73b6873 100644
--- a/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanConsumerInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanConsumerInstrumentation.java
@@ -5,13 +5,15 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.motan.MotanProviderInterceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
- * {@link MotanConsumerInstrumentation} presents that skywalking intercept
- * {@link com.weibo.api.motan.cluster.support.ClusterSpi#call(com.weibo.api.motan.rpc.Request)} by using {@link MotanProviderInterceptor}.
+ * {@link MotanConsumerInstrumentation} presents that skywalking intercept {@link com.weibo.api.motan.cluster.support.ClusterSpi#call(com.weibo.api.motan.rpc.Request)}
+ * by using {@link MotanProviderInterceptor}.
*
* @author zhangxin
*/
@@ -22,8 +24,8 @@ public class MotanConsumerInstrumentation extends ClassInstanceMethodsEnhancePlu
private static final String INVOKE_INTERCEPT_CLASS = "org.skywalking.apm.plugin.motan.MotanProviderInterceptor";
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanProviderInstrumentation.java b/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanProviderInstrumentation.java
index 1b54709a2..756684ff8 100644
--- a/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanProviderInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/motan-plugin/src/main/java/org/skywalking/apm/plugin/motan/define/MotanProviderInstrumentation.java
@@ -6,10 +6,12 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.motan.MotanConsumerInterceptor;
import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link MotanProviderInstrumentation} presents that skywalking will use
@@ -35,8 +37,8 @@ public class MotanProviderInstrumentation extends ClassInstanceMethodsEnhancePlu
private static final String PROVIDER_INVOKE_INTERCEPT_CLASS = "org.skywalking.apm.plugin.motan.MotanConsumerInterceptor";
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-sdk-plugin/okhttp-3.x-plugin/src/main/java/org/skywalking/apm/plugin/okhttp/v3/define/RealCallInstrumentation.java b/apm-sniffer/apm-sdk-plugin/okhttp-3.x-plugin/src/main/java/org/skywalking/apm/plugin/okhttp/v3/define/RealCallInstrumentation.java
index c7c14bb5e..0ce9f4182 100644
--- a/apm-sniffer/apm-sdk-plugin/okhttp-3.x-plugin/src/main/java/org/skywalking/apm/plugin/okhttp/v3/define/RealCallInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/okhttp-3.x-plugin/src/main/java/org/skywalking/apm/plugin/okhttp/v3/define/RealCallInstrumentation.java
@@ -7,10 +7,12 @@ import okhttp3.Request;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.okhttp.v3.RealCallInterceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link RealCallInstrumentation} presents that skywalking intercepts {@link okhttp3.RealCall#RealCall(OkHttpClient,
@@ -30,8 +32,8 @@ public class RealCallInstrumentation extends ClassInstanceMethodsEnhancePluginDe
*/
private static final String INTERCEPT_CLASS = "org.skywalking.apm.plugin.okhttp.v3.RealCallInterceptor";
- @Override protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ @Override protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
diff --git a/apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v3/define/ResinV3Instrumentation.java b/apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v3/define/ResinV3Instrumentation.java
index cc5a2ff84..59cd95fb2 100644
--- a/apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v3/define/ResinV3Instrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v3/define/ResinV3Instrumentation.java
@@ -5,9 +5,11 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.resin.v3.ResinV3Interceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link ResinV3Instrumentation} presents that skywalking intercepts {@link com.caucho.server.dispatch.ServletInvocation#service(javax.servlet.ServletRequest,
@@ -49,8 +51,8 @@ public class ResinV3Instrumentation extends ClassInstanceMethodsEnhancePluginDef
}
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v4/define/ResinV4Instrumentation.java b/apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v4/define/ResinV4Instrumentation.java
index e54559cc7..ac6fd8e3a 100644
--- a/apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v4/define/ResinV4Instrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v4/define/ResinV4Instrumentation.java
@@ -5,9 +5,11 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.resin.v4.ResinV4Interceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link ResinV4Instrumentation} presents that skywalking intercepts {@link com.caucho.server.dispatch.ServletInvocation#service(javax.servlet.ServletRequest,
@@ -48,8 +50,8 @@ public class ResinV4Instrumentation extends ClassInstanceMethodsEnhancePluginDef
}
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/skywalking/apm/plugin/tomcat78x/define/TomcatInstrumentation.java b/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/skywalking/apm/plugin/tomcat78x/define/TomcatInstrumentation.java
index 419c579fc..971aa5126 100644
--- a/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/skywalking/apm/plugin/tomcat78x/define/TomcatInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/skywalking/apm/plugin/tomcat78x/define/TomcatInstrumentation.java
@@ -7,9 +7,11 @@ import org.apache.catalina.connector.Response;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.skywalking.apm.plugin.tomcat78x.TomcatInterceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link TomcatInstrumentation} presents that skywalking using class {@link TomcatInterceptor} to
@@ -30,8 +32,8 @@ public class TomcatInstrumentation extends ClassInstanceMethodsEnhancePluginDefi
private static final String INTERCEPT_CLASS = "org.skywalking.apm.plugin.tomcat78x.TomcatInterceptor";
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v1/x/TraceIdPatternConverterActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v1/x/TraceIdPatternConverterActivation.java
index 44ac68d9b..f9252dd6c 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v1/x/TraceIdPatternConverterActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v1/x/TraceIdPatternConverterActivation.java
@@ -5,8 +5,10 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* Active the toolkit class "org.skywalking.apm.toolkit.log.log4j.v1.x.TraceIdPatternConverter".
@@ -21,8 +23,8 @@ public class TraceIdPatternConverterActivation extends ClassInstanceMethodsEnhan
* @return the target class, which needs active.
*/
@Override
- protected String enhanceClassName() {
- return "org.skywalking.apm.toolkit.log.log4j.v1.x.TraceIdPatternConverter";
+ protected ClassMatch enhanceClass() {
+ return byName("org.skywalking.apm.toolkit.log.log4j.v1.x.TraceIdPatternConverter");
}
/**
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-2.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v2/x/Log4j2OutputAppenderActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-2.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v2/x/Log4j2OutputAppenderActivation.java
index 87a625252..0156de32f 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-2.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v2/x/Log4j2OutputAppenderActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-2.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/log4j/v2/x/Log4j2OutputAppenderActivation.java
@@ -4,8 +4,10 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* Active the toolkit class "org.skywalking.apm.toolkit.log.logback.v2.x.LogbackPatternConverter".
@@ -20,8 +22,8 @@ public class Log4j2OutputAppenderActivation extends ClassStaticMethodsEnhancePlu
* @return the target class, which needs active.
*/
@Override
- protected String enhanceClassName() {
- return "org.skywalking.apm.toolkit.log.log4j.v2.x.Log4j2OutputAppender";
+ protected ClassMatch enhanceClass() {
+ return byName("org.skywalking.apm.toolkit.log.log4j.v2.x.Log4j2OutputAppender");
}
/**
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-logback-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/logback/v1/x/LogbackPatternConverterActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-logback-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/logback/v1/x/LogbackPatternConverterActivation.java
index fb43918f8..b9db5ce9d 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-logback-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/logback/v1/x/LogbackPatternConverterActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-logback-1.x-activation/src/main/java/org/skywalking/apm/toolkit/activation/log/logback/v1/x/LogbackPatternConverterActivation.java
@@ -6,8 +6,10 @@ import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoin
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* Active the toolkit class "org.skywalking.apm.toolkit.log.logback.v1.x.LogbackPatternConverter".
@@ -22,8 +24,8 @@ public class LogbackPatternConverterActivation extends ClassInstanceMethodsEnhan
* @return the target class, which needs active.
*/
@Override
- protected String enhanceClassName() {
- return "org.skywalking.apm.toolkit.log.logback.v1.x.LogbackPatternConverter";
+ protected ClassMatch enhanceClass() {
+ return byName("org.skywalking.apm.toolkit.log.logback.v1.x.LogbackPatternConverter");
}
/**
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/continuation/SkywalkingContinuationActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/continuation/SkywalkingContinuationActivation.java
index 45bf3a538..eb09593d5 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/continuation/SkywalkingContinuationActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/continuation/SkywalkingContinuationActivation.java
@@ -5,9 +5,11 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link SkywalkingContinuationActivation} defines two interceptors to enhance the methods and constructor in class
@@ -26,8 +28,8 @@ public class SkywalkingContinuationActivation extends ClassInstanceMethodsEnhanc
private static final String ACTIVATE_METHOD_INTERCEPTOR = "org.skywalking.apm.toolkit.activation.opentracing.continuation.ActivateInterceptor";
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/span/SkywalkingSpanActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/span/SkywalkingSpanActivation.java
index 6d1a5daeb..e68396cc8 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/span/SkywalkingSpanActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/span/SkywalkingSpanActivation.java
@@ -6,10 +6,12 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static org.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link SkywalkingSpanActivation} defines five interceptors to enhance the methods and constructor in class
@@ -48,8 +50,8 @@ public class SkywalkingSpanActivation extends ClassInstanceMethodsEnhancePluginD
private static final String SET_OPERATION_NAME_INTERCEPTOR = "org.skywalking.apm.toolkit.activation.opentracing.span.SpanSetOperationNameInterceptor";
@Override
- protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/tracer/SkywalkingTracerActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/tracer/SkywalkingTracerActivation.java
index eb7dfb68a..5f3899728 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/tracer/SkywalkingTracerActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/main/java/org/skywalking/apm/toolkit/activation/opentracing/tracer/SkywalkingTracerActivation.java
@@ -5,8 +5,10 @@ import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link SkywalkingTracerActivation} defines two interceptors to enhance the methods in
@@ -24,8 +26,8 @@ public class SkywalkingTracerActivation extends ClassInstanceMethodsEnhancePlugi
private static final String INJECT_INTERCEPTOR = "org.skywalking.apm.toolkit.activation.opentracing.tracer.SkywalkingTracerInjectInterceptor";
private static final String EXTRACT_INTERCEPTOR = "org.skywalking.apm.toolkit.activation.opentracing.tracer.SkywalkingTracerExtractInterceptor";
- @Override protected String enhanceClassName() {
- return ENHANCE_CLASS;
+ @Override protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
}
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-context-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-context-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextActivation.java
index b4e355c5b..de543a902 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-context-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-context-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextActivation.java
@@ -4,8 +4,10 @@ import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
+import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* Active the toolkit class "org.skywalking.apm.toolkit.trace.TraceContext".
@@ -20,8 +22,8 @@ public class TraceContextActivation extends ClassStaticMethodsEnhancePluginDefin
* @return the target class, which needs active.
*/
@Override
- protected String enhanceClassName() {
- return "org.skywalking.apm.toolkit.trace.TraceContext";
+ protected ClassMatch enhanceClass() {
+ return byName("org.skywalking.apm.toolkit.trace.TraceContext");
}
/**