Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassMethodInterceptor.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,11 +51,11 @@ public class ClassMethodInterceptor { } 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); } throw t; }finally { try { ret = interceptor.afterMethod(instanceContext, interceptorContext, ret); Loading skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java +10 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import net.bytebuddy.implementation.MethodDelegation; import net.bytebuddy.implementation.SuperMethodCall; import net.bytebuddy.implementation.bind.annotation.FieldProxy; import net.bytebuddy.pool.TypePool; import net.bytebuddy.pool.TypePool.Resolution; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; Loading Loading @@ -59,6 +60,14 @@ public class EnhanceClazz4Interceptor { logger.debug("prepare to enhance class {} by {}.", enhanceOriginClassName, interceptorDefineClassName); Resolution resolution = typePool.describe(enhanceOriginClassName); if(!resolution.isResolved()){ logger.warn("class {} can't be resolved, enhance by {} failue.", enhanceOriginClassName, interceptorDefineClassName); return; } /** * rename origin class <br/> * add '$$Origin' at the end of be enhanced classname <br/> Loading @@ -67,7 +76,7 @@ public class EnhanceClazz4Interceptor { */ String renameClassName = enhanceOriginClassName + "$$Origin"; Class<?> originClass = new ByteBuddy() .redefine(typePool.describe(enhanceOriginClassName).resolve(), .redefine(resolution.resolve(), ClassFileLocator.ForClassLoader.ofClassPath()) .name(renameClassName) .make() Loading skywalking-api/src/test/java/test/ai/cloud/bytebuddy/SimulateMain.java +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ public class SimulateMain { public static void main(String[] args) throws NoSuchFieldException, SecurityException, InstantiationException, IllegalAccessException, ClassNotFoundException { TypePool typePool = TypePool.Default.ofClassPath(); System.out.println(typePool.describe("test.ai.cloud.bytebuddy.TestClass").isResolved()); Class<?> newClazz = new ByteBuddy() .redefine( Loading skywalking-sdk-plugin/httpclient-4.3.x-plugin/pom.xml +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.3</version> <scope>compile</scope> </dependency> </dependencies> <build> Loading skywalking-sdk-plugin/pom.xml +3 −12 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.ai.cloud</groupId> Loading @@ -14,6 +13,7 @@ <module>web-plugin</module> <module>httpclient-4.2.x-plugin</module> <module>httpclient-4.3.x-plugin</module> <module>skywalking-httpClient-4.x-plugin</module> </modules> <packaging>pom</packaging> Loading Loading @@ -53,13 +53,4 @@ </plugin> </plugins> </build> <!--发布 --> <distributionManagement> <snapshotRepository> <id>company-private-nexus-library-snapshots</id> <name>company-private-nexus-library-snapshots</name> <url>http://10.1.228.199:18081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> </project> No newline at end of file Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassMethodInterceptor.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,11 +51,11 @@ public class ClassMethodInterceptor { } 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); } throw t; }finally { try { ret = interceptor.afterMethod(instanceContext, interceptorContext, ret); Loading
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java +10 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import net.bytebuddy.implementation.MethodDelegation; import net.bytebuddy.implementation.SuperMethodCall; import net.bytebuddy.implementation.bind.annotation.FieldProxy; import net.bytebuddy.pool.TypePool; import net.bytebuddy.pool.TypePool.Resolution; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; Loading Loading @@ -59,6 +60,14 @@ public class EnhanceClazz4Interceptor { logger.debug("prepare to enhance class {} by {}.", enhanceOriginClassName, interceptorDefineClassName); Resolution resolution = typePool.describe(enhanceOriginClassName); if(!resolution.isResolved()){ logger.warn("class {} can't be resolved, enhance by {} failue.", enhanceOriginClassName, interceptorDefineClassName); return; } /** * rename origin class <br/> * add '$$Origin' at the end of be enhanced classname <br/> Loading @@ -67,7 +76,7 @@ public class EnhanceClazz4Interceptor { */ String renameClassName = enhanceOriginClassName + "$$Origin"; Class<?> originClass = new ByteBuddy() .redefine(typePool.describe(enhanceOriginClassName).resolve(), .redefine(resolution.resolve(), ClassFileLocator.ForClassLoader.ofClassPath()) .name(renameClassName) .make() Loading
skywalking-api/src/test/java/test/ai/cloud/bytebuddy/SimulateMain.java +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ public class SimulateMain { public static void main(String[] args) throws NoSuchFieldException, SecurityException, InstantiationException, IllegalAccessException, ClassNotFoundException { TypePool typePool = TypePool.Default.ofClassPath(); System.out.println(typePool.describe("test.ai.cloud.bytebuddy.TestClass").isResolved()); Class<?> newClazz = new ByteBuddy() .redefine( Loading
skywalking-sdk-plugin/httpclient-4.3.x-plugin/pom.xml +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.3</version> <scope>compile</scope> </dependency> </dependencies> <build> Loading
skywalking-sdk-plugin/pom.xml +3 −12 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.ai.cloud</groupId> Loading @@ -14,6 +13,7 @@ <module>web-plugin</module> <module>httpclient-4.2.x-plugin</module> <module>httpclient-4.3.x-plugin</module> <module>skywalking-httpClient-4.x-plugin</module> </modules> <packaging>pom</packaging> Loading Loading @@ -53,13 +53,4 @@ </plugin> </plugins> </build> <!--发布 --> <distributionManagement> <snapshotRepository> <id>company-private-nexus-library-snapshots</id> <name>company-private-nexus-library-snapshots</name> <url>http://10.1.228.199:18081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> </project> No newline at end of file