Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java +4 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ public class EnhanceClazz4Interceptor { InterceptPoint[] methodNameList = define.getBeInterceptedMethods(); ClassMethodInterceptor classMethodInterceptor = new ClassMethodInterceptor( interceptor); for (InterceptPoint method : methodNameList) { logger.debug("prepare to enhance class {} method [{}] ", enhanceOriginClassName, method.getMethodName()); Loading @@ -134,6 +135,9 @@ public class EnhanceClazz4Interceptor { named(method.getMethodName()).and( takesArguments(method.getArgNum()))).intercept( MethodDelegation.to(classMethodInterceptor)); } else if("*".equals(method.getMethodName())){ newClassBuilder = newClassBuilder.method(any()).intercept( MethodDelegation.to(classMethodInterceptor)); } else { newClassBuilder = newClassBuilder.method( named(method.getMethodName())).intercept( Loading skywalking-sdk-plugin/pom.xml +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ <module>httpclient-4.3.x-plugin</module> <module>httpClient-4.x-plugin</module> <module>httpClient-4.x-plugin-dubbox-rest-attachment</module> <module>jedis-2.x-plugin</module> </modules> <packaging>pom</packaging> Loading skywalking-sdk-plugin/skywalking-jedis-2.x-plugin/pom.xml 0 → 100644 +70 −0 Original line number Diff line number Diff line <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.ai.cloud</groupId> <artifactId>skywalking-sdk-plugin</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>skywalking-jedis-2.x-plugin</artifactId> <packaging>jar</packaging> <name>jedis-2.x-plugin</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>com.ai.cloud</groupId> <artifactId>skywalking-api</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.8.1</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.4.1</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3</version> <configuration> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> </build> </project> skywalking-sdk-plugin/skywalking-jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/JedisInterceptor.java 0 → 100644 +35 −0 Original line number Diff line number Diff line package org.skywalking.jedis.v2.plugin; import com.ai.cloud.skywalking.plugin.interceptor.ConstructorInvokeContext; import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext; import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor; import com.ai.cloud.skywalking.plugin.interceptor.MethodInvokeContext; public class JedisInterceptor implements IAroundInterceptor{ @Override public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { } @Override public void beforeMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext) { } @Override public Object afterMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) { return ret; } @Override public void handleMethodException(Throwable t, EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) { } } skywalking-sdk-plugin/skywalking-jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java 0 → 100644 +26 −0 Original line number Diff line number Diff line package org.skywalking.jedis.v2.plugin.define; import org.skywalking.jedis.v2.plugin.JedisInterceptor; import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor; import com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint; import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine; public class JedisPluginDefine implements InterceptorDefine { @Override public String getBeInterceptedClassName() { return "redis.clients.jedis.Jedis"; } @Override public InterceptPoint[] getBeInterceptedMethods() { return new InterceptPoint[] { new InterceptPoint("*") }; } @Override public IAroundInterceptor instance() { return new JedisInterceptor(); } } Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java +4 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ public class EnhanceClazz4Interceptor { InterceptPoint[] methodNameList = define.getBeInterceptedMethods(); ClassMethodInterceptor classMethodInterceptor = new ClassMethodInterceptor( interceptor); for (InterceptPoint method : methodNameList) { logger.debug("prepare to enhance class {} method [{}] ", enhanceOriginClassName, method.getMethodName()); Loading @@ -134,6 +135,9 @@ public class EnhanceClazz4Interceptor { named(method.getMethodName()).and( takesArguments(method.getArgNum()))).intercept( MethodDelegation.to(classMethodInterceptor)); } else if("*".equals(method.getMethodName())){ newClassBuilder = newClassBuilder.method(any()).intercept( MethodDelegation.to(classMethodInterceptor)); } else { newClassBuilder = newClassBuilder.method( named(method.getMethodName())).intercept( Loading
skywalking-sdk-plugin/pom.xml +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ <module>httpclient-4.3.x-plugin</module> <module>httpClient-4.x-plugin</module> <module>httpClient-4.x-plugin-dubbox-rest-attachment</module> <module>jedis-2.x-plugin</module> </modules> <packaging>pom</packaging> Loading
skywalking-sdk-plugin/skywalking-jedis-2.x-plugin/pom.xml 0 → 100644 +70 −0 Original line number Diff line number Diff line <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.ai.cloud</groupId> <artifactId>skywalking-sdk-plugin</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>skywalking-jedis-2.x-plugin</artifactId> <packaging>jar</packaging> <name>jedis-2.x-plugin</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>com.ai.cloud</groupId> <artifactId>skywalking-api</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.8.1</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.4.1</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3</version> <configuration> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> </build> </project>
skywalking-sdk-plugin/skywalking-jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/JedisInterceptor.java 0 → 100644 +35 −0 Original line number Diff line number Diff line package org.skywalking.jedis.v2.plugin; import com.ai.cloud.skywalking.plugin.interceptor.ConstructorInvokeContext; import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext; import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor; import com.ai.cloud.skywalking.plugin.interceptor.MethodInvokeContext; public class JedisInterceptor implements IAroundInterceptor{ @Override public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) { } @Override public void beforeMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext) { } @Override public Object afterMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) { return ret; } @Override public void handleMethodException(Throwable t, EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) { } }
skywalking-sdk-plugin/skywalking-jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java 0 → 100644 +26 −0 Original line number Diff line number Diff line package org.skywalking.jedis.v2.plugin.define; import org.skywalking.jedis.v2.plugin.JedisInterceptor; import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor; import com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint; import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine; public class JedisPluginDefine implements InterceptorDefine { @Override public String getBeInterceptedClassName() { return "redis.clients.jedis.Jedis"; } @Override public InterceptPoint[] getBeInterceptedMethods() { return new InterceptPoint[] { new InterceptPoint("*") }; } @Override public IAroundInterceptor instance() { return new JedisInterceptor(); } }