Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/buriedpoint/LocalBuriedPointSender.java +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public class LocalBuriedPointSender extends ApplicationExceptionHandler implemen if (Config.BuriedPoint.PRINTF) { logger.debug("TraceId:" + spanData.getTraceId() + "\tviewpointId:" + spanData.getViewPointId() + "\tParentLevelId:" + spanData. getParentLevel() + "\tLevelId:" + spanData.getLevelId()); getParentLevel() + "\tLevelId:" + spanData.getLevelId() + "\tbusinessKey:" + spanData.getBusinessKey()); } // 存放到本地发送进程中 Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/PluginBootstrap.java +0 −1 Original line number Diff line number Diff line package com.ai.cloud.skywalking.plugin; import java.net.URL; import java.util.Enumeration; import java.util.List; import org.apache.logging.log4j.LogManager; Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/PluginCfg.java +4 −4 Original line number Diff line number Diff line Loading @@ -19,10 +19,10 @@ public class PluginCfg { void load(InputStream input) throws IOException{ try{ BufferedReader reader = new BufferedReader(new InputStreamReader(input)); String nhanceOriginClassName = null; while((nhanceOriginClassName = reader.readLine()) != null){ if(!StringUtil.isEmpty(nhanceOriginClassName)){ interceptorClassList.add(nhanceOriginClassName.trim()); String interceptorDefineClassName = null; while((interceptorDefineClassName = reader.readLine()) != null){ if(!StringUtil.isEmpty(interceptorDefineClassName)){ interceptorClassList.add(interceptorDefineClassName.trim()); } } }finally{ Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassMethodInterceptor.java +9 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,14 @@ public class ClassMethodInterceptor { Object ret = null; try { ret = zuper.call(); } catch(Throwable t){ try { interceptor.handleMethodException(t, instanceContext, interceptorContext, ret); throw t; } catch (Throwable t2) { logger.error("class[{}] handle method[{}] exception failue:{}", obj.getClass(), method.getName(), t2.getMessage(), t2); } }finally { try { ret = interceptor.afterMethod(instanceContext, interceptorContext, ret); Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java +26 −9 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ package com.ai.cloud.skywalking.plugin.interceptor; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; import static net.bytebuddy.matcher.ElementMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.any; import static net.bytebuddy.matcher.ElementMatchers.takesArguments; import java.util.Set; Loading Loading @@ -80,8 +82,8 @@ public class EnhanceClazz4Interceptor { * 1.add field '_$EnhancedClassInstanceContext' of type * EnhancedClassInstanceContext <br/> * * 2.intercept constructor by default, and intercept method which it's required by * interceptorDefineClass. <br/> * 2.intercept constructor by default, and intercept method which it's * required by interceptorDefineClass. <br/> */ IAroundInterceptor interceptor = define.instance(); Loading @@ -90,7 +92,7 @@ public class EnhanceClazz4Interceptor { newClassBuilder = newClassBuilder .defineField(contextAttrName, EnhancedClassInstanceContext.class) .constructor(isConstructor()) .constructor(any()) .intercept( SuperMethodCall.INSTANCE.andThen(MethodDelegation.to( new ClassConstructorInterceptor(interceptor)) Loading @@ -99,12 +101,27 @@ public class EnhanceClazz4Interceptor { FieldGetter.class, FieldSetter.class)))); String[] methodNameList = define.getBeInterceptedMethods(); for (String methodName : methodNameList) { newClassBuilder = newClassBuilder.method(named(methodName)) .intercept( MethodDelegation.to(new ClassMethodInterceptor( interceptor))); InterceptPoint[] methodNameList = define.getBeInterceptedMethods(); ClassMethodInterceptor classMethodInterceptor = new ClassMethodInterceptor( interceptor); for (InterceptPoint method : methodNameList) { logger.debug("prepare to enhance class {} method [{}] ", enhanceOriginClassName, method.getMethodName()); if (method.getArgTypeArray() != null) { newClassBuilder = newClassBuilder.method( named(method.getMethodName()).and( takesArguments(method.getArgTypeArray()))).intercept( MethodDelegation.to(classMethodInterceptor)); } else if (method.getArgNum() > -1) { newClassBuilder = newClassBuilder.method( named(method.getMethodName()).and( takesArguments(method.getArgNum()))).intercept( MethodDelegation.to(classMethodInterceptor)); } else { newClassBuilder = newClassBuilder.method( named(method.getMethodName())).intercept( MethodDelegation.to(classMethodInterceptor)); } } /** Loading Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/buriedpoint/LocalBuriedPointSender.java +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public class LocalBuriedPointSender extends ApplicationExceptionHandler implemen if (Config.BuriedPoint.PRINTF) { logger.debug("TraceId:" + spanData.getTraceId() + "\tviewpointId:" + spanData.getViewPointId() + "\tParentLevelId:" + spanData. getParentLevel() + "\tLevelId:" + spanData.getLevelId()); getParentLevel() + "\tLevelId:" + spanData.getLevelId() + "\tbusinessKey:" + spanData.getBusinessKey()); } // 存放到本地发送进程中 Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/PluginBootstrap.java +0 −1 Original line number Diff line number Diff line package com.ai.cloud.skywalking.plugin; import java.net.URL; import java.util.Enumeration; import java.util.List; import org.apache.logging.log4j.LogManager; Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/PluginCfg.java +4 −4 Original line number Diff line number Diff line Loading @@ -19,10 +19,10 @@ public class PluginCfg { void load(InputStream input) throws IOException{ try{ BufferedReader reader = new BufferedReader(new InputStreamReader(input)); String nhanceOriginClassName = null; while((nhanceOriginClassName = reader.readLine()) != null){ if(!StringUtil.isEmpty(nhanceOriginClassName)){ interceptorClassList.add(nhanceOriginClassName.trim()); String interceptorDefineClassName = null; while((interceptorDefineClassName = reader.readLine()) != null){ if(!StringUtil.isEmpty(interceptorDefineClassName)){ interceptorClassList.add(interceptorDefineClassName.trim()); } } }finally{ Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassMethodInterceptor.java +9 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,14 @@ public class ClassMethodInterceptor { Object ret = null; try { ret = zuper.call(); } catch(Throwable t){ try { interceptor.handleMethodException(t, instanceContext, interceptorContext, ret); throw t; } catch (Throwable t2) { logger.error("class[{}] handle method[{}] exception failue:{}", obj.getClass(), method.getName(), t2.getMessage(), t2); } }finally { try { ret = interceptor.afterMethod(instanceContext, interceptorContext, ret); Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java +26 −9 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ package com.ai.cloud.skywalking.plugin.interceptor; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; import static net.bytebuddy.matcher.ElementMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.any; import static net.bytebuddy.matcher.ElementMatchers.takesArguments; import java.util.Set; Loading Loading @@ -80,8 +82,8 @@ public class EnhanceClazz4Interceptor { * 1.add field '_$EnhancedClassInstanceContext' of type * EnhancedClassInstanceContext <br/> * * 2.intercept constructor by default, and intercept method which it's required by * interceptorDefineClass. <br/> * 2.intercept constructor by default, and intercept method which it's * required by interceptorDefineClass. <br/> */ IAroundInterceptor interceptor = define.instance(); Loading @@ -90,7 +92,7 @@ public class EnhanceClazz4Interceptor { newClassBuilder = newClassBuilder .defineField(contextAttrName, EnhancedClassInstanceContext.class) .constructor(isConstructor()) .constructor(any()) .intercept( SuperMethodCall.INSTANCE.andThen(MethodDelegation.to( new ClassConstructorInterceptor(interceptor)) Loading @@ -99,12 +101,27 @@ public class EnhanceClazz4Interceptor { FieldGetter.class, FieldSetter.class)))); String[] methodNameList = define.getBeInterceptedMethods(); for (String methodName : methodNameList) { newClassBuilder = newClassBuilder.method(named(methodName)) .intercept( MethodDelegation.to(new ClassMethodInterceptor( interceptor))); InterceptPoint[] methodNameList = define.getBeInterceptedMethods(); ClassMethodInterceptor classMethodInterceptor = new ClassMethodInterceptor( interceptor); for (InterceptPoint method : methodNameList) { logger.debug("prepare to enhance class {} method [{}] ", enhanceOriginClassName, method.getMethodName()); if (method.getArgTypeArray() != null) { newClassBuilder = newClassBuilder.method( named(method.getMethodName()).and( takesArguments(method.getArgTypeArray()))).intercept( MethodDelegation.to(classMethodInterceptor)); } else if (method.getArgNum() > -1) { newClassBuilder = newClassBuilder.method( named(method.getMethodName()).and( takesArguments(method.getArgNum()))).intercept( MethodDelegation.to(classMethodInterceptor)); } else { newClassBuilder = newClassBuilder.method( named(method.getMethodName())).intercept( MethodDelegation.to(classMethodInterceptor)); } } /** Loading