Increased support for Vertx (#4827)

This commit is contained in:
Brandon Fergerson 2020-05-26 18:02:34 +04:00 committed by GitHub
parent 6ed40b3395
commit 594fb15b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 582 additions and 55 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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<String, Stack<VertxContext>> CONTEXT_MAP = new ConcurrentHashMap<String, Stack<VertxContext>>();
private static final Map<String, Stack<VertxContext>> CONTEXT_MAP = new ConcurrentHashMap<>();
static void pushContext(String identifier, VertxContext vertxContext) {
if (!CONTEXT_MAP.containsKey(identifier)) {
CONTEXT_MAP.put(identifier, new Stack<VertxContext>());
CONTEXT_MAP.put(identifier, new Stack<>());
}
CONTEXT_MAP.get(identifier).push(vertxContext);
}

View File

@ -30,8 +30,10 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link RouterImplAcceptInstrumentation} enhance the <code>accept</code> method in
* <code>io.vertx.core.http.impl.HttpServerRequestImpl</code> class by
* <code>RouterImplAcceptInterceptor</code> class
* <code>io.vertx.ext.web.impl.RouterImpl</code> class by
* <code>RouterImplAcceptInterceptor</code> class.
*
* Targets: ver. 3.0.0 - 3.5.4
*/
public class RouterImplAcceptInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {

View File

@ -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 <code>handle</code> method in
* <code>io.vertx.ext.web.impl.RouterImpl</code> class by
* <code>RouterImplAcceptInterceptor</code> 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<MethodDescription> 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);
}
}

View File

@ -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

View File

@ -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 &

View File

@ -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}

View File

@ -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

View File

@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.skywalking.apm.testcase</groupId>
<artifactId>vertx-web-3.x-scenario</artifactId>
<artifactId>vertx-web-3.54minus-scenario</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
@ -30,10 +30,10 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>3.9.0</test.framework.version>
<test.framework.version>3.5.4</test.framework.version>
</properties>
<name>skywalking-vertx-web-3.x-scenario</name>
<name>skywalking-vertx-web-3.54minus-scenario</name>
<dependencies>
<dependency>
@ -44,7 +44,7 @@
</dependencies>
<build>
<finalName>vertx-web-3.x-scenario</finalName>
<finalName>vertx-web-3.54minus-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>./bin</directory>
<fileMode>0775</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/vertx-web-3.54minus-scenario.jar</source>
<outputDirectory>./libs</outputDirectory>
<fileMode>0775</fileMode>
</file>
</files>
</assembly>

View File

@ -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());
}

View File

@ -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

View File

@ -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 &

View File

@ -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}

View File

@ -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

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<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">
<groupId>org.apache.skywalking.apm.testcase</groupId>
<artifactId>vertx-web-3.6plus-scenario</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>3.9.0</test.framework.version>
</properties>
<name>skywalking-vertx-web-3.6plus-scenario</name>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web-client</artifactId>
<version>${test.framework.version}</version>
</dependency>
</dependencies>
<build>
<finalName>vertx-web-3.6plus-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>./target/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -33,7 +33,7 @@
<files>
<file>
<source>${project.build.directory}/vertx-web-3.x-scenario.jar</source>
<source>${project.build.directory}/vertx-web-3.6plus-scenario.jar</source>
<outputDirectory>./libs</outputDirectory>
<fileMode>0775</fileMode>
</file>

View File

@ -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);
}
});
}
}

View File

@ -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");
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<Configuration status="debug">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%traceId] %-5p %c{1}:%L - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="OFF">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

View File

@ -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