This commit is contained in:
wusheng 2017-06-28 22:32:02 +08:00
parent d2f562f1fa
commit 5203081561
78 changed files with 470 additions and 503 deletions

View File

@ -47,7 +47,7 @@
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.5.7</version>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.agent.core.context.tag;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
/**
* The span tags are supported by sky-walking engine.
* As default, all tags will be stored, but these ones have particular meanings.
@ -22,31 +20,6 @@ public final class Tags {
*/
public static final StringTag STATUS_CODE = new StringTag("status_code");
/**
* SPAN_LAYER represents the kind of span.
* <p>
* e.g.
* db=database;
* rpc=Remote Procedure Call Framework, like motan, thift;
* nosql=something like redis/memcache
*/
public static final class SPAN_LAYER {
public static StringTag SPAN_LAYER_TAG = new StringTag("span.layer");
private static final String DB_LAYER = "db";
private static final String RPC_FRAMEWORK_LAYER = "rpc";
private static final String HTTP_LAYER = "http";
private static final String MQ_LAYER = "mq";
}
/**
* COMPONENT is a low-cardinality identifier of the module, library, or package that is instrumented.
* Like dubbo/dubbox/motan
*/
public static final StringTag COMPONENT = new StringTag("component");
/**
* DB_TYPE records database type, such as sql, redis, cassandra and so on.
*/

View File

@ -21,8 +21,10 @@ public interface ConstructorInterceptPoint {
ElementMatcher<MethodDescription> getConstructorMatcher();
/**
* @return represents a class name, the class instance must be a instance of {@link
* org.skywalking.apm.plugin.interceptor.enhance.InstanceConstructorInterceptor}.
* @return represents a class name, the class instance must be a instance of
* {@link org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor}
*/
String getConstructorInterceptor();
boolean isOverrideArgs();
}

View File

@ -1,56 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor;
import org.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Enhanced instance field type.
* <p>
* Any plugins({@link AbstractClassEnhancePluginDefine}'s subclass) override
* {@link ClassEnhancePluginDefine#getConstructorsInterceptPoints}
* or
* {@link ClassEnhancePluginDefine#getInstanceMethodsInterceptPoints}
* will add a field with this type.
*
* @author wusheng
*/
public class EnhancedClassInstanceContext {
/**
* extend field, can store any instance as you want.
*/
private Map<Object, Object> context = new ConcurrentHashMap<Object, Object>();
/**
* store a new instance or override it.
*
* @param key
* @param value
*/
public void set(Object key, Object value) {
context.put(key, value);
}
/**
* get an stored instance, if it is existed.
*
* @param key
* @return null or stored instance.
*/
public Object get(Object key) {
return context.get(key);
}
/**
* judge whether stores by the key.
*
* @param key
* @return true, if stored a instance by the key.
*/
public boolean isContain(Object key) {
return context.containsKey(key);
}
}

View File

@ -24,4 +24,6 @@ public interface InstanceMethodsInterceptPoint {
* @return represents a class name, the class instance must instanceof InstanceMethodsAroundInterceptor.
*/
String getMethodsInterceptor();
boolean isOverrideArgs();
}

View File

@ -21,7 +21,9 @@ public interface StaticMethodsInterceptPoint {
ElementMatcher<MethodDescription> getMethodsMatcher();
/**
* @return represents a class name, the class instance must instanceof {@link org.skywalking.apm.plugin.interceptor.enhance.StaticMethodsAroundInterceptor}.
* @return represents a class name, the class instance must instanceof StaticMethodsAroundInterceptor.
*/
String getMethodsInterceptor();
boolean isOverrideArgs();
}

View File

@ -1,47 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor.assist;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.InterceptorException;
/**
* {@link NoConcurrencyAccessObject} is method invocation counter,
* when {@link #whenEnter(EnhancedClassInstanceContext, InstanceMethodInvokeContext)} , counter + 1;
* and when {@link #whenExist(EnhancedClassInstanceContext)} , counter -1;
* <p>
* When, and only when, the first enter and last exist, also meaning first access,
* the {@link #enter(EnhancedClassInstanceContext, InstanceMethodInvokeContext)}
* and {@link #exit()} are called.
*
* @author wusheng
*/
public abstract class NoConcurrencyAccessObject {
private static final String INVOKE_COUNTER_KEY = "__$invokeCounterKey";
public void whenEnter(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext) {
if (!context.isContain(INVOKE_COUNTER_KEY)) {
context.set(INVOKE_COUNTER_KEY, 0);
}
int counter = (Integer)context.get(INVOKE_COUNTER_KEY);
if (++counter == 1) {
enter(context, interceptorContext);
}
context.set(INVOKE_COUNTER_KEY, counter);
}
public void whenExist(EnhancedClassInstanceContext context) {
if (!context.isContain(INVOKE_COUNTER_KEY)) {
throw new InterceptorException(
"key=INVOKE_COUNTER_KEY not found is context. unexpected situation.");
}
int counter = (Integer)context.get(INVOKE_COUNTER_KEY);
if (--counter == 0) {
exit();
}
context.set(INVOKE_COUNTER_KEY, counter);
}
protected abstract void enter(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext);
protected abstract void exit();
}

View File

@ -5,11 +5,11 @@ import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.SuperMethodCall;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.Morph;
import net.bytebuddy.matcher.ElementMatchers;
import org.skywalking.apm.agent.core.plugin.PluginException;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhanceException;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.util.StringUtil;
@ -19,6 +19,7 @@ import org.skywalking.apm.logging.LogManager;
import static net.bytebuddy.jar.asm.Opcodes.ACC_PRIVATE;
import static net.bytebuddy.matcher.ElementMatchers.isStatic;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.not;
/**
@ -26,7 +27,7 @@ import static net.bytebuddy.matcher.ElementMatchers.not;
* the enhances base on three types interceptor point: {@link ConstructorInterceptPoint}, {@link
* InstanceMethodsInterceptPoint} and {@link StaticMethodsInterceptPoint} If plugin is going to enhance constructors,
* instance methods, or both, {@link ClassEnhancePluginDefine} will add a field of {@link
* EnhancedClassInstanceContext} type.
* Object} type.
*
* @author wusheng
*/
@ -36,19 +37,19 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
/**
* New field name.
*/
public static final String CONTEXT_ATTR_NAME = "_$EnhancedClassInstanceContext";
public static final String CONTEXT_ATTR_NAME = "_$EnhancedClassField_ws";
/**
* Begin to define how to enhance class.
* After invoke this method, only means definition is finished.
*
* @param enhanceOriginClassName target class name
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
* @return new byte-buddy's builder for further manipulation.
*/
@Override
protected DynamicType.Builder<?> enhance(String enhanceOriginClassName,
DynamicType.Builder<?> newClassBuilder) throws PluginException {
DynamicType.Builder<?> newClassBuilder) throws PluginException {
newClassBuilder = this.enhanceClass(enhanceOriginClassName, newClassBuilder);
newClassBuilder = this.enhanceInstance(enhanceOriginClassName, newClassBuilder);
@ -60,11 +61,11 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
* Enhance a class to intercept constructors and class instance methods.
*
* @param enhanceOriginClassName target class name
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
* @return new byte-buddy's builder for further manipulation.
*/
private DynamicType.Builder<?> enhanceInstance(String enhanceOriginClassName,
DynamicType.Builder<?> newClassBuilder) throws PluginException {
DynamicType.Builder<?> newClassBuilder) throws PluginException {
ConstructorInterceptPoint[] constructorInterceptPoints = getConstructorsInterceptPoints();
InstanceMethodsInterceptPoint[] instanceMethodsInterceptPoints = getInstanceMethodsInterceptPoints();
@ -88,23 +89,40 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
* alter class source code.<br/>
*
* new class need:<br/>
* 1.add field '_$EnhancedClassInstanceContext' of type
* 1.add field, name {@link #CONTEXT_ATTR_NAME}, with an {@link Object} reference.
* EnhancedClassInstanceContext <br/>
*
*/
newClassBuilder = newClassBuilder.defineField(CONTEXT_ATTR_NAME, EnhancedClassInstanceContext.class, ACC_PRIVATE);
newClassBuilder = newClassBuilder.defineField(CONTEXT_ATTR_NAME, Object.class, ACC_PRIVATE)
.implement(EnhancedInstance.class)
.method(named("_getSkyWalkingDynamicFiled"))
.intercept(MethodDelegation.to(EnhancedInstanceFieldGetter.class));
/**
* 2. enhance constructors
*/
newClassBuilder = newClassBuilder.constructor(ElementMatchers.<MethodDescription>any()).intercept(SuperMethodCall.INSTANCE
.andThen(MethodDelegation.to(new DefaultClassConstructorInterceptor()).appendParameterBinder(FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class))));
if (existedConstructorInterceptPoint) {
for (ConstructorInterceptPoint constructorInterceptPoint : constructorInterceptPoints) {
newClassBuilder = newClassBuilder.constructor(constructorInterceptPoint.getConstructorMatcher()).intercept(SuperMethodCall.INSTANCE.andThen(
MethodDelegation.to(new ClassConstructorInterceptor(constructorInterceptPoint.getConstructorInterceptor()))
.appendParameterBinder(FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class))));
if (constructorInterceptPoint.isOverrideArgs()) {
newClassBuilder = newClassBuilder.constructor(ElementMatchers.<MethodDescription>any()).intercept(SuperMethodCall.INSTANCE
.andThen(MethodDelegation.withDefaultConfiguration()
.withBinders(
FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class),
Morph.Binder.install(Constructible.class)
)
.to(new ConstructorInter(constructorInterceptPoint.getConstructorInterceptor()))
)
);
} else {
newClassBuilder = newClassBuilder.constructor(ElementMatchers.<MethodDescription>any()).intercept(SuperMethodCall.INSTANCE
.andThen(MethodDelegation.withDefaultConfiguration()
.withBinders(
FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class)
)
.to(new ConstructorInter(constructorInterceptPoint.getConstructorInterceptor()))
)
);
}
}
}
@ -113,15 +131,33 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
*/
if (existedMethodsInterceptPoints) {
for (InstanceMethodsInterceptPoint instanceMethodsInterceptPoint : instanceMethodsInterceptPoints) {
String interceptor = instanceMethodsInterceptPoint.getMethodsInterceptor();
if (StringUtil.isEmpty(interceptor)) {
throw new EnhanceException("no InstanceMethodsAroundInterceptor define to enhance class " + enhanceOriginClassName);
}
ClassInstanceMethodsInterceptor classMethodInterceptor = new ClassInstanceMethodsInterceptor(interceptor);
newClassBuilder =
newClassBuilder.method(not(isStatic()).and(instanceMethodsInterceptPoint.getMethodsMatcher())).intercept(MethodDelegation.to(classMethodInterceptor));
if (instanceMethodsInterceptPoint.isOverrideArgs()) {
newClassBuilder =
newClassBuilder.method(not(isStatic()).and(instanceMethodsInterceptPoint.getMethodsMatcher()))
.intercept(
MethodDelegation.withDefaultConfiguration()
.withBinders(
FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class),
Morph.Binder.install(OverrideCallable.class)
)
.to(new InstMethodsInterWithOverrideArgs(interceptor))
);
} else {
newClassBuilder =
newClassBuilder.method(not(isStatic()).and(instanceMethodsInterceptPoint.getMethodsMatcher()))
.intercept(
MethodDelegation.withDefaultConfiguration()
.withBinders(
FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class)
)
.to(new InstMethodsInter(interceptor))
);
}
}
}
@ -146,11 +182,11 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
* Enhance a class to intercept class static methods.
*
* @param enhanceOriginClassName target class name
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
* @return new byte-buddy's builder for further manipulation.
*/
private DynamicType.Builder<?> enhanceClass(String enhanceOriginClassName,
DynamicType.Builder<?> newClassBuilder) throws PluginException {
DynamicType.Builder<?> newClassBuilder) throws PluginException {
StaticMethodsInterceptPoint[] staticMethodsInterceptPoints = getStaticMethodsInterceptPoints();
if (staticMethodsInterceptPoints == null || staticMethodsInterceptPoints.length == 0) {
@ -163,9 +199,23 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
throw new EnhanceException("no StaticMethodsAroundInterceptor define to enhance class " + enhanceOriginClassName);
}
ClassStaticMethodsInterceptor classMethodInterceptor = new ClassStaticMethodsInterceptor(interceptor);
if (staticMethodsInterceptPoint.isOverrideArgs()) {
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
.intercept(
MethodDelegation.withDefaultConfiguration()
.withBinders(
Morph.Binder.install(OverrideCallable.class)
)
.to(new StaticMethodsInter(interceptor))
);
} else {
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
.intercept(
MethodDelegation.withDefaultConfiguration()
.to(new StaticMethodsInter(interceptor))
);
}
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher())).intercept(MethodDelegation.to(classMethodInterceptor));
}
return newClassBuilder;

View File

@ -0,0 +1,8 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* @author wusheng
*/
public interface Constructible {
void call(Object[] args);
}

View File

@ -4,7 +4,6 @@ import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
@ -15,8 +14,8 @@ import org.skywalking.apm.logging.LogManager;
*
* @author wusheng
*/
public class ClassConstructorInterceptor {
private static final ILog logger = LogManager.getLogger(ClassConstructorInterceptor.class);
public class ConstructorInter {
private static final ILog logger = LogManager.getLogger(ConstructorInter.class);
/**
* A class full name, and instanceof {@link InstanceConstructorInterceptor}
@ -26,33 +25,33 @@ public class ClassConstructorInterceptor {
private String constructorInterceptorClassName;
/**
* Set the name of {@link ClassConstructorInterceptor#constructorInterceptorClassName}
* Set the name of {@link ConstructorInter#constructorInterceptorClassName}
*
* @param constructorInterceptorClassName class full name.
*/
public ClassConstructorInterceptor(String constructorInterceptorClassName) {
public ConstructorInter(String constructorInterceptorClassName) {
this.constructorInterceptorClassName = constructorInterceptorClassName;
}
/**
* Intercept the target constructor.
*
* @param obj target class instance.
* @param accessor setter to the new added field of the target enhanced class.
* @param obj target class instance.
* @param dynamicFieldGetter a proxy to set the dynamic field
* @param dynamicFieldSetter a proxy to get the dynamic field
* @param allArguments all constructor arguments
*/
@RuntimeType
public void intercept(@This Object obj, @FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldSetter accessor,
@AllArguments Object[] allArguments) {
public void intercept(@This Object obj,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldSetter dynamicFieldSetter,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldGetter dynamicFieldGetter,
@AllArguments Object[] allArguments) {
try {
InstanceConstructorInterceptor interceptor = InterceptorInstanceLoader.load(constructorInterceptorClassName, obj.getClass().getClassLoader());
EnhancedClassInstanceContext context = new EnhancedClassInstanceContext();
accessor.setValue(context);
ConstructorInvokeContext interceptorContext = new ConstructorInvokeContext(obj, allArguments);
interceptor.onConstruct(context, interceptorContext);
interceptor.onConstruct(obj, allArguments, dynamicFieldSetter, dynamicFieldGetter);
} catch (Throwable t) {
logger.error("ClassConstructorInterceptor failure.", t);
logger.error("ConstructorInter failure.", t);
}
}

View File

@ -0,0 +1,61 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.Morph;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
/**
* The actual byte-buddy's interceptor to intercept constructor methods.
* In this class, it provide a bridge between byte-buddy and sky-walking plugin.
*
* @author wusheng
*/
public class ConstructorInterWithOverrideArgs {
private static final ILog logger = LogManager.getLogger(ConstructorInterWithOverrideArgs.class);
/**
* A class full name, and instanceof {@link InstanceConstructorInterceptor}
* This name should only stay in {@link String}, the real {@link Class} type will trigger classloader failure.
* If you want to know more, please check on books about Classloader or Classloader appointment mechanism.
*/
private String constructorInterceptorClassName;
/**
* Set the name of {@link ConstructorInterWithOverrideArgs#constructorInterceptorClassName}
*
* @param constructorInterceptorClassName class full name.
*/
public ConstructorInterWithOverrideArgs(String constructorInterceptorClassName) {
this.constructorInterceptorClassName = constructorInterceptorClassName;
}
/**
* Intercept the target constructor.
*
* @param obj target class instance.
* @param dynamicFieldGetter a proxy to set the dynamic field
* @param dynamicFieldSetter a proxy to get the dynamic field
* @param allArguments all constructor arguments
*/
@RuntimeType
public void intercept(@This Object obj,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldSetter dynamicFieldSetter,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldGetter dynamicFieldGetter,
@AllArguments Object[] allArguments,
@Morph(defaultMethod = true) Constructible zuper) {
try {
InstanceConstructorInterceptor interceptor = InterceptorInstanceLoader.load(constructorInterceptorClassName, obj.getClass().getClassLoader());
interceptor.onConstruct(obj, allArguments, dynamicFieldSetter, dynamicFieldGetter);
zuper.call(allArguments);
} catch (Throwable t) {
logger.error("ConstructorInter failure.", t);
}
}
}

View File

@ -1,36 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* Constructor context.
*
* @author wusheng
*/
public class ConstructorInvokeContext {
/**
* object instance
*/
private Object objInst;
/**
* constructor's arguments list.
*/
private Object[] allArguments;
ConstructorInvokeContext(Object objInst, Object[] allArguments) {
this.objInst = objInst;
this.allArguments = allArguments;
}
/**
* @return object instance
*/
public Object inst() {
return objInst;
}
/**
* @return arguments list.
*/
public Object[] allArguments() {
return this.allArguments;
}
}

View File

@ -1,31 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
/**
* Created by xin on 2016/12/6.
*/
public class DefaultClassConstructorInterceptor {
private static final ILog logger = LogManager
.getLogger(ClassConstructorInterceptor.class);
@RuntimeType
public void intercept(
@This Object obj,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldSetter accessor,
@AllArguments Object[] allArguments) {
try {
EnhancedClassInstanceContext context = new EnhancedClassInstanceContext();
accessor.setValue(context);
} catch (Throwable t) {
logger.error("ClassConstructorInterceptor failure.", t);
}
}
}

View File

@ -0,0 +1,8 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* @author wusheng
*/
public interface EnhancedInstance {
Object _getSkyWalkingDynamicFiled();
}

View File

@ -0,0 +1,17 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.FieldValue;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
/**
* Get the value of dynamic added {@link ClassEnhancePluginDefine#CONTEXT_ATTR_NAME} field
*
* @author wusheng
*/
public class EnhancedInstanceFieldGetter {
@RuntimeType
public Object intercept(
@FieldValue(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) Object fieldValue) {
return fieldValue;
}
}

View File

@ -2,7 +2,6 @@ package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.*;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
@ -15,8 +14,8 @@ import java.util.concurrent.Callable;
*
* @author wusheng
*/
public class ClassInstanceMethodsInterceptor {
private static final ILog logger = LogManager.getLogger(ClassInstanceMethodsInterceptor.class);
public class InstMethodsInter {
private static final ILog logger = LogManager.getLogger(InstMethodsInter.class);
/**
* A class full name, and instanceof {@link InstanceMethodsAroundInterceptor}
@ -26,37 +25,44 @@ public class ClassInstanceMethodsInterceptor {
private String instanceMethodsAroundInterceptorClassName;
/**
* Set the name of {@link ClassInstanceMethodsInterceptor#instanceMethodsAroundInterceptorClassName}
* Set the name of {@link InstMethodsInter#instanceMethodsAroundInterceptorClassName}
*
* @param instanceMethodsAroundInterceptorClassName class full name.
*/
public ClassInstanceMethodsInterceptor(String instanceMethodsAroundInterceptorClassName) {
public InstMethodsInter(String instanceMethodsAroundInterceptorClassName) {
this.instanceMethodsAroundInterceptorClassName = instanceMethodsAroundInterceptorClassName;
}
/**
* Intercept the target instance method.
*
* @param obj target class instance.
* @param allArguments all method arguments
* @param method method description.
* @param zuper the origin call ref.
* @param instanceContext the added field of enhanced class.
* @param obj target class instance.
* @param allArguments all method arguments
* @param method method description.
* @param dynamicFieldGetter a proxy to set the dynamic field
* @param dynamicFieldSetter a proxy to get the dynamic field
* @param zuper the origin call ref.
* @return the return value of target instance method.
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
* bug, if anything triggers this condition ).
* bug, if anything triggers this condition ).
*/
@RuntimeType
public Object intercept(@This Object obj, @AllArguments Object[] allArguments, @Origin Method method,
@SuperCall Callable<?> zuper,
@FieldValue(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) EnhancedClassInstanceContext instanceContext) throws Throwable {
public Object intercept(@This Object obj,
@AllArguments Object[] allArguments,
@SuperCall Callable<?> zuper,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldSetter dynamicFieldSetter,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldGetter dynamicFieldGetter,
@Origin Method method
) throws Throwable {
InstanceMethodsAroundInterceptor interceptor = InterceptorInstanceLoader
.load(instanceMethodsAroundInterceptorClassName, obj.getClass().getClassLoader());
InstanceMethodInvokeContext interceptorContext = new InstanceMethodInvokeContext(obj, method.getName(), allArguments, method.getParameterTypes());
MethodInterceptResult result = new MethodInterceptResult();
try {
interceptor.beforeMethod(instanceContext, interceptorContext, result);
interceptor.beforeMethod(obj, method.getName(), allArguments, method.getParameterTypes(),
dynamicFieldSetter,
dynamicFieldGetter,
result);
} catch (Throwable t) {
logger.error(t, "class[{}] before method[{}] intercept failure", obj.getClass(), method.getName());
}
@ -70,14 +76,20 @@ public class ClassInstanceMethodsInterceptor {
}
} catch (Throwable t) {
try {
interceptor.handleMethodException(t, instanceContext, interceptorContext);
interceptor.handleMethodException(obj, method.getName(), allArguments, method.getParameterTypes(),
dynamicFieldSetter,
dynamicFieldGetter,
t);
} catch (Throwable t2) {
logger.error(t2, "class[{}] handle method[{}] exception failure", obj.getClass(), method.getName());
}
throw t;
} finally {
try {
ret = interceptor.afterMethod(instanceContext, interceptorContext, ret);
ret = interceptor.afterMethod(obj, method.getName(), allArguments, method.getParameterTypes(),
dynamicFieldSetter,
dynamicFieldGetter,
ret);
} catch (Throwable t) {
logger.error(t, "class[{}] after method[{}] intercept failure", obj.getClass(), method.getName());
}

View File

@ -0,0 +1,102 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import java.lang.reflect.Method;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.Morph;
import net.bytebuddy.implementation.bind.annotation.Origin;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
/**
* The actual byte-buddy's interceptor to intercept class instance methods.
* In this class, it provide a bridge between byte-buddy and sky-walking plugin.
*
* @author wusheng
*/
public class InstMethodsInterWithOverrideArgs {
private static final ILog logger = LogManager.getLogger(InstMethodsInterWithOverrideArgs.class);
/**
* A class full name, and instanceof {@link InstanceMethodsAroundInterceptor}
* This name should only stay in {@link String}, the real {@link Class} type will trigger classloader failure.
* If you want to know more, please check on books about Classloader or Classloader appointment mechanism.
*/
private String instanceMethodsAroundInterceptorClassName;
/**
* Set the name of {@link InstMethodsInterWithOverrideArgs#instanceMethodsAroundInterceptorClassName}
*
* @param instanceMethodsAroundInterceptorClassName class full name.
*/
public InstMethodsInterWithOverrideArgs(String instanceMethodsAroundInterceptorClassName) {
this.instanceMethodsAroundInterceptorClassName = instanceMethodsAroundInterceptorClassName;
}
/**
* Intercept the target instance method.
*
* @param obj target class instance.
* @param allArguments all method arguments
* @param method method description.
* @param dynamicFieldGetter a proxy to set the dynamic field
* @param dynamicFieldSetter a proxy to get the dynamic field
* @param zuper the origin call ref.
* @return the return value of target instance method.
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
* bug, if anything triggers this condition ).
*/
@RuntimeType
public Object intercept(@This Object obj,
@AllArguments Object[] allArguments,
@Origin Method method,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldSetter dynamicFieldSetter,
@FieldProxy(ClassEnhancePluginDefine.CONTEXT_ATTR_NAME) FieldGetter dynamicFieldGetter,
@Morph(defaultMethod = true) OverrideCallable zuper
) throws Throwable {
InstanceMethodsAroundInterceptor interceptor = InterceptorInstanceLoader
.load(instanceMethodsAroundInterceptorClassName, obj.getClass().getClassLoader());
MethodInterceptResult result = new MethodInterceptResult();
try {
interceptor.beforeMethod(obj, method.getName(), allArguments, method.getParameterTypes(),
dynamicFieldSetter,
dynamicFieldGetter,
result);
} catch (Throwable t) {
logger.error(t, "class[{}] before method[{}] intercept failure", obj.getClass(), method.getName());
}
Object ret = null;
try {
if (!result.isContinue()) {
ret = result._ret();
} else {
ret = zuper.call(allArguments);
}
} catch (Throwable t) {
try {
interceptor.handleMethodException(obj, method.getName(), allArguments, method.getParameterTypes(),
dynamicFieldSetter,
dynamicFieldGetter,
t);
} catch (Throwable t2) {
logger.error(t2, "class[{}] handle method[{}] exception failure", obj.getClass(), method.getName());
}
throw t;
} finally {
try {
ret = interceptor.afterMethod(obj, method.getName(), allArguments, method.getParameterTypes(),
dynamicFieldSetter,
dynamicFieldGetter,
ret);
} catch (Throwable t) {
logger.error(t, "class[{}] after method[{}] intercept failure", obj.getClass(), method.getName());
}
}
return ret;
}
}

View File

@ -1,19 +1,18 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
/**
* The instance constructor's interceptor interface.
* Any plugin, which wants to intercept constructor, must implement this interface.
* <p>
* Created by wusheng on 2016/11/29.
*
* @author wusheng
*/
public interface InstanceConstructorInterceptor {
/**
* Called before the origin constructor invocation.
*
* @param context a new added instance field
* @param interceptorContext constructor invocation context.
*/
void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext);
void onConstruct(Object objInst,
Object[] allArguments,
FieldSetter dynamicFieldSetter,
FieldGetter dynamicFieldGetter);
}

View File

@ -1,23 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* Instance method invoke context.
* Beside all in {@link MethodInvokeContext}, plus Object instance ref.
*
* @author wusheng
*/
public class InstanceMethodInvokeContext extends MethodInvokeContext {
private Object objInst;
InstanceMethodInvokeContext(Object objInst, String methodName, Object[] allArguments, Class<?>[] argumentsTypes) {
super(methodName, allArguments, argumentsTypes);
this.objInst = objInst;
}
/**
* @return the target instance's ref.
*/
public Object inst() {
return objInst;
}
}

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
/**
* A interceptor, which intercept method's invocation. The target methods will be defined in {@link
* ClassEnhancePluginDefine}'s subclass, most likely in {@link ClassInstanceMethodsEnhancePluginDefine}
@ -12,33 +10,33 @@ public interface InstanceMethodsAroundInterceptor {
/**
* called before target method invocation.
*
* @param context instance context, a class instance only has one {@link EnhancedClassInstanceContext} instance.
* @param interceptorContext method context, includes class name, method name, etc.
* @param result change this result, if you want to truncate the method.
* @throws Throwable
*/
void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
void beforeMethod(Object objInst, String methodName, Object[] allArguments, Class<?>[] argumentsTypes,
FieldSetter dynamicFieldSetter,
FieldGetter dynamicFieldGetter,
MethodInterceptResult result) throws Throwable;
/**
* called after target method invocation. Even method's invocation triggers an exception.
*
* @param context instance context, a class instance only has one {@link EnhancedClassInstanceContext} instance.
* @param interceptorContext method context, includes class name, method name, etc.
* @param ret the method's original return value.
* @return the method's actual return value.
* @throws Throwable
*/
Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
Object afterMethod(Object objInst, String methodName, Object[] allArguments, Class<?>[] argumentsTypes,
FieldSetter dynamicFieldSetter,
FieldGetter dynamicFieldGetter,
Object ret) throws Throwable;
/**
* called when occur exception.
*
* @param t the exception occur.
* @param context instance context, a class instance only has one {@link EnhancedClassInstanceContext} instance.
* @param interceptorContext method context, includes class name, method name, etc.
*/
void handleMethodException(Throwable t, EnhancedClassInstanceContext context,
InstanceMethodInvokeContext interceptorContext);
void handleMethodException(Object objInst, String methodName, Object[] allArguments, Class<?>[] argumentsTypes,
FieldSetter dynamicFieldSetter,
FieldGetter dynamicFieldGetter,
Throwable t);
}

View File

@ -25,8 +25,8 @@ public class MethodInterceptResult {
}
/**
* @return true, will trigger method interceptor({@link ClassInstanceMethodsInterceptor} and {@link
* ClassStaticMethodsInterceptor}) to invoke the origin method. Otherwise, not.
* @return true, will trigger method interceptor({@link InstMethodsInter} and {@link
* StaticMethodsInter}) to invoke the origin method. Otherwise, not.
*/
public boolean isContinue() {
return isContinue;

View File

@ -1,41 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* Method invoke context.
* Include method name, arguments list and argument types list.
*
* @author wusheng
*/
public class MethodInvokeContext {
private String methodName;
private Object[] allArguments;
private Class<?>[] argumentTypes;
MethodInvokeContext(String methodName, Object[] allArguments, Class<?>[] argumentTypes) {
this.methodName = methodName;
this.allArguments = allArguments;
this.argumentTypes = argumentTypes;
}
/**
* @return arguments list.
*/
public Object[] allArguments() {
return this.allArguments;
}
/**
* @return method name.
*/
public String methodName() {
return methodName;
}
/**
* @return argument types list.
*/
public Class<?>[] argumentTypes() {
return argumentTypes;
}
}

View File

@ -0,0 +1,8 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* @author wusheng
*/
public interface OverrideCallable {
Object call(Object[] args);
}

View File

@ -1,26 +0,0 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* Static method invoke context.
* Beside all in {@link MethodInvokeContext}, plus the class type.
*
* @author wusheng
*/
public class StaticMethodInvokeContext extends MethodInvokeContext {
/**
* target class.
*/
private Class clazz;
StaticMethodInvokeContext(Class clazz, String methodName, Object[] allArguments, Class<?>[] parameterTypes) {
super(methodName, allArguments, parameterTypes);
this.clazz = clazz;
}
/**
* @return the target class
*/
public Class claszz() {
return clazz;
}
}

View File

@ -10,25 +10,24 @@ public interface StaticMethodsAroundInterceptor {
/**
* called before target method invocation.
*
* @param interceptorContext method context, includes class name, method name, etc.
* @param result change this result, if you want to truncate the method.
* @param result change this result, if you want to truncate the method.
*/
void beforeMethod(StaticMethodInvokeContext interceptorContext, MethodInterceptResult result);
void beforeMethod(Class clazz, String methodName, Object[] allArguments, Class<?>[] parameterTypes,
MethodInterceptResult result);
/**
* called after target method invocation. Even method's invocation triggers an exception.
*
* @param interceptorContext method context, includes class name, method name, etc.
* @param ret the method's original return value.
* @param ret the method's original return value.
* @return the method's actual return value.
*/
Object afterMethod(StaticMethodInvokeContext interceptorContext, Object ret);
Object afterMethod(Class clazz, String methodName, Object[] allArguments, Class<?>[] parameterTypes, Object ret);
/**
* called when occur exception.
*
* @param t the exception occur.
* @param interceptorContext method context, includes class name, method name, etc.
* @param t the exception occur.
*/
void handleMethodException(Throwable t, MethodInvokeContext interceptorContext);
void handleMethodException(Class clazz, String methodName, Object[] allArguments, Class<?>[] parameterTypes,
Throwable t);
}

View File

@ -17,8 +17,8 @@ import java.util.concurrent.Callable;
*
* @author wusheng
*/
public class ClassStaticMethodsInterceptor {
private static final ILog logger = LogManager.getLogger(ClassStaticMethodsInterceptor.class);
public class StaticMethodsInter {
private static final ILog logger = LogManager.getLogger(StaticMethodsInter.class);
/**
* A class full name, and instanceof {@link StaticMethodsAroundInterceptor}
@ -28,35 +28,34 @@ public class ClassStaticMethodsInterceptor {
private String staticMethodsAroundInterceptorClassName;
/**
* Set the name of {@link ClassStaticMethodsInterceptor#staticMethodsAroundInterceptorClassName}
* Set the name of {@link StaticMethodsInter#staticMethodsAroundInterceptorClassName}
*
* @param staticMethodsAroundInterceptorClassName class full name.
*/
public ClassStaticMethodsInterceptor(String staticMethodsAroundInterceptorClassName) {
public StaticMethodsInter(String staticMethodsAroundInterceptorClassName) {
this.staticMethodsAroundInterceptorClassName = staticMethodsAroundInterceptorClassName;
}
/**
* Intercept the target static method.
*
* @param clazz target class
* @param clazz target class
* @param allArguments all method arguments
* @param method method description.
* @param zuper the origin call ref.
* @param method method description.
* @param zuper the origin call ref.
* @return the return value of target static method.
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
* bug, if anything triggers this condition ).
* bug, if anything triggers this condition ).
*/
@RuntimeType
public Object intercept(@Origin Class<?> clazz, @AllArguments Object[] allArguments, @Origin Method method,
@SuperCall Callable<?> zuper) throws Throwable {
@SuperCall Callable<?> zuper) throws Throwable {
StaticMethodsAroundInterceptor interceptor = InterceptorInstanceLoader
.load(staticMethodsAroundInterceptorClassName, clazz.getClassLoader());
StaticMethodInvokeContext interceptorContext = new StaticMethodInvokeContext(clazz, method.getName(), allArguments, method.getParameterTypes());
MethodInterceptResult result = new MethodInterceptResult();
try {
interceptor.beforeMethod(interceptorContext, result);
interceptor.beforeMethod(clazz, method.getName(), allArguments, method.getParameterTypes(), result);
} catch (Throwable t) {
logger.error(t, "class[{}] before static method[{}] intercept failure", clazz, method.getName());
}
@ -70,14 +69,14 @@ public class ClassStaticMethodsInterceptor {
}
} catch (Throwable t) {
try {
interceptor.handleMethodException(t, interceptorContext);
interceptor.handleMethodException(clazz, method.getName(), allArguments, method.getParameterTypes(), t);
} catch (Throwable t2) {
logger.error(t2, "class[{}] handle static method[{}] exception failure", clazz, method.getName(), t2.getMessage());
}
throw t;
} finally {
try {
ret = interceptor.afterMethod(interceptorContext, ret);
ret = interceptor.afterMethod(clazz, method.getName(), allArguments, method.getParameterTypes(), ret);
} catch (Throwable t) {
logger.error(t, "class[{}] after static method[{}] intercept failure:{}", clazz, method.getName(), t.getMessage());
}

View File

@ -0,0 +1,84 @@
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import java.lang.reflect.Method;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.Morph;
import net.bytebuddy.implementation.bind.annotation.Origin;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
/**
* The actual byte-buddy's interceptor to intercept class instance methods.
* In this class, it provide a bridge between byte-buddy and sky-walking plugin.
*
* @author wusheng
*/
public class StaticMethodsInterWithOverrideArgs {
private static final ILog logger = LogManager.getLogger(StaticMethodsInterWithOverrideArgs.class);
/**
* A class full name, and instanceof {@link StaticMethodsAroundInterceptor}
* This name should only stay in {@link String}, the real {@link Class} type will trigger classloader failure.
* If you want to know more, please check on books about Classloader or Classloader appointment mechanism.
*/
private String staticMethodsAroundInterceptorClassName;
/**
* Set the name of {@link StaticMethodsInterWithOverrideArgs#staticMethodsAroundInterceptorClassName}
*
* @param staticMethodsAroundInterceptorClassName class full name.
*/
public StaticMethodsInterWithOverrideArgs(String staticMethodsAroundInterceptorClassName) {
this.staticMethodsAroundInterceptorClassName = staticMethodsAroundInterceptorClassName;
}
/**
* Intercept the target static method.
*
* @param clazz target class
* @param allArguments all method arguments
* @param method method description.
* @param zuper the origin call ref.
* @return the return value of target static method.
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
* bug, if anything triggers this condition ).
*/
@RuntimeType
public Object intercept(@Origin Class<?> clazz, @AllArguments Object[] allArguments, @Origin Method method,
@Morph(defaultMethod = true) OverrideCallable zuper) throws Throwable {
StaticMethodsAroundInterceptor interceptor = InterceptorInstanceLoader
.load(staticMethodsAroundInterceptorClassName, clazz.getClassLoader());
MethodInterceptResult result = new MethodInterceptResult();
try {
interceptor.beforeMethod(clazz, method.getName(), allArguments, method.getParameterTypes(), result);
} catch (Throwable t) {
logger.error(t, "class[{}] before static method[{}] intercept failure", clazz, method.getName());
}
Object ret = null;
try {
if (!result.isContinue()) {
ret = result._ret();
} else {
ret = zuper.call(allArguments);
}
} catch (Throwable t) {
try {
interceptor.handleMethodException(clazz, method.getName(), allArguments, method.getParameterTypes(), t);
} catch (Throwable t2) {
logger.error(t2, "class[{}] handle static method[{}] exception failure", clazz, method.getName(), t2.getMessage());
}
throw t;
} finally {
try {
ret = interceptor.afterMethod(clazz, method.getName(), allArguments, method.getParameterTypes(), ret);
} catch (Throwable t) {
logger.error(t, "class[{}] after static method[{}] intercept failure:{}", clazz, method.getName(), t.getMessage());
}
}
return ret;
}
}

View File

@ -1,14 +1,9 @@
package org.skywalking.apm.agent.core.plugin;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
public class MockPluginInterceptor implements InstanceMethodsAroundInterceptor, StaticMethodsAroundInterceptor, InstanceConstructorInterceptor {
@Override

View File

@ -5,9 +5,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.assist.NoConcurrencyAccessObject;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
/**
* @author wusheng

View File

@ -53,8 +53,9 @@ public class SkyWalkingAgent {
ServiceManager.INSTANCE.boot();
new AgentBuilder.Default().type(enhanceClassMatcher(pluginFinder).and(not(isInterface()))).transform(new AgentBuilder.Transformer() {
@Override
public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription,
ClassLoader classLoader) {
ClassLoader classLoader, JavaModule module) {
List<AbstractClassEnhancePluginDefine> pluginDefines = pluginFinder.find(typeDescription.getTypeName());
for (AbstractClassEnhancePluginDefine pluginDefine : pluginDefines) {
DynamicType.Builder<?> newBuilder = pluginDefine.define(typeDescription.getTypeName(), builder, classLoader);
@ -63,27 +64,37 @@ public class SkyWalkingAgent {
}
}
logger.warn("Matched class {}, but enhancement fail.", typeDescription.getTypeName());
logger.warn("Matched class {}, but enhancement fails.", typeDescription.getTypeName());
return builder;
}
}).with(new AgentBuilder.Listener() {
@Override
public void onDiscovery(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded) {
}
@Override
public void onTransformation(TypeDescription typeDescription, ClassLoader classLoader, JavaModule module,
DynamicType dynamicType) {
boolean loaded, DynamicType dynamicType) {
}
@Override
public void onIgnored(TypeDescription typeDescription, ClassLoader classLoader, JavaModule module) {
public void onIgnored(TypeDescription typeDescription, ClassLoader classLoader, JavaModule module,
boolean loaded) {
}
@Override
public void onError(String typeName, ClassLoader classLoader, JavaModule module, Throwable throwable) {
@Override public void onError(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded,
Throwable throwable) {
logger.error("Failed to enhance class " + typeName, throwable);
}
@Override
public void onComplete(String typeName, ClassLoader classLoader, JavaModule module) {
public void onComplete(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded) {
if(logger.isDebugEnable()){
logger.debug("Enhance class {} completed.", typeName);
}
}
}).installOn(instrumentation);
}

View File

@ -10,8 +10,6 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.dubbox.BugFixActive;

View File

@ -18,8 +18,6 @@ import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.dubbox.BugFixActive;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;

View File

@ -16,8 +16,6 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -14,8 +14,6 @@ import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.SpanLogReader;

View File

@ -12,8 +12,6 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -11,8 +11,6 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.tags.BooleanTagReader;

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.plugin.jdbc.define;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.SWConnection;

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.plugin.jedis.v2;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import redis.clients.jedis.HostAndPort;

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.plugin.jedis.v2;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import redis.clients.jedis.HostAndPort;

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.plugin.jedis.v2;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import redis.clients.jedis.JedisShardInfo;

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.plugin.jedis.v2;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
/**

View File

@ -1,7 +1,5 @@
package org.skywalking.apm.plugin.jedis.v2;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import java.net.URI;

View File

@ -3,9 +3,7 @@ package org.skywalking.apm.plugin.jedis.v2;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.assist.NoConcurrencyAccessObject;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.util.StringUtil;

View File

@ -6,8 +6,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import redis.clients.jedis.HostAndPort;
import static org.mockito.Mockito.*;

View File

@ -6,8 +6,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import redis.clients.jedis.HostAndPort;
import java.util.HashSet;

View File

@ -6,8 +6,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import redis.clients.jedis.JedisShardInfo;
import static org.mockito.Mockito.*;

View File

@ -5,8 +5,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import static org.mockito.Mockito.*;
import static org.skywalking.apm.plugin.jedis.v2.JedisMethodInterceptor.*;

View File

@ -6,8 +6,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import java.net.URI;

View File

@ -11,8 +11,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.tags.StringTagReader;

View File

@ -30,8 +30,6 @@ import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -3,8 +3,6 @@ package org.skywalking.apm.plugin.mongodb.v3;
import com.mongodb.ReadPreference;
import com.mongodb.ServerAddress;
import com.mongodb.binding.ReadBinding;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -2,8 +2,6 @@ package org.skywalking.apm.plugin.mongodb.v3;
import com.mongodb.ServerAddress;
import com.mongodb.binding.WriteBinding;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -16,8 +16,6 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.powermock.api.mockito.PowerMockito;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.SpanLogReader;

View File

@ -11,8 +11,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

View File

@ -11,8 +11,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

View File

@ -17,8 +17,6 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.powermock.api.mockito.PowerMockito;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.SpanLogReader;

View File

@ -8,10 +8,7 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -7,8 +7,6 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.util.StringUtil;

View File

@ -12,8 +12,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.SpanLogReader;

View File

@ -13,9 +13,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.SpanLogReader;

View File

@ -11,10 +11,7 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -11,9 +11,6 @@ import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.sniffer.mock.trace.SpanLogReader;

View File

@ -7,8 +7,6 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.util.StringUtil;

View File

@ -11,8 +11,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;

View File

@ -7,8 +7,6 @@ import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.util.StringUtil;

View File

@ -11,8 +11,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;

View File

@ -8,8 +8,6 @@ import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.context.trace.TraceSegment;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.util.StringUtil;

View File

@ -11,8 +11,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.sniffer.mock.context.MockTracingContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;

View File

@ -1,8 +1,6 @@
package org.skywalking.apm.toolkit.activation.log.log4j.v1.x;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -2,8 +2,6 @@ package org.skywalking.apm.toolkit.activation.log.log4j.v2.x;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
/**

View File

@ -1,8 +1,6 @@
package org.skywalking.apm.toolkit.activation.log.logback.v1.x;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;

View File

@ -1,8 +1,6 @@
package org.skywalking.apm.toolkit.activation.opentracing.span.interceptor;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.toolkit.opentracing.SkyWalkingSpan;

View File

@ -3,8 +3,6 @@ package org.skywalking.apm.toolkit.activation.opentracing.span.interceptor;
import java.util.Map;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.toolkit.opentracing.SkyWalkingSpan;

View File

@ -1,8 +1,6 @@
package org.skywalking.apm.toolkit.activation.opentracing.span.interceptor;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.toolkit.opentracing.SkyWalkingSpan;

View File

@ -2,8 +2,6 @@ package org.skywalking.apm.toolkit.activation.opentracing.span.interceptor;
import io.opentracing.tag.Tags;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.toolkit.opentracing.SkyWalkingSpan;

View File

@ -2,8 +2,6 @@ package org.skywalking.apm.toolkit.activation.opentracing.tracer.interceptor;
import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.toolkit.opentracing.SkyWalkingTracer;

View File

@ -2,8 +2,6 @@ package org.skywalking.apm.toolkit.activation.opentracing.tracer.interceptor;
import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.toolkit.opentracing.SkyWalkingTracer;

View File

@ -2,8 +2,6 @@ package org.skywalking.apm.toolkit.activation.trace;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;