diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml index d06107efe..63e30a319 100644 --- a/.github/workflows/plugins-test.3.yaml +++ b/.github/workflows/plugins-test.3.yaml @@ -42,7 +42,8 @@ jobs: - { name: 'spring-4.3.x-scenario', title: 'Spring 4.3.x-5.2.x (54)' } - { name: 'spring-async-scenario', title: 'Spring Async 4.3.x-5.1.x (35)' } - { name: 'vertx-eventbus-3.x-scenario', title: 'Vert.x EventBus 3.2.0-3.9.0 (27)' } - - { name: 'vertx-web-3.x-scenario', title: 'Vert.x Web 3.0.0-3.9.0 (29)' } + - { name: 'vertx-web-3.54minus-scenario', title: 'Vert.x Web 3.0.0-3.5.4 (16)' } + - { name: 'vertx-web-3.6plus-scenario', title: 'Vert.x Web 3.6.0-3.9.0 (13)' } - { name: 'mariadb-scenario', title: 'Mariadb 2.x (8)' } steps: - uses: actions/checkout@v2 diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleResponseInterceptor.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleResponseInterceptor.java index cea72b028..982a5f1f4 100644 --- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleResponseInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleResponseInterceptor.java @@ -35,20 +35,24 @@ public class HttpClientRequestImplHandleResponseInterceptor implements InstanceM @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { - VertxContext context = (VertxContext) objInst.getSkyWalkingDynamicField(); - Tags.STATUS_CODE.set(context.getSpan(), Integer.toString(((HttpClientResponse) allArguments[0]).statusCode())); - context.getSpan().asyncFinish(); + if (VertxContext.VERTX_VERSION < 38 || allArguments.length == 2) { + VertxContext context = (VertxContext) objInst.getSkyWalkingDynamicField(); + Tags.STATUS_CODE.set(context.getSpan(), Integer.toString(((HttpClientResponse) allArguments[0]).statusCode())); + context.getSpan().asyncFinish(); - AbstractSpan span = ContextManager.createLocalSpan("#" + context.getSpan().getOperationName()); - span.setComponent(ComponentsDefine.VERTX); - SpanLayer.asHttp(span); - ContextManager.continued(context.getContextSnapshot()); + AbstractSpan span = ContextManager.createLocalSpan("#" + context.getSpan().getOperationName()); + span.setComponent(ComponentsDefine.VERTX); + SpanLayer.asHttp(span); + ContextManager.continued(context.getContextSnapshot()); + } } @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { - ContextManager.stopSpan(); + if (VertxContext.VERTX_VERSION < 38 || allArguments.length == 2) { + ContextManager.stopSpan(); + } return ret; } diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplEndInterceptor.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplEndInterceptor.java index 81423fe8a..297209335 100644 --- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplEndInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplEndInterceptor.java @@ -32,9 +32,11 @@ public class HttpServerResponseImplEndInterceptor implements InstanceMethodsArou @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { - VertxContext context = (VertxContext) objInst.getSkyWalkingDynamicField(); - Tags.STATUS_CODE.set(context.getSpan(), Integer.toString(((HttpServerResponse) objInst).getStatusCode())); - context.getSpan().asyncFinish(); + if (VertxContext.VERTX_VERSION <= 37 || allArguments.length == 2) { + VertxContext context = (VertxContext) objInst.getSkyWalkingDynamicField(); + Tags.STATUS_CODE.set(context.getSpan(), Integer.toString(((HttpServerResponse) objInst).getStatusCode())); + context.getSpan().asyncFinish(); + } } @Override diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/VertxContext.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/VertxContext.java index ed12da154..27cf22693 100644 --- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/VertxContext.java +++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/VertxContext.java @@ -18,6 +18,7 @@ package org.apache.skywalking.apm.plugin.vertx3; +import io.vertx.core.impl.launcher.commands.VersionCommand; import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; @@ -27,12 +28,24 @@ import java.util.concurrent.ConcurrentHashMap; class VertxContext { + public static final double VERTX_VERSION; + + static { + double version; + try { + version = Double.parseDouble(VersionCommand.getVersion().replaceFirst("\\.", "")); + } catch (Throwable ignored) { + version = 3.00; + } + VERTX_VERSION = version; + } + public static final String STOP_SPAN_NECESSARY = "VERTX_STOP_SPAN_NECESSARY"; - private static final Map> CONTEXT_MAP = new ConcurrentHashMap>(); + private static final Map> CONTEXT_MAP = new ConcurrentHashMap<>(); static void pushContext(String identifier, VertxContext vertxContext) { if (!CONTEXT_MAP.containsKey(identifier)) { - CONTEXT_MAP.put(identifier, new Stack()); + CONTEXT_MAP.put(identifier, new Stack<>()); } CONTEXT_MAP.get(identifier).push(vertxContext); } diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplAcceptInstrumentation.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplAcceptInstrumentation.java index 0c68bd86e..3fddc8b89 100644 --- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplAcceptInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplAcceptInstrumentation.java @@ -30,8 +30,10 @@ import static net.bytebuddy.matcher.ElementMatchers.named; /** * {@link RouterImplAcceptInstrumentation} enhance the accept method in - * io.vertx.core.http.impl.HttpServerRequestImpl class by - * RouterImplAcceptInterceptor class + * io.vertx.ext.web.impl.RouterImpl class by + * RouterImplAcceptInterceptor class. + * + * Targets: ver. 3.0.0 - 3.5.4 */ public class RouterImplAcceptInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplHandleInstrumentation.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplHandleInstrumentation.java new file mode 100644 index 000000000..431bcf216 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplHandleInstrumentation.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.plugin.vertx3.define; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +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; +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; + +import static net.bytebuddy.matcher.ElementMatchers.named; + +/** + * {@link RouterImplHandleInstrumentation} enhance the handle method in + * io.vertx.ext.web.impl.RouterImpl class by + * RouterImplAcceptInterceptor class. + * + * Targets: ver. 3.6.0+ + */ +public class RouterImplHandleInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + private static final String ENHANCE_CLASS = "io.vertx.ext.web.impl.RouterImpl"; + private static final String ENHANCE_METHOD = "handle"; + private static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.vertx3.RouterImplAcceptInterceptor"; + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[0]; + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[] { + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named(ENHANCE_METHOD); + } + + @Override + public String getMethodsInterceptor() { + return INTERCEPT_CLASS; + } + + @Override + public boolean isOverrideArgs() { + return false; + } + } + }; + } + + @Override + protected ClassMatch enhanceClass() { + return NameMatch.byName(ENHANCE_CLASS); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/resources/skywalking-plugin.def index c34f3e468..380bee356 100644 --- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/resources/skywalking-plugin.def +++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/resources/skywalking-plugin.def @@ -23,3 +23,5 @@ vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpClientRequestI vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerResponseImplEndInstrumentation vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerResponseImplHandleExceptionInstrumentation vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouterImplAcceptInstrumentation +vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouterImplHandleInstrumentation + diff --git a/test/plugin/scenarios/vertx-web-3.54minus-scenario/bin/startup.sh b/test/plugin/scenarios/vertx-web-3.54minus-scenario/bin/startup.sh new file mode 100644 index 000000000..fea2313a5 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +home="$(cd "$(dirname $0)"; pwd)" + +java -jar ${agent_opts} ${home}/../libs/vertx-web-3.54minus-scenario.jar & diff --git a/test/plugin/scenarios/vertx-web-3.54minus-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-web-3.54minus-scenario/config/expectedData.yaml new file mode 100644 index 000000000..eaa009e01 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/config/expectedData.yaml @@ -0,0 +1,113 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +segmentItems: + - serviceName: vertx-web-3.54minus-scenario + segmentSize: 4 + segments: + - segmentId: not null + spans: + - operationName: /vertx-web-3_54minus-scenario/case/healthCheck + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: http.method, value: HEAD} + - {key: url, value: /vertx-web-3_54minus-scenario/case/healthCheck} + - {key: status_code, value: '200'} + - segmentId: not null + spans: + - operationName: /vertx-web-3_54minus-scenario/case/healthCheck + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: http.method, value: HEAD} + - {key: url, value: /vertx-web-3_54minus-scenario/case/healthCheck} + - {key: status_code, value: '200'} + refs: + - {parentEndpoint: /vertx-web-3_54minus-scenario/case/web-case, networkAddress: 'localhost:8080', + refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-web-3.54minus-scenario, + traceId: not null} + - segmentId: not null + spans: + - operationName: /vertx-web-3_54minus-scenario/case/healthCheck + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Exit + peer: localhost:8080 + skipAnalysis: false + tags: + - {key: http.method, value: HEAD} + - {key: url, value: /vertx-web-3_54minus-scenario/case/healthCheck} + - {key: status_code, value: '200'} + - operationName: /vertx-web-3_54minus-scenario/case/web-case + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: /vertx-web-3_54minus-scenario/case/web-case} + - {key: status_code, value: '200'} + - segmentId: not null + spans: + - operationName: '#/vertx-web-3_54minus-scenario/case/healthCheck' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Local + peer: '' + skipAnalysis: false + refs: + - {parentEndpoint: /vertx-web-3_54minus-scenario/case/web-case, networkAddress: '', + refType: CrossThread, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-web-3.54minus-scenario, + traceId: not null} diff --git a/test/plugin/scenarios/vertx-web-3.54minus-scenario/configuration.yml b/test/plugin/scenarios/vertx-web-3.54minus-scenario/configuration.yml new file mode 100644 index 000000000..a7fdc29e9 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/configuration.yml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type: jvm +entryService: http://localhost:8080/vertx-web-3_54minus-scenario/case/web-case +healthCheck: http://localhost:8080/vertx-web-3_54minus-scenario/case/healthCheck +startScript: ./bin/startup.sh diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml b/test/plugin/scenarios/vertx-web-3.54minus-scenario/pom.xml similarity index 93% rename from test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml rename to test/plugin/scenarios/vertx-web-3.54minus-scenario/pom.xml index 8f6c3daa0..4f963991e 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/pom.xml @@ -21,7 +21,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.skywalking.apm.testcase - vertx-web-3.x-scenario + vertx-web-3.54minus-scenario 1.0.0 jar @@ -30,10 +30,10 @@ UTF-8 1.8 - 3.9.0 + 3.5.4 - skywalking-vertx-web-3.x-scenario + skywalking-vertx-web-3.54minus-scenario @@ -44,7 +44,7 @@ - vertx-web-3.x-scenario + vertx-web-3.54minus-scenario org.springframework.boot diff --git a/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..e561eb016 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/vertx-web-3.54minus-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java similarity index 100% rename from test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java rename to test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java b/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java similarity index 82% rename from test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java rename to test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java index 7da26aa63..3fb9be768 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java @@ -26,14 +26,14 @@ public class VertxWebController extends AbstractVerticle { @Override public void start() { Router router = Router.router(vertx); - router.get("/vertx-web-3-scenario/case/web-case").handler(this::handleCoreCase); - router.head("/vertx-web-3-scenario/case/healthCheck").handler(this::healthCheck); + router.get("/vertx-web-3_54minus-scenario/case/web-case").handler(this::handleWebCase); + router.head("/vertx-web-3_54minus-scenario/case/healthCheck").handler(this::healthCheck); vertx.createHttpServer().requestHandler(router::accept).listen(8080); } - private void handleCoreCase(RoutingContext routingContext) { + private void handleWebCase(RoutingContext routingContext) { vertx.createHttpClient().headNow(8080, "localhost", - "/vertx-web-3-scenario/case/healthCheck", + "/vertx-web-3_54minus-scenario/case/healthCheck", it -> routingContext.response().setStatusCode(it.statusCode()).end()); } diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/resources/log4j2.xml similarity index 100% rename from test/plugin/scenarios/vertx-web-3.x-scenario/src/main/resources/log4j2.xml rename to test/plugin/scenarios/vertx-web-3.54minus-scenario/src/main/resources/log4j2.xml diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list b/test/plugin/scenarios/vertx-web-3.54minus-scenario/support-version.list similarity index 91% rename from test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list rename to test/plugin/scenarios/vertx-web-3.54minus-scenario/support-version.list index db205eb25..ae29c1c83 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list +++ b/test/plugin/scenarios/vertx-web-3.54minus-scenario/support-version.list @@ -14,19 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -3.9.0 -3.8.5 -3.8.4 -3.8.3 -3.8.2 -3.8.1 -3.8.0 -3.7.1 -3.7.0 -3.6.3 -3.6.2 -3.6.1 -3.6.0 3.5.4 3.5.3 3.5.2 diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh b/test/plugin/scenarios/vertx-web-3.6plus-scenario/bin/startup.sh similarity index 91% rename from test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh rename to test/plugin/scenarios/vertx-web-3.6plus-scenario/bin/startup.sh index 856a33da1..1cbd55f4d 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/bin/startup.sh @@ -18,4 +18,4 @@ home="$(cd "$(dirname $0)"; pwd)" -java -jar ${agent_opts} ${home}/../libs/vertx-web-3.x-scenario.jar & +java -jar ${agent_opts} ${home}/../libs/vertx-web-3.6plus-scenario.jar & diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-web-3.6plus-scenario/config/expectedData.yaml similarity index 77% rename from test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml rename to test/plugin/scenarios/vertx-web-3.6plus-scenario/config/expectedData.yaml index 8f8885415..2defdefae 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/config/expectedData.yaml @@ -14,12 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. segmentItems: - - serviceName: vertx-web-3.x-scenario + - serviceName: vertx-web-3.6plus-scenario segmentSize: 4 segments: - segmentId: not null spans: - - operationName: /vertx-web-3-scenario/case/healthCheck + - operationName: /vertx-web-3_6plus-scenario/case/healthCheck operationId: 0 parentSpanId: -1 spanId: 0 @@ -33,11 +33,11 @@ segmentItems: skipAnalysis: false tags: - {key: http.method, value: HEAD} - - {key: url, value: /vertx-web-3-scenario/case/healthCheck} + - {key: url, value: /vertx-web-3_6plus-scenario/case/healthCheck} - {key: status_code, value: '200'} - segmentId: not null spans: - - operationName: /vertx-web-3-scenario/case/healthCheck + - operationName: /vertx-web-3_6plus-scenario/case/healthCheck operationId: 0 parentSpanId: -1 spanId: 0 @@ -51,16 +51,16 @@ segmentItems: skipAnalysis: false tags: - {key: http.method, value: HEAD} - - {key: url, value: /vertx-web-3-scenario/case/healthCheck} + - {key: url, value: /vertx-web-3_6plus-scenario/case/healthCheck} - {key: status_code, value: '200'} refs: - - {parentEndpoint: /vertx-web-3-scenario/case/web-case, networkAddress: 'localhost:8080', + - {parentEndpoint: /vertx-web-3_6plus-scenario/case/web-case, networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, - parentServiceInstance: not null, parentService: vertx-web-3.x-scenario, + parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario, traceId: not null} - segmentId: not null spans: - - operationName: /vertx-web-3-scenario/case/healthCheck + - operationName: /vertx-web-3_6plus-scenario/case/healthCheck operationId: 0 parentSpanId: 0 spanId: 1 @@ -74,9 +74,9 @@ segmentItems: skipAnalysis: false tags: - {key: http.method, value: HEAD} - - {key: url, value: /vertx-web-3-scenario/case/healthCheck} + - {key: url, value: /vertx-web-3_6plus-scenario/case/healthCheck} - {key: status_code, value: '200'} - - operationName: /vertx-web-3-scenario/case/web-case + - operationName: /vertx-web-3_6plus-scenario/case/web-case operationId: 0 parentSpanId: -1 spanId: 0 @@ -90,11 +90,11 @@ segmentItems: skipAnalysis: false tags: - {key: http.method, value: GET} - - {key: url, value: /vertx-web-3-scenario/case/web-case} + - {key: url, value: /vertx-web-3_6plus-scenario/case/web-case} - {key: status_code, value: '200'} - segmentId: not null spans: - - operationName: '#/vertx-web-3-scenario/case/healthCheck' + - operationName: '#/vertx-web-3_6plus-scenario/case/healthCheck' operationId: 0 parentSpanId: -1 spanId: 0 @@ -107,7 +107,7 @@ segmentItems: peer: '' skipAnalysis: false refs: - - {parentEndpoint: /vertx-web-3-scenario/case/web-case, networkAddress: '', + - {parentEndpoint: /vertx-web-3_6plus-scenario/case/web-case, networkAddress: '', refType: CrossThread, parentSpanId: 1, parentTraceSegmentId: not null, - parentServiceInstance: not null, parentService: vertx-web-3.x-scenario, + parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario, traceId: not null} diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml b/test/plugin/scenarios/vertx-web-3.6plus-scenario/configuration.yml similarity index 84% rename from test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml rename to test/plugin/scenarios/vertx-web-3.6plus-scenario/configuration.yml index 4be3c902d..2e974111e 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/configuration.yml @@ -15,6 +15,6 @@ # limitations under the License. type: jvm -entryService: http://localhost:8080/vertx-web-3-scenario/case/web-case -healthCheck: http://localhost:8080/vertx-web-3-scenario/case/healthCheck +entryService: http://localhost:8080/vertx-web-3_6plus-scenario/case/web-case +healthCheck: http://localhost:8080/vertx-web-3_6plus-scenario/case/healthCheck startScript: ./bin/startup.sh diff --git a/test/plugin/scenarios/vertx-web-3.6plus-scenario/pom.xml b/test/plugin/scenarios/vertx-web-3.6plus-scenario/pom.xml new file mode 100644 index 000000000..c8b5a4ba3 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/pom.xml @@ -0,0 +1,94 @@ + + + + + org.apache.skywalking.apm.testcase + vertx-web-3.6plus-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + 3.9.0 + + + skywalking-vertx-web-3.6plus-scenario + + + + io.vertx + vertx-web + ${test.framework.version} + + + io.vertx + vertx-web-client + ${test.framework.version} + + + + + vertx-web-3.6plus-scenario + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + + src/main/assembly/assembly.xml + + ./target/ + + + + + + + diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/assembly/assembly.xml similarity index 94% rename from test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml rename to test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/assembly/assembly.xml index 0494bce21..bdbb580db 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/assembly/assembly.xml @@ -33,7 +33,7 @@ - ${project.build.directory}/vertx-web-3.x-scenario.jar + ${project.build.directory}/vertx-web-3.6plus-scenario.jar ./libs 0775 diff --git a/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java new file mode 100644 index 000000000..71cdfa4e0 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.skywalking.apm.testcase.vertxweb; + +import io.vertx.core.Vertx; +import org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Comparator; + +public class Application { + + public static void main(String[] args) throws IOException { + //ensures .vertx files are uncreated/deleted + System.setProperty("vertx.disableFileCPResolving", "true"); + Vertx vertx = Vertx.vertx(); + if (new File(".vertx").exists()) { + Files.walk(new File(".vertx").toPath()) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + + vertx.deployVerticle(new VertxWebController(), it -> { + if (it.failed()) { + it.cause().printStackTrace(); + System.exit(-1); + } + }); + } +} diff --git a/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java new file mode 100644 index 000000000..34d81d83e --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.skywalking.apm.testcase.vertxweb.controller; + +import io.vertx.core.AbstractVerticle; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.RoutingContext; +import io.vertx.ext.web.client.WebClient; + +public class VertxWebController extends AbstractVerticle { + + @Override + public void start() { + Router router = Router.router(vertx); + router.get("/vertx-web-3_6plus-scenario/case/web-case").handler(this::handleWebCase); + router.head("/vertx-web-3_6plus-scenario/case/healthCheck").handler(this::healthCheck); + vertx.createHttpServer().requestHandler(router).listen(8080); + } + + private void handleWebCase(RoutingContext routingContext) { + WebClient.create(vertx).head(8080, "localhost", + "/vertx-web-3_6plus-scenario/case/healthCheck") + .send(it -> routingContext.response().setStatusCode(it.result().statusCode()).end()); + } + + private void healthCheck(RoutingContext routingContext) { + routingContext.response().setStatusCode(200).end("Success"); + } +} diff --git a/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..ca19f179c --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/vertx-web-3.6plus-scenario/support-version.list b/test/plugin/scenarios/vertx-web-3.6plus-scenario/support-version.list new file mode 100644 index 000000000..d6fba3ea8 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.6plus-scenario/support-version.list @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +3.9.0 +3.8.5 +3.8.4 +3.8.3 +3.8.2 +3.8.1 +3.8.0 +3.7.1 +3.7.0 +3.6.3 +3.6.2 +3.6.1 +3.6.0