diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml index 2717502fac958626182517505baca1c0b8400e54..dc492895dbcdc98a074e9dfe1f74fabc1860b476 100644 --- a/apm-sniffer/apm-sdk-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/pom.xml @@ -53,7 +53,7 @@ elastic-job-2.x-plugin mongodb-2.x-plugin httpasyncclient-4.x-plugin - servicecomb-java-chassis-plugin + servicecomb-plugin pom diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1668c70203511ce08ce57f0cca63182c0eefc2b3 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/pom.xml @@ -0,0 +1,26 @@ + + + + apm-sdk-plugin + org.apache.skywalking + 5.0.0-alpha + + 4.0.0 + + servicecomb-plugin + + + servicecomb-java-chassis-0.x-plugin + + pom + + apm-sdk-plugin + http://maven.apache.org + + + UTF-8 + /.. + + \ No newline at end of file diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/pom.xml similarity index 93% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/pom.xml rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/pom.xml index afd9a30310f50a740ec363f50ccd55f030abfd9e..ff52581b04948b2762211481e1ea2358c7f717c9 100644 --- a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/pom.xml @@ -3,16 +3,16 @@ 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"> - apm-sdk-plugin + servicecomb-plugin org.apache.skywalking 5.0.0-alpha 4.0.0 - apm-servicecomb-java-chassis-plugin + apm-servicecomb-java-chassis-0.x-plugin jar - servicecomb-java-chassis-plugin + servicecomb-java-chassis-0.x-plugin http://maven.apache.org diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptor.java b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptor.java similarity index 96% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptor.java rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptor.java index 4e2c4e7e9e4453fa67d086f6efefc8bf5166ab58..d27ad355557af998f9bc9de732eca44e6a5237e5 100644 --- a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptor.java @@ -18,12 +18,12 @@ package org.apache.skywalking.apm.plugin.servicecomb; -import java.lang.reflect.Method; -import javax.ws.rs.core.Response.StatusType; import io.servicecomb.core.Invocation; -import io.servicecomb.swagger.invocation.InvocationType; +import io.servicecomb.swagger.invocation.InvocationType; import io.servicecomb.swagger.invocation.SwaggerInvocation; -import io.servicecomb.swagger.invocation.context.InvocationContext; +import io.servicecomb.swagger.invocation.context.InvocationContext; +import java.lang.reflect.Method; +import javax.ws.rs.core.Response.StatusType; import org.apache.skywalking.apm.agent.core.context.CarrierItem; import org.apache.skywalking.apm.agent.core.context.ContextCarrier; import org.apache.skywalking.apm.agent.core.context.ContextManager; @@ -36,7 +36,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; /** - * {@link InvocationInterceptor} define how to enhance class {@link Invocation#getHandlerChain()}. + * {@link InvocationInterceptor} define how to enhance class {@link Invocation#getHandlerContext()}. * * @author lytscu */ diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptor.java b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptor.java similarity index 95% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptor.java rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptor.java index e169ec24fa4747eb33250bd0a0e335ffd89b907e..24a7ee3dac85cf10d595b9b8defeeeaf529a2afc 100644 --- a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptor.java @@ -23,6 +23,7 @@ import io.servicecomb.swagger.invocation.InvocationType; import io.servicecomb.swagger.invocation.SwaggerInvocation; import io.servicecomb.swagger.invocation.context.InvocationContext; import java.lang.reflect.Method; +import java.net.URI; import javax.ws.rs.core.Response.StatusType; import org.apache.skywalking.apm.agent.core.context.CarrierItem; import org.apache.skywalking.apm.agent.core.context.ContextCarrier; @@ -60,8 +61,10 @@ public class NextInterceptor implements InstanceMethodsAroundInterceptor { if (isConsumer) { Integer count = (Integer)DEEP.get(); try { + //When count = 2, you can get the peer if (count == 2) { - String peer = invocation.getEndpoint().getAddress().toString(); + URI uri = new URI(invocation.getEndpoint().toString()); + String peer = uri.getHost() + ":" + uri.getPort(); final ContextCarrier contextCarrier = new ContextCarrier(); span = ContextManager.createExitSpan(invocation.getOperationName(), contextCarrier, peer); CarrierItem next = contextCarrier.items(); diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/InvocationInstrumentation.java b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/InvocationInstrumentation.java similarity index 93% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/InvocationInstrumentation.java rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/InvocationInstrumentation.java index a173161cbc4fa870e340bf8d63a96c64cb2b9a56..347e6647cc76de4a3cc329a40008a70d604d8d67 100644 --- a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/InvocationInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/InvocationInstrumentation.java @@ -18,9 +18,9 @@ package org.apache.skywalking.apm.plugin.servicecomb.define; +import io.servicecomb.core.Invocation; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; -import io.servicecomb.core.Invocation; import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; @@ -31,8 +31,8 @@ import org.apache.skywalking.apm.plugin.servicecomb.InvocationInterceptor; import static net.bytebuddy.matcher.ElementMatchers.named; /** - * {@link InvocationInstrumentation} presents that skywalking intercept {@link io.servicecomb.core.Invocation#next(AsyncResponse)}by - * using {@link InvocationInterceptor}, and {@link Invocation#getHandlerChain() by using {@link NextInterceptor}, + * {@link InvocationInstrumentation} presents that skywalking intercept {@link io.servicecomb.core.Invocation#getHandlerContext}by + * using {@link InvocationInterceptor}, and {@link Invocation#next by using {@link NextInterceptor}, * * @author lytscu */ @@ -60,7 +60,7 @@ public class InvocationInstrumentation extends ClassInstanceMethodsEnhancePlugin new InstanceMethodsInterceptPoint() { @Override public ElementMatcher getMethodsMatcher() { - return named("getHandlerChain"); + return named("getHandlerContext"); } @Override diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/resources/skywalking-plugin.def similarity index 100% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/main/resources/skywalking-plugin.def rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/resources/skywalking-plugin.def diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptorTest.java similarity index 100% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptorTest.java rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/InvocationInterceptorTest.java diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptorTest.java similarity index 100% rename from apm-sniffer/apm-sdk-plugin/servicecomb-java-chassis-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptorTest.java rename to apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/servicecomb/NextInterceptorTest.java