diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java index 69f952d5b..52a9f235e 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java @@ -1,9 +1,14 @@ package com.a.eye.skywalking.plugin.interceptor; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; + /** * Created by wusheng on 2016/11/29. */ public interface ConstructorInterceptPoint{ + ElementMatcher.Junction getConstructorMatcher(); + /** * * @return represents a class name, the class instance must instanceof InstanceConstructorInterceptor. diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/MethodMatcher.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/MethodMatcher.java index 611ffba8c..765fb899f 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/MethodMatcher.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/MethodMatcher.java @@ -68,8 +68,7 @@ public abstract class MethodMatcher { } public enum Modifier { - Public, Default, Private, Protected, - ClassLoadingStrategy; + Public, Default, Private, Protected; private ElementMatcher.Junction elementMatcher() { switch (this) { diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/assist/DefaultConstructorInterceptor.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/assist/DefaultConstructorInterceptor.java deleted file mode 100644 index dd7e1876c..000000000 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/assist/DefaultConstructorInterceptor.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.a.eye.skywalking.plugin.interceptor.assist; - -import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; - -/** - * Created by wusheng on 2016/11/29. - */ -public class DefaultConstructorInterceptor implements InstanceConstructorInterceptor { - @Override - public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { - // do nothing as default implements. - } -} diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassEnhancePluginDefine.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassEnhancePluginDefine.java index a52493b35..3b981d5a1 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassEnhancePluginDefine.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassEnhancePluginDefine.java @@ -33,11 +33,11 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi } private DynamicType.Builder enhanceInstance(String enhanceOriginClassName, DynamicType.Builder newClassBuilder) throws PluginException { - ConstructorInterceptPoint constructorInterceptPoint = getConstructorsInterceptPoint(); + ConstructorInterceptPoint[] constructorInterceptPoints = getConstructorsInterceptPoints(); InstanceMethodsInterceptPoint[] instanceMethodsInterceptPoints = getInstanceMethodsInterceptPoints(); boolean existedConstructorInterceptPoint = false; - if (constructorInterceptPoint != null) { + if (constructorInterceptPoints != null && constructorInterceptPoints.length > 0) { existedConstructorInterceptPoint = true; } boolean existedMethodsInterceptPoints = false; @@ -61,19 +61,25 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi * EnhancedClassInstanceContext
* */ - String constructorInterceptor; - if (existedConstructorInterceptPoint) { - constructorInterceptor = constructorInterceptPoint.getConstructorInterceptor(); - } else { - constructorInterceptor = "com.a.eye.skywalking.plugin.interceptor.assist.DefaultConstructorInterceptor"; - } - newClassBuilder = newClassBuilder.defineField(contextAttrName, EnhancedClassInstanceContext.class, ACC_PRIVATE); - newClassBuilder = newClassBuilder.constructor(any()).intercept(SuperMethodCall.INSTANCE - .andThen(MethodDelegation.to(new ClassConstructorInterceptor(constructorInterceptor)).appendParameterBinder(FieldProxy.Binder.install(FieldGetter.class, FieldSetter.class)))); + /** + * 2. enhance constructors + */ + 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(existedMethodsInterceptPoints) { + + /** + * 3. enhance instance methods + */ + if (existedMethodsInterceptPoints) { for (InstanceMethodsInterceptPoint instanceMethodsInterceptPoint : instanceMethodsInterceptPoints) { String interceptor = instanceMethodsInterceptPoint.getMethodsInterceptor(); @@ -113,7 +119,7 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi return newClassBuilder; } - protected abstract ConstructorInterceptPoint getConstructorsInterceptPoint(); + protected abstract ConstructorInterceptPoint[] getConstructorsInterceptPoints(); protected abstract InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints(); @@ -121,7 +127,7 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi private DynamicType.Builder enhanceClass(String enhanceOriginClassName, DynamicType.Builder newClassBuilder) throws PluginException { StaticMethodsInterceptPoint[] staticMethodsInterceptPoints = getStaticMethodsInterceptPoints(); - if(staticMethodsInterceptPoints == null || staticMethodsInterceptPoints.length == 0){ + if (staticMethodsInterceptPoints == null || staticMethodsInterceptPoints.length == 0) { return newClassBuilder; } diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassStaticMethodsEnhancePluginDefine.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassStaticMethodsEnhancePluginDefine.java index dbabc00c3..2037ae511 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassStaticMethodsEnhancePluginDefine.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/enhance/ClassStaticMethodsEnhancePluginDefine.java @@ -13,7 +13,7 @@ public abstract class ClassStaticMethodsEnhancePluginDefine extends ClassEnhancePluginDefine { @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint(){ + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints(){ return null; } diff --git a/skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/context/CurrentThreadSpanStackTest.java b/skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/context/CurrentThreadSpanStackTest.java deleted file mode 100644 index 35dd0817b..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/context/CurrentThreadSpanStackTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.a.eye.skywalking.context; - -import com.a.eye.skywalking.model.Span; -import org.junit.Test; -import org.mockito.Mockito; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.verify; - -public class CurrentThreadSpanStackTest { - - @Test - public void testStack(){ - Span rootSpan = new Span("test","test","Test"); - Span subSpan1 = new Span("test","0", 10, "test","Test"); - Span subSpan2 = new Span("test","0", 10, "test","Test"); - CurrentThreadSpanStack.push(rootSpan); - - CurrentThreadSpanStack.push(subSpan1); - Span span = CurrentThreadSpanStack.peek(); - assertEquals(0, span.getLevelId()); - CurrentThreadSpanStack.pop(); - - CurrentThreadSpanStack.push(subSpan2); - span = CurrentThreadSpanStack.peek(); - assertEquals(1, span.getLevelId()); - CurrentThreadSpanStack.pop(); - - CurrentThreadSpanStack.pop(); - } - - -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/assertspandata/SDKGeneratedDataTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/assertspandata/SDKGeneratedDataTest.java deleted file mode 100644 index e22d00d3e..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/assertspandata/SDKGeneratedDataTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package test.a.eye.cloud.assertspandata; - -import com.a.eye.skywalking.buffer.ContextBuffer; -import com.a.eye.skywalking.conf.Config; -import com.a.eye.skywalking.protocol.RequestSpan; -import com.a.eye.skywalking.model.Span; -import com.a.eye.skywalking.testframework.api.RequestSpanAssert; -import org.junit.Test; - -/** - * Created by xin on 16-6-6. - */ -public class SDKGeneratedDataTest { - - @Test - public void traceTreeAssertTest() { - Config.Consumer.MAX_CONSUMER = 0; - Span testSpan = new Span("1.0b.1465224457414.7e57f54.22905.61.2691", "", 0, "test-application", "5"); - RequestSpan requestSpan = - RequestSpan.RequestSpanBuilder.newBuilder(testSpan).viewPoint("http://hire.asiainfo.com/Aisse-Mobile-Web/aisseWorkPage/submitReimbursement").build(); - ContextBuffer.save(requestSpan); - RequestSpanAssert.assertEquals(new String[][] {{"0", "http://hire.asiainfo.com/Aisse-Mobile-Web/aisseWorkPage/submitReimbursement", null}}); - - } -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/checksum/CheckSumTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/checksum/CheckSumTest.java deleted file mode 100644 index 8b978f61c..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/checksum/CheckSumTest.java +++ /dev/null @@ -1,116 +0,0 @@ -package test.a.eye.cloud.checksum; - -import org.junit.Test; - -public class CheckSumTest { - private static final int dataIndex = 2; - private static final int MAX_TEST_COUNT = 100_000_00; - - @Test - public void TestAllXORSum() { - String data = dataArray[dataIndex]; - long startTime = System.currentTimeMillis(); - for (int i = 0; i < MAX_TEST_COUNT; i++) { - intToBytes2(makeChecksum(data, 1)); - } - System.out.println("All XOR check sum totalSize:" + MAX_TEST_COUNT + " cost :" + (((System.currentTimeMillis() - startTime)))); - } - - @Test - public void Test18XORSum() { - String data = dataArray[dataIndex]; - long startTime = System.currentTimeMillis(); - for (int i = 0; i < MAX_TEST_COUNT; i++) { - intToBytes2(makeChecksum(data, 8)); - } - System.out.println("All XOR check sum totalSize:" + MAX_TEST_COUNT + " cost :" + (((System.currentTimeMillis() - startTime)))); - } - - @Test - public void Test116XORSum() { - String data = dataArray[dataIndex]; - long startTime = System.currentTimeMillis(); - for (int i = 0; i < MAX_TEST_COUNT; i++) { - intToBytes2(makeChecksum(data, 16)); - } - System.out.println("All XOR check sum totalSize:" + MAX_TEST_COUNT + " cost :" + (((System.currentTimeMillis() - startTime)))); - } - - public int makeChecksum(String data, int step) { - char[] dataArray = data.toCharArray(); - int result = dataArray[0]; - for (int i = 0; i < dataArray.length; i = i + step) { - result ^= dataArray[i]; - } - - return result; - } - - public byte[] intToBytes2(int value) { - byte[] src = new byte[4]; - src[0] = (byte) ((value >> 24) & 0xFF); - src[1] = (byte) ((value >> 16) & 0xFF); - src[2] = (byte) ((value >> 8) & 0xFF); - src[3] = (byte) (value & 0xFF); - return src; - } - - private static final String[] dataArray = new String[]{ - "1.0b.1463530404744.9576be7.22045.45.1480@~0@~0@~com.ai.aisse.controller.overtimeexpense.OvertimeExpenseC" + - "ontroller.overtimeInit(com.ai.net.xss.wrapper.XssRequestWrapper,org.apache.catalina.connector.ResponseFa" + - "cade,org.springframework.validation.support.BindingAwareModelMap)@~1463530404774@~5@~ITSC-MIS-LEV-web01/" + - "10.1.31.12@~0@~ @~M@~false@~ @~22045@~aisse-mobile-web@~5@~L#&", - "1.0b.1463539216140.50f8123.14804.265333.1493@~0.0.0@~3@~tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(" + - "aisse)@~1463539212130@~1@~ITSC-MIS-LEV-web01/10.1.31.12@~0@~ @~J@~false@~connection.commit@~10872@~aisse" + - "-dubbo@~5@~L#&1.0b.1463539217412.50f8123.14804.52.1556@~0.0.0@~1@~com.ai.aisse.core.dao.impl.AisseItemLi" + - "stTDaoImpl.queryAisseItemWorkMealTs(java.util.LinkedHashMap)@~1463539213376@~6@~ITSC-MIS-LEV-web01/10.1." + - "31.12@~0@~ @~M@~false@~ @~10872@~aisse-dubbo@~5@~L#&1.0b.1463539217412.50f8123.14804.52.1556@~0.0.0@~2@~" + - "tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(aisse)@~1463539213384@~1@~ITSC-MIS-LEV-web01/10.1.31.12@" + - "~0@~ @~J@~false@~connection.commit@~10872@~aisse-dubbo@~5@~L#&1.0b.1463539217412.50f8123.14804.52.1556@~" + - "0.0@~0@~rest://10.1.31.12:20188/aisse/com.ai.aisse.core.rest.IAisseVoucherApi.queryAisseItemT(Map)@~1463" + - "539213354@~32@~ITSC-MIS-LEV-web01/10.1.31.12@~0@~ @~D@~true@~ @~10872@~aisse-dubbo@~5@~S#&", - "1.0b.1463540545212.3627470.24702.142.5@~ @~0@~Map com.ai.saas.comment.core.service.impl.EvalutionObjSvIm" + - "pl.getCommentsParamters(RequestData)@~1463540545212@~32@~host-10-1-236-126/127.0.0.1@~1@~java.lang.Runti" + - "meException: Value for ntAccount cannot be null#~ at com.ai.saas.comment.core.model.dto.EvalutionO" + - "bjectResultCriteria$GeneratedCriteria.addCriterion(EvalutionObjectResultCriteria.java:116)#~ at com.a" + - "i.saas.comment.core.model.dto.EvalutionObjectResultCriteria$GeneratedCriteria.andNtAccountEqualTo(Evalut" + - "ionObjectResultCriteria.java:479)#~ at com.ai.saas.comment.core.model.dto.EvalutionObjectResultCrite" + - "ria$Criteria.andNtAccountEqualTo(EvalutionObjectResultCriteria.java:1089)#~ at com.ai.saas.comment.c" + - "ore.service.impl.EvalutionObjSvImpl.getCommentsParamters(EvalutionObjSvImpl.java:327)#~ at com.ai.saas.c" + - "omment.core.service.impl.EvalutionObjSvImpl$$FastClassBySpringCGLIB$$e4328417.invoke()#~" + - "at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)#~ at org.springframework.a" + - "op.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)#~ at org.s" + - "pringframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)#~" + - "at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(Transactio" + - "nInterceptor.java:99)#~ at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWi" + - "thinTransaction(TransactionAspectSupport.java:281)#~ at org.springframework.transaction.interceptor.T" + - "ransactionInterceptor.invoke(TransactionInterceptor.java:96)#~ at org.springframework.aop.framework.Ref" + - "lectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)#~ at org.springframework.aop.frame" + - "work.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)#~ at com.ai.saas.c" + - "omment.core.service.impl.EvalutionObjSvImpl$$EnhancerBySpringCGLIB$$9d683df1.getCommentsParamters()#~ at com.ai.saas.comment.core.service.impl.EvalutionObjSvImpl$$FastClassBySpringCGLIB$$e43" + - "28417.invoke()#~ at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:2" + - "04)#~ at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAo" + - "pProxy.java:720)#~ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)#~ at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.p" + - "roceed(MethodInvocationProceedingJoinPoint.java:85)#~ at com.a.eye.skywalking.plugin.spring.Tracing" + - "Aspect.doTracing(TracingAspect.java:13)#~ at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown " + - "Source)#~ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)" + - "#~ at java.lang.reflect.Method.invoke(Method.java:606)#~ at org.springframework.aop.aspectj.Abstr" + - "actAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)#~ at org.springfra" + - "mework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)#~ at org.s" + - "pringframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)#~ at org.springfra" + - "mework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)#~ at org.s" + - "pringframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)#~" + - " at com.ai.saas.comment.core.service.impl.EvalutionObjSvImpl$$EnhancerBySpringCGLIB$$312c8477.get" + - "CommentsParamters()#~ at com.ai.saas.comment.core.api.impl.ObjectCommentApiImpl.getCom" + - "mentsParamters(ObjectCommentApiImpl.java:43)#~ at com.alibaba.dubbo.common.bytecode.Wrapper5.invokeMeth" + - "od(Wrapper5.java)#~ at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(Javass" + - "istProxyFactory.java:46)#~ at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxy" + - "Invoker.java:72)#~ at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)#" + - "~ at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)#~ at com.a" + - "libaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)#~ at com.a" + - "libaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)#~ at com.alibaba.dubbo.rpc.protoco" + - "l.Pr@~M@~false@~ @~24702@~saas-comment-servers@~5@~L#&" - }; - -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/list/ArrayListTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/list/ArrayListTest.java deleted file mode 100644 index 6f8a78d53..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/list/ArrayListTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package test.a.eye.cloud.list; - -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** - * Created by xin on 16-7-2. - */ -public class ArrayListTest { - private List data = new ArrayList<>(); - - @Before - public void initData() { - data.add("AAAA"); - data.add("AAAAB"); - data.add("AAAAB"); - data.add("AAAAB"); - } - - @Test - public void testPop() { - data.remove(data.size() - 1); - assertEquals(data.size(), 3); - } - - @Test - public void testPush() { - data.add(data.size(), "BBBBB"); - assertEquals(data.get(data.size() - 1), "BBBBB"); - } -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/logging/LoggingTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/logging/LoggingTest.java deleted file mode 100644 index 0a067674b..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/logging/LoggingTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package test.a.eye.cloud.logging; - -import com.a.eye.skywalking.conf.Config; -import com.a.eye.skywalking.logging.LogManager; -import com.a.eye.skywalking.logging.EasyLogger; -import org.junit.Test; - -public class LoggingTest { - - EasyLogger easyLogger = LogManager.getLogger(LoggingTest.class); - - @Test - public void testNormalLogging() { - easyLogger.debug("Hello World"); - } - - @Test - public void testErrorLogging() { - easyLogger.error("Hello World", new RuntimeException("Failed message")); - } - - @Test - public void testConvertFile() { - Config.Logging.MAX_LOG_FILE_LENGTH = 2400; - easyLogger.error("Hello World", new RuntimeException("Failed message")); - } -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/ExclusionMatcherTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/ExclusionMatcherTest.java deleted file mode 100644 index a2f6ef84f..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/ExclusionMatcherTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package test.a.eye.cloud.matcher; - -import com.a.eye.skywalking.plugin.AbstractClassEnhancePluginDefine; -import com.a.eye.skywalking.plugin.PluginBootstrap; -import com.a.eye.skywalking.plugin.PluginDefineCategory; -import com.a.eye.skywalking.plugin.PluginException; -import junit.framework.TestCase; -import net.bytebuddy.ByteBuddy; -import net.bytebuddy.dynamic.ClassFileLocator; -import net.bytebuddy.dynamic.DynamicType; -import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; -import net.bytebuddy.pool.TypePool; -import org.junit.Test; - -import java.util.List; -import java.util.Map; - -public class ExclusionMatcherTest extends TestCase { - @Test - public void testMatcher() - throws ClassNotFoundException, IllegalAccessException, InstantiationException, InterruptedException, - PluginException { - List pluginDefines = new PluginBootstrap().loadPlugins(); - - PluginDefineCategory category = PluginDefineCategory.category(pluginDefines); - - - for (Map.Entry entry : category - .getExactClassEnhancePluginDefineMapping().entrySet()) { - DynamicType.Builder newClassBuilder = new ByteBuddy() - .rebase(TypePool.Default.ofClassPath().describe(entry.getKey()).resolve(), - ClassFileLocator.ForClassLoader.ofClassPath()); - - newClassBuilder = entry.getValue().define(entry.getKey(), newClassBuilder); - newClassBuilder.make().load(ClassLoader.getSystemClassLoader(), ClassLoadingStrategy.Default.INJECTION) - .getLoaded(); - } - - TestMatcherClass testMatcherClass = - (TestMatcherClass) Class.forName("TestMatcherClass").newInstance(); - - testMatcherClass.set(); - testMatcherClass.seta("a"); - testMatcherClass.get("a"); - testMatcherClass.find(); - System.out.println(testMatcherClass.toString()); - testMatcherClass.equals(new TestMatcherClass()); - } - -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestAroundInterceptor.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestAroundInterceptor.java deleted file mode 100644 index 065e4d0cb..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestAroundInterceptor.java +++ /dev/null @@ -1,28 +0,0 @@ -package test.a.eye.cloud.matcher; - -import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult; - -/** - * Created by xin on 16-6-8. - */ -public class TestAroundInterceptor implements InstanceMethodsAroundInterceptor { - @Override - public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext, MethodInterceptResult result) { - System.out.println("before method"); - } - - @Override - public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext, Object ret) { - System.out.println("after method"); - return ret; - } - - @Override - public void handleMethodException(Throwable t, EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext) { - - } -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestMatcherClass.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestMatcherClass.java deleted file mode 100644 index 1a5b60e19..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestMatcherClass.java +++ /dev/null @@ -1,39 +0,0 @@ -package test.a.eye.cloud.matcher; - -/** - * Created by xin on 16-6-8. - */ -public class TestMatcherClass { - - public void set() { - System.out.println("public set()"); - } - - public void seta(String a) { - System.out.println("public seta(String a)"); - set(a); - } - - private void set(String a) { - System.out.println("private set(String a)"); - } - - public void get(String a) { - System.out.println("public get(String a)"); - } - - public void find() { - System.out.println("public find()"); - } - - @Override - public String toString() { - return "Call toString()"; - } - - @Override - public boolean equals(Object obj) { - System.out.println("equals(Object obj)"); - return true; - } -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestMatcherDefine.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestMatcherDefine.java deleted file mode 100644 index 01368d7ab..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/matcher/TestMatcherDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -package test.a.eye.cloud.matcher; - -import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint; -import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; -import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; -import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; -import com.a.eye.skywalking.plugin.interceptor.matcher.PrivateMethodMatcher; - -/** - * Created by xin on 16-6-8. - */ -public class TestMatcherDefine extends ClassInstanceMethodsEnhancePluginDefine { - @Override - public String enhanceClassName() { - return "test.a.eye.cloud.matcher.TestMatcherClass"; - } - - @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { - return null; - } - - @Override - protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] {new InstanceMethodsInterceptPoint() { - @Override - public MethodMatcher[] getMethodsMatchers() { - // return new MethodMatcher[]{ - // new PrivateMethodMatcher(), - // new MethodsExclusiveMatcher(new SimpleMethodMatcher("set")), - // new SimpleMethodMatcher(MethodMatcher.Modifier.Private, "set", 1) - // }; - // return new MethodMatcher[] { new SimpleMethodMatcher(Modifier.Public, "printabc", new Class[]{String.class, String.class}) }; - return new MethodMatcher[] {new PrivateMethodMatcher()}; - //return new MethodMatcher[]{new AnyMethodsMatcher()}; - //return new MethodMatcher[]{new MethodsExclusiveMatcher(new SimpleMethodMatcher("set"), new SimpleMethodMatcher(MethodMatcher.Modifier.Public,"get"))}; - } - - @Override - public String getMethodsInterceptor() { - return "test.a.eye.cloud.matcher.TestAroundInterceptor"; - } - }}; - } -} diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/PluginMainTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/PluginMainTest.java index 2ed23222f..ed6b94014 100644 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/PluginMainTest.java +++ b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/PluginMainTest.java @@ -9,7 +9,7 @@ import java.lang.reflect.InvocationTargetException; public class PluginMainTest { @Test public void testMain() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, PluginException { - TracingBootstrap.main(new String[] {"PluginMainTest"}); + TracingBootstrap.main(new String[] {"test.a.eye.cloud.plugin.PluginMainTest"}); } public static void main(String[] args) @@ -17,7 +17,7 @@ public class PluginMainTest { SecurityException { long start = System.currentTimeMillis(); - BeInterceptedClass inst = (BeInterceptedClass) Class.forName("BeInterceptedClass").newInstance(); + BeInterceptedClass inst = (BeInterceptedClass) Class.forName("test.a.eye.cloud.plugin.BeInterceptedClass").newInstance(); inst.printabc(); long end = System.currentTimeMillis(); System.out.println(end - start + "ms"); diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestAroundInterceptor.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestAroundInterceptor.java index cf0e69802..eefd42e60 100644 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestAroundInterceptor.java +++ b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestAroundInterceptor.java @@ -8,12 +8,6 @@ import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult; public class TestAroundInterceptor implements InstanceMethodsAroundInterceptor { - @Override - public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { - context.set("test.key", "123"); - System.out.println("onConstruct, args size=" + interceptorContext.allArguments().length); - } - @Override public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext, MethodInterceptResult result) { System.out.println("beforeMethod : " + context.get("test.key", String.class)); diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestInterceptorDefine.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestInterceptorDefine.java index 39f11ead7..dba4bc8cf 100644 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestInterceptorDefine.java +++ b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/plugin/TestInterceptorDefine.java @@ -1,6 +1,9 @@ package test.a.eye.cloud.plugin; +import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint; +import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; +import com.a.eye.skywalking.plugin.interceptor.StaticMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.enhance.ClassEnhancePluginDefine; import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher; @@ -12,23 +15,37 @@ public class TestInterceptorDefine extends ClassEnhancePluginDefine { } @Override - public MethodMatcher[] getInstanceMethodsMatchers() { - return new MethodMatcher[] { new SimpleMethodMatcher("printabc") }; + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return null; } @Override - public String getInstanceMethodsInterceptor() { - return "TestAroundInterceptor"; + protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() { + @Override + public MethodMatcher[] getMethodsMatchers() { + return new MethodMatcher[]{new SimpleMethodMatcher("printabc")}; + } + + @Override + public String getMethodsInterceptor() { + return "TestAroundInterceptor"; + } + }}; } @Override - protected MethodMatcher[] getStaticMethodsMatchers() { - return new MethodMatcher[] { new SimpleMethodMatcher("call") }; - } + protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() { + return new StaticMethodsInterceptPoint[]{new StaticMethodsInterceptPoint() { + @Override + public MethodMatcher[] getMethodsMatchers() { + return new MethodMatcher[]{new SimpleMethodMatcher("call")}; + } - @Override - protected String getStaticMethodsInterceptor() { - return "TestStaticAroundInterceptor"; + @Override + public String getMethodsInterceptor() { + return "TestStaticAroundInterceptor"; + } + }}; } - } diff --git a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/serialize/SerializeTest.java b/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/serialize/SerializeTest.java deleted file mode 100644 index 3dc352830..000000000 --- a/skywalking-sniffer/skywalking-api/src/test/java/test/a/eye/cloud/serialize/SerializeTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package test.a.eye.cloud.serialize; - -import com.a.eye.skywalking.buffer.ContextBuffer; -import com.a.eye.skywalking.protocol.AckSpan; -import com.a.eye.skywalking.model.Span; -import com.a.eye.skywalking.protocol.common.SpanType; - -public class SerializeTest { - public static void main(String[] args) throws InterruptedException { - while (true) { - Span spandata = new Span("1.0b.1461060884539.7d6d06e.22489.1271.103", "", 0, "test-application", "test"); - spandata.setSpanType(SpanType.LOCAL); - spandata.setStartDate(System.currentTimeMillis() - 1000 * 60); - AckSpan requestSpan = new AckSpan(spandata); - ContextBuffer.save(requestSpan); - Thread.sleep(500); - } - - } -} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/main/java/com/a/eye/skywalking/plugin/dubbo/DubboPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/main/java/com/a/eye/skywalking/plugin/dubbo/DubboPluginDefine.java index ff888c896..d0e22d93d 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/main/java/com/a/eye/skywalking/plugin/dubbo/DubboPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/main/java/com/a/eye/skywalking/plugin/dubbo/DubboPluginDefine.java @@ -13,7 +13,7 @@ public class DubboPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { } @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return null; } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/com/a/eye/skywalking/plugin/httpClient/v4/define/HttpClientPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/com/a/eye/skywalking/plugin/httpClient/v4/define/HttpClientPluginDefine.java index 6a50a46d5..b068b71ae 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/com/a/eye/skywalking/plugin/httpClient/v4/define/HttpClientPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/com/a/eye/skywalking/plugin/httpClient/v4/define/HttpClientPluginDefine.java @@ -5,7 +5,7 @@ import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhan public abstract class HttpClientPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return null; } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java index 8c36f9a48..8cbd28861 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java @@ -8,7 +8,7 @@ import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhan public abstract class AbstractDatabasePluginDefine extends ClassInstanceMethodsEnhancePluginDefine { @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return null; } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterConstructorInterceptor4HostAndPortArg.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterConstructorInterceptor4HostAndPortArg.java new file mode 100644 index 000000000..26c4da2eb --- /dev/null +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterConstructorInterceptor4HostAndPortArg.java @@ -0,0 +1,23 @@ +package com.a.eye.skywalking.plugin.jedis.v2; + +import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; +import redis.clients.jedis.HostAndPort; + +import java.util.Set; + +import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.REDIS_CONN_INFO_KEY; + +/** + * Created by xin on 16-6-12. + */ +public class JedisClusterConstructorInterceptor4HostAndPortArg implements InstanceConstructorInterceptor { + @Override + public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { + StringBuilder redisConnInfo = new StringBuilder(); + HostAndPort hostAndPort = (HostAndPort) interceptorContext.allArguments()[0]; + redisConnInfo.append(hostAndPort.toString()).append(";"); + context.set(REDIS_CONN_INFO_KEY, redisConnInfo.toString()); + } +} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterConstructorInterceptor4SetArg.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterConstructorInterceptor4SetArg.java new file mode 100644 index 000000000..f630bb1c2 --- /dev/null +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterConstructorInterceptor4SetArg.java @@ -0,0 +1,26 @@ +package com.a.eye.skywalking.plugin.jedis.v2; + +import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; + +import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; +import redis.clients.jedis.HostAndPort; + +import java.util.Set; + +import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.REDIS_CONN_INFO_KEY; + +/** + * Created by xin on 16-6-12. + */ +public class JedisClusterConstructorInterceptor4SetArg implements InstanceConstructorInterceptor { + @Override + public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { + StringBuilder redisConnInfo = new StringBuilder(); + Set hostAndPorts = (Set) interceptorContext.allArguments()[0]; + for (HostAndPort hostAndPort : hostAndPorts) { + redisConnInfo.append(hostAndPort.toString()).append(";"); + } + context.set(REDIS_CONN_INFO_KEY, redisConnInfo.toString()); + } +} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterInterceptor.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterInterceptor.java deleted file mode 100644 index a8f670de7..000000000 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterInterceptor.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.a.eye.skywalking.plugin.jedis.v2; - -import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; - -import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; -import redis.clients.jedis.HostAndPort; - -import java.util.Set; - -/** - * Created by xin on 16-6-12. - */ -public class JedisClusterInterceptor extends JedisBaseInterceptor implements InstanceConstructorInterceptor { - @Override - public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { - StringBuilder redisConnInfo = new StringBuilder(); - if (interceptorContext.allArguments().length > 0) { - if (interceptorContext.allArguments()[0] instanceof Set) { - @SuppressWarnings("unchecked") - Set hostAndPorts = (Set) interceptorContext.allArguments()[0]; - for (HostAndPort hostAndPort : hostAndPorts) { - redisConnInfo.append(hostAndPort.toString()).append(";"); - } - } else if (interceptorContext.allArguments()[0] instanceof HostAndPort) { - HostAndPort hostAndPort = (HostAndPort) interceptorContext.allArguments()[0]; - redisConnInfo.append(hostAndPort.toString()).append(";"); - } - } - context.set(REDIS_CONN_INFO_KEY, redisConnInfo.toString()); - } -} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4ShardInfoArg.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4ShardInfoArg.java new file mode 100644 index 000000000..dff6b2800 --- /dev/null +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4ShardInfoArg.java @@ -0,0 +1,24 @@ +package com.a.eye.skywalking.plugin.jedis.v2; + +import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; +import redis.clients.jedis.JedisShardInfo; + +import java.net.URI; + +import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.REDIS_CONN_INFO_KEY; + +/** + * Created by wusheng on 2016/12/1. + */ +public class JedisConstructorInterceptor4ShardInfoArg implements InstanceConstructorInterceptor { + + @Override + public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { + String redisConnInfo; + JedisShardInfo shardInfo = (JedisShardInfo) interceptorContext.allArguments()[0]; + redisConnInfo = shardInfo.getHost() + ":" + shardInfo.getPort(); + context.set(REDIS_CONN_INFO_KEY, redisConnInfo); + } +} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4StringArg.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4StringArg.java new file mode 100644 index 000000000..6b64925dc --- /dev/null +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4StringArg.java @@ -0,0 +1,24 @@ +package com.a.eye.skywalking.plugin.jedis.v2; + +import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; +import redis.clients.jedis.JedisShardInfo; + +import java.net.URI; + +import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.REDIS_CONN_INFO_KEY; + +public class JedisConstructorInterceptor4StringArg implements InstanceConstructorInterceptor { + + @Override + public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { + String redisConnInfo; + redisConnInfo = (String) interceptorContext.allArguments()[0]; + if (interceptorContext.allArguments().length > 1) { + redisConnInfo += ":" + interceptorContext.allArguments()[1]; + } + context.set(REDIS_CONN_INFO_KEY, redisConnInfo); + } + +} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4UriArg.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4UriArg.java new file mode 100644 index 000000000..d5fa5ad29 --- /dev/null +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisConstructorInterceptor4UriArg.java @@ -0,0 +1,23 @@ +package com.a.eye.skywalking.plugin.jedis.v2; + +import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; +import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; + +import java.net.URI; + +import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.REDIS_CONN_INFO_KEY; + +/** + * Created by wusheng on 2016/12/1. + */ +public class JedisConstructorInterceptor4UriArg implements InstanceConstructorInterceptor { + + @Override + public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { + String redisConnInfo; + URI uri = (URI) interceptorContext.allArguments()[0]; + redisConnInfo = uri.getHost() + ":" + uri.getPort(); + context.set(REDIS_CONN_INFO_KEY, redisConnInfo); + } +} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisInterceptor.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisInterceptor.java deleted file mode 100644 index 83911a61f..000000000 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisInterceptor.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.a.eye.skywalking.plugin.jedis.v2; - -import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext; -import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor; -import redis.clients.jedis.JedisShardInfo; - -import java.net.URI; - -public class JedisInterceptor extends JedisBaseInterceptor implements InstanceConstructorInterceptor { - - @Override - public void onConstruct(EnhancedClassInstanceContext context, - ConstructorInvokeContext interceptorContext) { - String redisConnInfo = ""; - if (interceptorContext.allArguments().length > 0) { - if (interceptorContext.allArguments()[0] instanceof String) { - redisConnInfo = (String) interceptorContext.allArguments()[0]; - if (interceptorContext.allArguments().length > 1) { - redisConnInfo += ":" - + (Integer) interceptorContext.allArguments()[1]; - } - } else if (interceptorContext.allArguments()[0] instanceof JedisShardInfo) { - JedisShardInfo shardInfo = (JedisShardInfo) interceptorContext - .allArguments()[0]; - redisConnInfo = shardInfo.getHost() + ":" + shardInfo.getPort(); - } else if (interceptorContext.allArguments()[0] instanceof URI) { - URI uri = (URI) interceptorContext.allArguments()[0]; - redisConnInfo = uri.getHost() + ":" + uri.getPort(); - } - } - context.set(REDIS_CONN_INFO_KEY, redisConnInfo); - } - -} diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisBaseInterceptor.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptor.java similarity index 96% rename from skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisBaseInterceptor.java rename to skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptor.java index 054391b23..1d2858a95 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisBaseInterceptor.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptor.java @@ -7,7 +7,7 @@ import com.a.eye.skywalking.plugin.interceptor.assist.SimpleObjectFirstInvokeInt import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext; import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult; -public abstract class JedisBaseInterceptor extends SimpleObjectFirstInvokeInterceptor { +public class JedisMethodInterceptor extends SimpleObjectFirstInvokeInterceptor { protected static final String REDIS_CONN_INFO_KEY = "redisClusterConnInfo"; private static RPCClientInvokeMonitor rpcClientInvokeMonitor = new RPCClientInvokeMonitor(); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java index 89abe3a20..2d791ee9e 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java @@ -5,6 +5,13 @@ import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; import com.a.eye.skywalking.plugin.interceptor.matcher.AnyMethodsMatcher; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; + +import java.util.Set; + +import static net.bytebuddy.matcher.ElementMatchers.not; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; public class JedisClusterPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { @@ -14,29 +21,41 @@ public class JedisClusterPluginDefine extends ClassInstanceMethodsEnhancePluginD } @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { - return new ConstructorInterceptPoint(){ + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return takesArgument(0, Set.class); + } @Override public String getConstructorInterceptor() { - return "com.a.eye.skywalking.plugin.jedis.v2.JedisClusterInterceptor"; + return "com.a.eye.skywalking.plugin.jedis.v2.JedisClusterConstructorInterceptor4SetArg"; } - }; + }, new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return not(takesArgument(0, Set.class)); + } + + @Override + public String getConstructorInterceptor() { + return "com.a.eye.skywalking.plugin.jedis.v2.JedisClusterConstructorInterceptor4HostAndPortArg"; + } + }}; } @Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() { + return new InstanceMethodsInterceptPoint[] {new InstanceMethodsInterceptPoint() { @Override public MethodMatcher[] getMethodsMatchers() { - return new MethodMatcher[]{ - new AnyMethodsMatcher() - }; + return new MethodMatcher[] {new AnyMethodsMatcher()}; } @Override public String getMethodsInterceptor() { - return "com.a.eye.skywalking.plugin.jedis.v2.JedisClusterInterceptor"; + return "com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor"; } }}; } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java index fbcf6e455..e0e402bce 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java @@ -2,11 +2,16 @@ package com.a.eye.skywalking.plugin.jedis.v2.define; import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; -import com.a.eye.skywalking.plugin.interceptor.matcher.MethodsExclusiveMatcher; -import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import com.a.eye.skywalking.plugin.interceptor.matcher.MethodsExclusiveMatcher; import com.a.eye.skywalking.plugin.interceptor.matcher.PrivateMethodMatcher; +import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; + +import static net.bytebuddy.matcher.ElementMatchers.not; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; public class JedisPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { @@ -16,37 +21,53 @@ public class JedisPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { } @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { - return new ConstructorInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return takesArgument(0, String.class); + } + @Override public String getConstructorInterceptor() { - return "com.a.eye.skywalking.plugin.jedis.v2.JedisInterceptor"; + return "com.a.eye.skywalking.plugin.jedis.v2.JedisConstructorInterceptor4StringArg"; } - }; + }, new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return not(takesArgument(0, String.class).or(takesArgument(0, String.class))); + } + + @Override + public String getConstructorInterceptor() { + return "com.a.eye.skywalking.plugin.jedis.v2.JedisConstructorInterceptor4ShardInfoArgg"; + } + }, new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return takesArgument(0, String.class); + } + + @Override + public String getConstructorInterceptor() { + return "com.a.eye.skywalking.plugin.jedis.v2.JedisConstructorInterceptor4UriArg"; + } + }}; } @Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() { + return new InstanceMethodsInterceptPoint[] {new InstanceMethodsInterceptPoint() { @Override public MethodMatcher[] getMethodsMatchers() { - return new MethodMatcher[]{ - new MethodsExclusiveMatcher( - new PrivateMethodMatcher(), - new SimpleMethodMatcher("close"), - new SimpleMethodMatcher("getDB"), - new SimpleMethodMatcher("connect"), - new SimpleMethodMatcher("setDataSource"), - new SimpleMethodMatcher("resetState"), - new SimpleMethodMatcher("clusterSlots"), - new SimpleMethodMatcher("checkIsInMultiOrPipeline") - ) - }; + return new MethodMatcher[] {new MethodsExclusiveMatcher(new PrivateMethodMatcher(), new SimpleMethodMatcher("close"), new SimpleMethodMatcher("getDB"), + new SimpleMethodMatcher("connect"), new SimpleMethodMatcher("setDataSource"), new SimpleMethodMatcher("resetState"), + new SimpleMethodMatcher("clusterSlots"), new SimpleMethodMatcher("checkIsInMultiOrPipeline"))}; } @Override public String getMethodsInterceptor() { - return "com.a.eye.skywalking.plugin.jedis.v2.JedisInterceptor"; + return "com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor"; } }}; } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterTest.java index 0b0eb0668..ee068eae6 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisClusterTest.java @@ -13,10 +13,9 @@ import java.util.HashSet; import java.util.Set; public class JedisClusterTest { - @Test public void test() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, PluginException { - TracingBootstrap.main(new String[] {"JedisClusterTest"}); + TracingBootstrap.main(new String[] {"com.a.eye.skywalking.plugin.jedis.v2.JedisClusterTest"}); } public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisTest.java index 1046984c0..e6928ac1c 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisTest.java @@ -10,7 +10,6 @@ import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; public class JedisTest { - @Test public void test() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, PluginException { TracingBootstrap.main(new String[] {"JedisTest"}); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java index 4c7b4470c..c0fef90c7 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java @@ -5,6 +5,10 @@ import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; + +import static net.bytebuddy.matcher.ElementMatchers.any; public class MotanClientDefine extends ClassInstanceMethodsEnhancePluginDefine { @Override @@ -13,29 +17,32 @@ public class MotanClientDefine extends ClassInstanceMethodsEnhancePluginDefine { } @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { - return new ConstructorInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return any(); + } + @Override public String getConstructorInterceptor() { return "com.a.eye.skywalking.plugin.motan.MotanClientInterceptor"; } - }; + }}; } @Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[]{ - new InstanceMethodsInterceptPoint() { - @Override - public MethodMatcher[] getMethodsMatchers() { - return new MethodMatcher[] {new SimpleMethodMatcher("call")}; - } + return new InstanceMethodsInterceptPoint[] {new InstanceMethodsInterceptPoint() { + @Override + public MethodMatcher[] getMethodsMatchers() { + return new MethodMatcher[] {new SimpleMethodMatcher("call")}; + } - @Override - public String getMethodsInterceptor() { - return "com.a.eye.skywalking.plugin.motan.MotanClientInterceptor"; - } - } - }; + @Override + public String getMethodsInterceptor() { + return "com.a.eye.skywalking.plugin.motan.MotanClientInterceptor"; + } + }}; } } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java index 245199d5e..f998934ea 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java @@ -5,6 +5,10 @@ import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; + +import static net.bytebuddy.matcher.ElementMatchers.any; public class MotanServerDefine extends ClassInstanceMethodsEnhancePluginDefine { @@ -14,18 +18,23 @@ public class MotanServerDefine extends ClassInstanceMethodsEnhancePluginDefine { } @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { - return new ConstructorInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { + @Override + public ElementMatcher.Junction getConstructorMatcher() { + return any(); + } + @Override public String getConstructorInterceptor() { return "com.a.eye.skywalking.plugin.motan.MotanServerInterceptor"; } - }; + }}; } @Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() { + return new InstanceMethodsInterceptPoint[] {new InstanceMethodsInterceptPoint() { @Override public MethodMatcher[] getMethodsMatchers() { return new MethodMatcher[] {new SimpleMethodMatcher("call")}; diff --git a/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/com/a/eye/skywalking/plugin/tomcat78x/define/TomcatPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/com/a/eye/skywalking/plugin/tomcat78x/define/TomcatPluginDefine.java index bab15eba4..8f77846f6 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/com/a/eye/skywalking/plugin/tomcat78x/define/TomcatPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/com/a/eye/skywalking/plugin/tomcat78x/define/TomcatPluginDefine.java @@ -13,7 +13,7 @@ public class TomcatPluginDefine extends ClassInstanceMethodsEnhancePluginDefine } @Override - protected ConstructorInterceptPoint getConstructorsInterceptPoint() { + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return null; }