Support plugin match by annotation, can’t by interface yet. #281
This commit is contained in:
parent
64435c3e39
commit
103469256f
|
|
@ -83,7 +83,7 @@ public class SnifferConfigInitializer {
|
|||
/**
|
||||
* Load the config file by the path, which is provided by system property, usually with a "-DconfigPath=" arg.
|
||||
*
|
||||
* @return the config file {@link InputStream}, or null if not exist.
|
||||
* @return the config file {@link InputStream}, or null if not needEnhance.
|
||||
*/
|
||||
private static InputStream loadConfigBySystemProperty() {
|
||||
String configPath = System.getProperty("configPath");
|
||||
|
|
@ -107,7 +107,7 @@ public class SnifferConfigInitializer {
|
|||
/**
|
||||
* Load the config file, where the agent jar is.
|
||||
*
|
||||
* @return the config file {@link InputStream}, or null if not exist.
|
||||
* @return the config file {@link InputStream}, or null if not needEnhance.
|
||||
*/
|
||||
private static InputStream loadConfigFromAgentFolder() {
|
||||
String agentBasePath = initAgentBasePath();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public interface AbstractTracerContext {
|
|||
void continued(ContextSnapshot snapshot);
|
||||
|
||||
/**
|
||||
* Get the global trace id, if exist.
|
||||
* Get the global trace id, if needEnhance.
|
||||
* How to build, depends on the implementation.
|
||||
*
|
||||
* @return the string represents the id.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ContextManager implements TracingContextListener, BootService, Igno
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the first global trace id if exist. Otherwise, "N/A".
|
||||
* @return the first global trace id if needEnhance. Otherwise, "N/A".
|
||||
*/
|
||||
public static String getGlobalTraceId() {
|
||||
AbstractTracerContext segment = CONTEXT.get();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.skywalking.apm.agent.core.dictionary;
|
||||
|
||||
/**
|
||||
* The <code>PossibleFound</code> represents a value, which may exist or not.
|
||||
* The <code>PossibleFound</code> represents a value, which may needEnhance or not.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <code>PluginFinder</code> 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<String, LinkedList<AbstractClassEnhancePluginDefine>> pluginDefineMap = new HashMap<String, LinkedList<AbstractClassEnhancePluginDefine>>();
|
||||
private final Map<String, AbstractClassEnhancePluginDefine> nameMatchDefine = new HashMap<String, AbstractClassEnhancePluginDefine>();
|
||||
private final List<AbstractClassEnhancePluginDefine> signatureMatchDefine = new LinkedList<AbstractClassEnhancePluginDefine>();
|
||||
|
||||
public PluginFinder(List<AbstractClassEnhancePluginDefine> plugins) {
|
||||
for (AbstractClassEnhancePluginDefine plugin : plugins) {
|
||||
String enhanceClassName = plugin.enhanceClassName();
|
||||
ClassMatch match = plugin.enhanceClass();
|
||||
|
||||
if (enhanceClassName == null) {
|
||||
if (match == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LinkedList<AbstractClassEnhancePluginDefine> pluginDefinesWithSameTarget = pluginDefineMap.get(enhanceClassName);
|
||||
if (pluginDefinesWithSameTarget == null) {
|
||||
pluginDefinesWithSameTarget = new LinkedList<AbstractClassEnhancePluginDefine>();
|
||||
pluginDefineMap.put(enhanceClassName, pluginDefinesWithSameTarget);
|
||||
if (match instanceof NameMatch) {
|
||||
NameMatch nameMatch = (NameMatch)match;
|
||||
nameMatchDefine.put(nameMatch.getClassName(), plugin);
|
||||
} else {
|
||||
signatureMatchDefine.add(plugin);
|
||||
}
|
||||
|
||||
pluginDefinesWithSameTarget.add(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
public List<AbstractClassEnhancePluginDefine> find(String enhanceClassName) {
|
||||
if (pluginDefineMap.containsKey(enhanceClassName)) {
|
||||
return pluginDefineMap.get(enhanceClassName);
|
||||
public AbstractClassEnhancePluginDefine find(TypeDescription typeDescription,
|
||||
ClassLoader classLoader) {
|
||||
String typeName = typeDescription.getTypeName();
|
||||
if (nameMatchDefine.containsKey(typeName)) {
|
||||
return nameMatchDefine.get(typeName);
|
||||
}
|
||||
|
||||
throw new PluginException("Can not find plugin:" + enhanceClassName);
|
||||
for (AbstractClassEnhancePluginDefine pluginDefine : signatureMatchDefine) {
|
||||
ClassMatch classMatch = pluginDefine.enhanceClass();
|
||||
if (classMatch instanceof AnnotationMatch) {
|
||||
AnnotationMatch annotationMatch = (AnnotationMatch)classMatch;
|
||||
List<String> annotationList = Arrays.asList(annotationMatch.getAnnotations());
|
||||
AnnotationList declaredAnnotations = typeDescription.getDeclaredAnnotations();
|
||||
for (AnnotationDescription annotation : declaredAnnotations) {
|
||||
annotationList.remove(annotation.getAnnotationType().getActualName());
|
||||
}
|
||||
if (annotationList.isEmpty()) {
|
||||
return pluginDefine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean exist(String enhanceClassName) {
|
||||
return pluginDefineMap.containsKey(enhanceClassName);
|
||||
public ElementMatcher<? super TypeDescription> buildMatch() {
|
||||
ElementMatcher.Junction judge = new AbstractJunction<NamedElement>() {
|
||||
@Override
|
||||
public boolean matches(NamedElement target) {
|
||||
return nameMatchDefine.containsKey(target.getActualName());
|
||||
}
|
||||
};
|
||||
judge = judge.and(not(isInterface()));
|
||||
for (AbstractClassEnhancePluginDefine define : signatureMatchDefine) {
|
||||
ClassMatch match = define.enhanceClass();
|
||||
if (match instanceof AnnotationMatch) {
|
||||
judge = judge.or(((AnnotationMatch)match).buildJunction());
|
||||
}
|
||||
}
|
||||
return judge;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
package org.skywalking.apm.agent.core.plugin;
|
||||
|
||||
import net.bytebuddy.ByteBuddy;
|
||||
import net.bytebuddy.dynamic.ClassFileLocator;
|
||||
import net.bytebuddy.dynamic.DynamicType;
|
||||
import net.bytebuddy.dynamic.TypeResolutionStrategy;
|
||||
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
|
||||
import net.bytebuddy.pool.TypePool;
|
||||
import org.skywalking.apm.logging.ILog;
|
||||
import org.skywalking.apm.logging.LogManager;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A test entrance for enhancing class.
|
||||
* This should be used only in bytecode-manipulate test.
|
||||
* And make sure, all classes which need to be enhanced, must not be loaded.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class TracingBootstrap {
|
||||
private static final ILog logger = LogManager.getLogger(TracingBootstrap.class);
|
||||
|
||||
private TracingBootstrap() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entrance for testing.
|
||||
*
|
||||
* @param args includes target classname ( which exists "public static void main(String[] args)" ) and arguments
|
||||
* list.
|
||||
* @throws PluginException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws NoSuchMethodException
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
throws PluginException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
|
||||
IllegalAccessException {
|
||||
if (args.length == 0) {
|
||||
throw new RuntimeException("bootstrap failure. need args[0] to be main class.");
|
||||
}
|
||||
|
||||
List<AbstractClassEnhancePluginDefine> plugins = null;
|
||||
|
||||
try {
|
||||
PluginBootstrap bootstrap = new PluginBootstrap();
|
||||
plugins = bootstrap.loadPlugins();
|
||||
} catch (Throwable t) {
|
||||
logger.error("PluginBootstrap start failure.", t);
|
||||
}
|
||||
|
||||
for (AbstractClassEnhancePluginDefine plugin : plugins) {
|
||||
String enhanceClassName = plugin.enhanceClassName();
|
||||
TypePool.Resolution resolution = TypePool.Default.ofClassPath().describe(enhanceClassName);
|
||||
if (!resolution.isResolved()) {
|
||||
logger.error("Failed to resolve the class " + enhanceClassName, null);
|
||||
continue;
|
||||
}
|
||||
DynamicType.Builder<?> newClassBuilder =
|
||||
new ByteBuddy().rebase(resolution.resolve(), ClassFileLocator.ForClassLoader.ofClassPath());
|
||||
newClassBuilder = ((AbstractClassEnhancePluginDefine)plugin).define(enhanceClassName, newClassBuilder, TracingBootstrap.class.getClassLoader());
|
||||
newClassBuilder.make(new TypeResolutionStrategy.Active()).load(ClassLoader.getSystemClassLoader(), ClassLoadingStrategy.Default.INJECTION)
|
||||
.getLoaded();
|
||||
}
|
||||
|
||||
String[] newArgs = Arrays.copyOfRange(args, 1, args.length);
|
||||
|
||||
Class.forName(args[0]).getMethod("main", String[].class).invoke(null, new Object[] {newArgs});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.skywalking.apm.agent.junction;
|
||||
package org.skywalking.apm.agent.core.plugin.bytebuddy.judge;
|
||||
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package org.skywalking.apm.agent.core.plugin.match;
|
||||
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
public class AnnotationMatch extends ClassMatch {
|
||||
private String[] annotations;
|
||||
|
||||
public AnnotationMatch(String[] annotations) {
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
public ElementMatcher.Junction buildJunction() {
|
||||
ElementMatcher.Junction junction = null;
|
||||
for (String annotation : annotations) {
|
||||
if (junction == null) {
|
||||
junction = buildEachAnnotation(annotation);
|
||||
} else {
|
||||
junction = junction.and(buildEachAnnotation(annotation));
|
||||
}
|
||||
}
|
||||
junction = junction.and(not(isInterface()));
|
||||
return junction;
|
||||
}
|
||||
|
||||
private ElementMatcher.Junction buildEachAnnotation(String annotationName) {
|
||||
return isAnnotatedWith(named(annotationName));
|
||||
}
|
||||
|
||||
public String[] getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package org.skywalking.apm.agent.core.plugin.match;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
public abstract class ClassMatch {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package org.skywalking.apm.agent.core.plugin.match;
|
||||
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
public class HierarchyMatch extends ClassMatch {
|
||||
private String[] parentTypes;
|
||||
|
||||
public HierarchyMatch(String[] parentTypes) {
|
||||
this.parentTypes = parentTypes;
|
||||
}
|
||||
|
||||
public ElementMatcher.Junction buildJunction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private ElementMatcher.Junction buildEachParent(String parentType) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.skywalking.apm.agent.core.plugin.match;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
public class NameMatch extends ClassMatch {
|
||||
private String className;
|
||||
|
||||
public NameMatch(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public static NameMatch byName(String className) {
|
||||
return new NameMatch(className);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
package org.skywalking.apm.agent;
|
||||
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.util.List;
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.description.NamedElement;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.dynamic.DynamicType;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import net.bytebuddy.utility.JavaModule;
|
||||
import org.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.skywalking.apm.agent.core.conf.SnifferConfigInitializer;
|
||||
|
|
@ -15,13 +12,9 @@ import org.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine;
|
|||
import org.skywalking.apm.agent.core.plugin.PluginBootstrap;
|
||||
import org.skywalking.apm.agent.core.plugin.PluginException;
|
||||
import org.skywalking.apm.agent.core.plugin.PluginFinder;
|
||||
import org.skywalking.apm.agent.junction.SkyWalkingEnhanceMatcher;
|
||||
import org.skywalking.apm.logging.ILog;
|
||||
import org.skywalking.apm.logging.LogManager;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||
|
||||
/**
|
||||
* The main entrance of sky-waking agent,
|
||||
* based on javaagent mechanism.
|
||||
|
|
@ -51,19 +44,20 @@ public class SkyWalkingAgent {
|
|||
|
||||
ServiceManager.INSTANCE.boot();
|
||||
|
||||
new AgentBuilder.Default().type(enhanceClassMatcher(pluginFinder).and(not(isInterface()))).transform(new AgentBuilder.Transformer() {
|
||||
new AgentBuilder.Default().type(pluginFinder.buildMatch()).transform(new AgentBuilder.Transformer() {
|
||||
@Override
|
||||
public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription,
|
||||
ClassLoader classLoader, JavaModule module) {
|
||||
List<AbstractClassEnhancePluginDefine> pluginDefines = pluginFinder.find(typeDescription.getTypeName());
|
||||
for (AbstractClassEnhancePluginDefine pluginDefine : pluginDefines) {
|
||||
AbstractClassEnhancePluginDefine pluginDefine = pluginFinder.find(typeDescription, classLoader);
|
||||
if (pluginDefine != null) {
|
||||
DynamicType.Builder<?> newBuilder = pluginDefine.define(typeDescription.getTypeName(), builder, classLoader);
|
||||
if (newBuilder != null) {
|
||||
logger.debug("Finish the prepare stage for {}.", typeDescription.getName());
|
||||
return newBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
logger.warn("Matched class {}, but enhancement fails.", typeDescription.getTypeName());
|
||||
logger.debug("Matched class {}, but ignore by finding mechanism.", typeDescription.getTypeName());
|
||||
return builder;
|
||||
}
|
||||
}).with(new AgentBuilder.Listener() {
|
||||
|
|
@ -96,15 +90,4 @@ public class SkyWalkingAgent {
|
|||
}
|
||||
}).installOn(instrumentation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enhance target classes matcher.
|
||||
*
|
||||
* @param pluginFinder
|
||||
* @param <T>
|
||||
* @return class matcher.
|
||||
*/
|
||||
private static <T extends NamedElement> ElementMatcher.Junction<T> enhanceClassMatcher(PluginFinder pluginFinder) {
|
||||
return new SkyWalkingEnhanceMatcher<T>(pluginFinder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
package org.skywalking.apm.agent.junction;
|
||||
|
||||
import net.bytebuddy.description.NamedElement;
|
||||
import org.skywalking.apm.agent.core.plugin.PluginFinder;
|
||||
|
||||
/**
|
||||
* The matcher bases on byte-buddy {@link AbstractJunction} class.
|
||||
* Judge the target class in transforming, should be enhanced or not.
|
||||
* <p>
|
||||
* Created by wusheng on 16/7/31.
|
||||
*/
|
||||
public class SkyWalkingEnhanceMatcher<T extends NamedElement> extends AbstractJunction<T> {
|
||||
|
||||
private final PluginFinder pluginFinder;
|
||||
|
||||
public SkyWalkingEnhanceMatcher(PluginFinder pluginFinder) {
|
||||
this.pluginFinder = pluginFinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(T target) {
|
||||
return pluginFinder.exist(target.getActualName());
|
||||
}
|
||||
}
|
||||
|
|
@ -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 DubboInstrumentation} presents that skywalking intercepts {@link com.alibaba.dubbo.monitor.support.MonitorFilter#invoke(com.alibaba.dubbo.rpc.Invoker,
|
||||
|
|
@ -20,8 +22,8 @@ public class DubboInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
private static final String INTERCEPT_CLASS = "org.skywalking.apm.plugin.dubbo.DubboInterceptor";
|
||||
|
||||
@Override
|
||||
protected String enhanceClassName() {
|
||||
return ENHANCE_CLASS;
|
||||
protected ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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.feign.http.v9.DefaultHttpClientInterceptor;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
/**
|
||||
* {@link DefaultHttpClientInstrumentation} presents that skywalking intercepts {@link
|
||||
|
|
@ -29,8 +31,8 @@ public class DefaultHttpClientInstrumentation extends ClassInstanceMethodsEnhanc
|
|||
*/
|
||||
private static final String INTERCEPT_CLASS = "org.skywalking.apm.plugin.feign.http.v9.DefaultHttpClientInterceptor";
|
||||
|
||||
@Override protected String enhanceClassName() {
|
||||
return ENHANCE_CLASS;
|
||||
@Override protected ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ import org.apache.http.HttpHost;
|
|||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
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 AbstractHttpClientInstrumentation} presents that skywalking intercepts
|
||||
|
|
@ -21,8 +23,8 @@ public class AbstractHttpClientInstrumentation extends HttpClientInstrumentation
|
|||
private static final String ENHANCE_CLASS = "org.apache.http.impl.discovery.AbstractHttpClient";
|
||||
|
||||
@Override
|
||||
public String enhanceClassName() {
|
||||
return ENHANCE_CLASS;
|
||||
public ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package org.skywalking.apm.plugin.httpClient.v4.define;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
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;
|
||||
|
||||
public class DefaultRequestDirectorInstrumentation extends HttpClientInstrumentation {
|
||||
|
||||
|
|
@ -19,8 +21,8 @@ public class DefaultRequestDirectorInstrumentation extends HttpClientInstrumenta
|
|||
* since 4.3, this class is Deprecated.
|
||||
*/
|
||||
@Override
|
||||
public String enhanceClassName() {
|
||||
return ENHANCE_CLASS;
|
||||
public ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMet
|
|||
import org.skywalking.apm.plugin.httpClient.v4.HttpClientExecuteInterceptor;
|
||||
|
||||
/**
|
||||
* {@link HttpClientInstrumentation} present that skywalking intercepts {@link HttpClientInstrumentation#enhanceClassName()}
|
||||
* {@link HttpClientInstrumentation} present that skywalking intercepts {@link HttpClientInstrumentation#enhanceClass()}
|
||||
* by using {@link HttpClientExecuteInterceptor}
|
||||
*
|
||||
* @author zhangxin
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package org.skywalking.apm.plugin.httpClient.v4.define;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
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 AbstractHttpClientInstrumentation} presents that skywalking intercepts {@link
|
||||
|
|
@ -18,8 +20,8 @@ public class InternalHttpClientInstrumentation extends HttpClientInstrumentation
|
|||
private static final String ENHANCE_CLASS = "org.apache.http.impl.discovery.InternalHttpClient";
|
||||
|
||||
@Override
|
||||
public String enhanceClassName() {
|
||||
return ENHANCE_CLASS;
|
||||
public ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ import org.apache.http.HttpHost;
|
|||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
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 AbstractHttpClientInstrumentation} presents that skywalking
|
||||
|
|
@ -21,8 +23,8 @@ public class MinimalHttpClientInstrumentation extends HttpClientInstrumentation
|
|||
private static final String ENHANCE_CLASS = "org.apache.http.impl.discovery.MinimalHttpClient";
|
||||
|
||||
@Override
|
||||
public String enhanceClassName() {
|
||||
return ENHANCE_CLASS;
|
||||
public ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package org.skywalking.apm.plugin.jdbc.define;
|
||||
|
||||
import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
||||
|
||||
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
/**
|
||||
* {@link H2Instrumentation} presents that skywalking intercepts {@link org.h2.Driver}.
|
||||
*
|
||||
|
|
@ -10,7 +14,7 @@ public class H2Instrumentation extends AbstractDatabaseInstrumentation {
|
|||
private static final String CLASS_OF_INTERCEPT_H2_DRIVER = "org.h2.Driver";
|
||||
|
||||
@Override
|
||||
protected String enhanceClassName() {
|
||||
return CLASS_OF_INTERCEPT_H2_DRIVER;
|
||||
protected ClassMatch enhanceClass() {
|
||||
return byName(CLASS_OF_INTERCEPT_H2_DRIVER);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package org.skywalking.apm.plugin.jdbc.define;
|
||||
|
||||
import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
||||
|
||||
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
/**
|
||||
* {@link MysqlInstrumentation} presents that skywalking intercepts {@link com.mysql.jdbc.Driver}.
|
||||
*
|
||||
|
|
@ -7,7 +11,7 @@ package org.skywalking.apm.plugin.jdbc.define;
|
|||
*/
|
||||
public class MysqlInstrumentation extends AbstractDatabaseInstrumentation {
|
||||
@Override
|
||||
protected String enhanceClassName() {
|
||||
return "com.mysql.jdbc.Driver";
|
||||
protected ClassMatch enhanceClass() {
|
||||
return byName("com.mysql.jdbc.Driver");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package org.skywalking.apm.plugin.jdbc.define;
|
||||
|
||||
import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
||||
|
||||
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
/**
|
||||
* {@link OracleInstrumentation} presents that skywalking intercepts the class <code>oracle.jdbc.OracleDriver
|
||||
* </code>.
|
||||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue