未验证 提交 c8fc457e 编写于 作者: B Brandon Fergerson 提交者: GitHub

Better Vert.x endpoint names (#5064)

上级 20062c68
......@@ -26,7 +26,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
import java.lang.reflect.Method;
import java.util.Collections;
public class RouterImplHandlerInterceptor implements InstanceMethodsAroundInterceptor {
public class RouteImplHandlerInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
......
......@@ -34,10 +34,15 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class RouteStateInterceptor implements InstanceMethodsAroundInterceptor,
InstanceConstructorInterceptor {
private static final Pattern HTTP_METHOD_PATTERN = Pattern.compile("methods:\\[([a-zA-Z,]+)\\]");
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
if (allArguments.length > 8) {
......@@ -71,6 +76,27 @@ public class RouteStateInterceptor implements InstanceMethodsAroundInterceptor,
Object connection = ((EnhancedInstance) routingContext.request()).getSkyWalkingDynamicField();
VertxContext vertxContext = (VertxContext) ((EnhancedInstance) connection).getSkyWalkingDynamicField();
String routeMethods = null;
if (VertxContext.VERTX_VERSION >= 37.1) {
if (routingContext.currentRoute().methods() != null) {
routeMethods = "{" +
routingContext.currentRoute().methods()
.stream().map(Enum::toString)
.collect(Collectors.joining(","))
+ "}";
}
} else {
//no methods() method; have to strip from toString()
Matcher matcher = HTTP_METHOD_PATTERN.matcher(routingContext.currentRoute().toString());
if (matcher.find()) {
routeMethods = "{" + matcher.group(1) + "}";
}
}
if (routeMethods != null && routingContext.currentRoute().getPath() != null) {
vertxContext.getSpan().setOperationName(routeMethods + routingContext.currentRoute().getPath());
}
ContextManager.continued(vertxContext.getContextSnapshot());
span.setComponent(ComponentsDefine.VERTX);
SpanLayer.asHttp(span);
......
......@@ -47,7 +47,7 @@ public class ServerConnectionHandleMessageInterceptor implements InstanceMethods
request.headers().remove(next.getHeadKey());
}
AbstractSpan span = ContextManager.createEntrySpan(toPath(request.getUri()), contextCarrier);
AbstractSpan span = ContextManager.createEntrySpan("{" + request.getMethod() + "}" + toPath(request.getUri()), contextCarrier);
span.setComponent(ComponentsDefine.VERTX);
SpanLayer.asHttp(span);
Tags.HTTP.METHOD.set(span, request.getMethod().toString());
......
......@@ -29,17 +29,17 @@ import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link RouterImplHandlerInstrumentation} enhance the <code>handler</code> method in
* {@link RouteImplHandlerInstrumentation} enhance the <code>handler</code> method in
* <code>io.vertx.ext.web.impl.RouterImpl</code> class by
* <code>RouterImplHandlerInterceptor</code> class.
* <code>RouteImplHandlerInterceptor</code> class.
*
* Ver. 3.0.0 - 3.4.2
*/
public class RouterImplHandlerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
public class RouteImplHandlerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "io.vertx.ext.web.impl.RouteImpl";
private static final String ENHANCE_METHOD = "handler";
private static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.vertx3.RouterImplHandlerInterceptor";
private static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.vertx3.RouteImplHandlerInterceptor";
@Override
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
......
......@@ -30,13 +30,13 @@ import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link RouterImplInstrumentation} enhance the <code>handleContext</code> method in
* <code>io.vertx.ext.web.impl.RouterImpl</code> class by
* {@link RouteImplInstrumentation} enhance the <code>handleContext</code> method in
* <code>io.vertx.ext.web.impl.RouteImpl</code> class by
* <code>RouteStateInterceptor</code> class.
*
* Ver. 3.0.0 - 3.8.2
*/
public class RouterImplInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
public class RouteImplInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "io.vertx.ext.web.impl.RouteImpl";
private static final String ENHANCE_METHOD = "handleContext";
......
......@@ -25,8 +25,8 @@ vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerResponse
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouterContextImplBaseConstructorInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.ServerConnectionHandleMessageInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouteStateInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouterImplInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouterImplHandlerInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouteImplInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouteImplHandlerInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RoutingContextWrapperConstructorInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerRequestImplConstructorInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerRequestWrapperConstructorInstrumentation
......
......@@ -19,11 +19,19 @@ segmentItems:
segments:
- segmentId: not null
spans:
- {operationName: org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-eventbus-3-scenario/case/healthCheck
- operationName: org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{HEAD}/vertx-eventbus-3-scenario/case/healthCheck'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -37,7 +45,7 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: HEAD}
- {key: url, value: /vertx-eventbus-3-scenario/case/healthCheck}
- {key: url, value: '/vertx-eventbus-3-scenario/case/healthCheck'}
- {key: status_code, value: '200'}
- segmentId: not null
spans:
......@@ -60,12 +68,21 @@ segmentItems:
traceId: not null}
- segmentId: not null
spans:
- {operationName: local-message-receiver, operationId: 0, parentSpanId: -1, spanId: 0,
spanLayer: RPCFramework, startTime: nq 0, endTime: nq 0, componentId: 59,
isError: false, spanType: Local, peer: '', skipAnalysis: false}
- operationName: local-message-receiver
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: RPCFramework
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- segmentId: not null
spans:
- operationName: /vertx-eventbus-3-scenario/case/executeTest
- operationName: '/vertx-eventbus-3-scenario/case/executeTest'
operationId: 0
parentSpanId: 1
spanId: 2
......@@ -79,13 +96,21 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-eventbus-3-scenario/case/executeTest}
- {key: url, value: '/vertx-eventbus-3-scenario/case/executeTest'}
- {key: status_code, value: '200'}
- {operationName: org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-eventbus-3-scenario/case/eventbus-case
- operationName: org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-eventbus-3-scenario/case/eventbus-case'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -99,7 +124,7 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-eventbus-3-scenario/case/eventbus-case}
- {key: url, value: '/vertx-eventbus-3-scenario/case/eventbus-case'}
- {key: status_code, value: '200'}
- segmentId: not null
spans:
......@@ -116,7 +141,7 @@ segmentItems:
peer: ''
skipAnalysis: false
refs:
- {parentEndpoint: /vertx-eventbus-3-scenario/case/eventbus-case, networkAddress: '',
- {parentEndpoint: '{GET}/vertx-eventbus-3-scenario/case/eventbus-case', networkAddress: '',
refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario,
traceId: not null}
......@@ -141,16 +166,33 @@ segmentItems:
traceId: not null}
- segmentId: not null
spans:
- {operationName: cluster-message-receiver, operationId: 0, parentSpanId: -1,
spanId: 0, spanLayer: RPCFramework, startTime: nq 0, endTime: nq 0,
componentId: 59, isError: false, spanType: Exit, peer: not null, skipAnalysis: false}
- operationName: cluster-message-receiver
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: RPCFramework
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Exit
peer: not null
skipAnalysis: false
- segmentId: not null
spans:
- {operationName: org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-eventbus-3-scenario/case/executeTest
- operationName: org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-eventbus-3-scenario/case/executeTest'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -164,10 +206,10 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-eventbus-3-scenario/case/executeTest}
- {key: url, value: '/vertx-eventbus-3-scenario/case/executeTest'}
- {key: status_code, value: '200'}
refs:
- {parentEndpoint: /vertx-eventbus-3-scenario/case/eventbus-case, networkAddress: 'localhost:8080',
- {parentEndpoint: '{GET}/vertx-eventbus-3-scenario/case/eventbus-case', networkAddress: 'localhost:8080',
refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario,
traceId: not null}
......@@ -15,15 +15,23 @@
# limitations under the License.
segmentItems:
- serviceName: vertx-web-3.54minus-scenario
segmentSize: 7
segmentSize: 9
segments:
- segmentId: not null
spans:
- {operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_54minus-scenario/case/healthCheck
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{HEAD}/vertx-web-3_54minus-scenario/case/healthCheck'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -37,11 +45,11 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: HEAD}
- {key: url, value: /vertx-web-3_54minus-scenario/case/healthCheck}
- {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
- operationName: '/vertx-web-3_54minus-scenario/dynamicEndpoint/100'
operationId: 0
parentSpanId: 1
spanId: 2
......@@ -53,15 +61,39 @@ segmentItems:
spanType: Exit
peer: localhost:8080
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: '/vertx-web-3_54minus-scenario/dynamicEndpoint/100'}
- {key: status_code, value: '200'}
- operationName: '/vertx-web-3_54minus-scenario/case/healthCheck'
operationId: 0
parentSpanId: 1
spanId: 3
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: url, value: '/vertx-web-3_54minus-scenario/case/healthCheck'}
- {key: status_code, value: '200'}
- {operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_54minus-scenario/case/web-case
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-web-3_54minus-scenario/case/web-case'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -75,15 +107,23 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-web-3_54minus-scenario/case/web-case}
- {key: url, value: '/vertx-web-3_54minus-scenario/case/web-case'}
- {key: status_code, value: '200'}
- segmentId: not null
spans:
- {operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_54minus-scenario/case/healthCheck
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{HEAD}/vertx-web-3_54minus-scenario/case/healthCheck'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -97,20 +137,63 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: HEAD}
- {key: url, value: /vertx-web-3_54minus-scenario/case/healthCheck}
- {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',
- {parentEndpoint: '{GET}/vertx-web-3_54minus-scenario/case/web-case', networkAddress: 'localhost:8080',
refType: CrossProcess, parentSpanId: 3, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.54minus-scenario,
traceId: not null}
- segmentId: not null
spans:
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-web-3_54minus-scenario/dynamicEndpoint/:id'
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/dynamicEndpoint/100'}
- {key: status_code, value: '200'}
refs:
- {parentEndpoint: '{GET}/vertx-web-3_54minus-scenario/case/web-case', networkAddress: 'localhost:8080',
refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.54minus-scenario,
traceId: not null}
- segmentId: not null
spans:
- {operationName: io.vertx.ext.web.handler.impl.BodyHandlerImpl.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_54minus-scenario/case/web-case/withBodyHandler
- operationName: io.vertx.ext.web.handler.impl.BodyHandlerImpl.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -124,13 +207,32 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-web-3_54minus-scenario/case/web-case/withBodyHandler}
- {key: url, value: '/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler'}
- {key: status_code, value: '200'}
refs:
- {parentEndpoint: '#/vertx-web-3_54minus-scenario/case/healthCheck', 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/dynamicEndpoint/100'
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: '{GET}/vertx-web-3_54minus-scenario/case/web-case', networkAddress: '',
refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.54minus-scenario,
traceId: not null}
- segmentId: not null
spans:
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
......@@ -146,13 +248,13 @@ segmentItems:
peer: ''
skipAnalysis: false
refs:
- {parentEndpoint: /vertx-web-3_54minus-scenario/case/web-case/withBodyHandler,
- {parentEndpoint: '{GET}/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler',
networkAddress: '', refType: CrossThread, parentSpanId: 0, 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/web-case/withBodyHandler
- operationName: '/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler'
operationId: 0
parentSpanId: 0
spanId: 1
......@@ -166,7 +268,7 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-web-3_54minus-scenario/case/web-case/withBodyHandler}
- {key: url, value: '/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler'}
- {key: status_code, value: '200'}
- operationName: '#/vertx-web-3_54minus-scenario/case/healthCheck'
operationId: 0
......@@ -181,8 +283,8 @@ segmentItems:
peer: ''
skipAnalysis: false
refs:
- {parentEndpoint: /vertx-web-3_54minus-scenario/case/web-case, networkAddress: '',
refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null,
- {parentEndpoint: '{GET}/vertx-web-3_54minus-scenario/case/web-case', networkAddress: '',
refType: CrossThread, parentSpanId: 3, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.54minus-scenario,
traceId: not null}
- segmentId: not null
......
......@@ -28,6 +28,7 @@ public class VertxWebController extends AbstractVerticle {
public void start() {
Router router = Router.router(vertx);
router.get("/vertx-web-3_54minus-scenario/case/web-case").handler(this::handleWebCase);
router.get("/vertx-web-3_54minus-scenario/dynamicEndpoint/:id").handler(this::dynamicEndpoint);
router.route("/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler").handler(BodyHandler.create());
router.get("/vertx-web-3_54minus-scenario/case/web-case/withBodyHandler").handler(this::withBodyHandler);
router.head("/vertx-web-3_54minus-scenario/case/healthCheck").handler(this::healthCheck);
......@@ -35,6 +36,12 @@ public class VertxWebController extends AbstractVerticle {
}
private void handleWebCase(RoutingContext routingContext) {
//dynamic endpoint test
vertx.createHttpClient().getNow(8080, "localhost",
"/vertx-web-3_54minus-scenario/dynamicEndpoint/100", it -> {
});
//non-body and body handler test
vertx.createHttpClient().headNow(8080, "localhost", "/vertx-web-3_54minus-scenario/case/healthCheck",
healthCheck -> {
vertx.createHttpClient().getNow(8080, "localhost",
......@@ -43,6 +50,10 @@ public class VertxWebController extends AbstractVerticle {
});
}
private void dynamicEndpoint(RoutingContext routingContext) {
routingContext.response().setStatusCode(200).end("Success");
}
private void withBodyHandler(RoutingContext routingContext) {
routingContext.response().setStatusCode(200).end("Success");
}
......
......@@ -15,15 +15,23 @@
# limitations under the License.
segmentItems:
- serviceName: vertx-web-3.6plus-scenario
segmentSize: 7
segmentSize: 9
segments:
- segmentId: not null
spans:
- {operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_6plus-scenario/case/healthCheck
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{HEAD}/vertx-web-3_6plus-scenario/case/healthCheck'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -37,11 +45,11 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: HEAD}
- {key: url, value: /vertx-web-3_6plus-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_6plus-scenario/case/healthCheck
- operationName: '/vertx-web-3_6plus-scenario/dynamicEndpoint/100'
operationId: 0
parentSpanId: 1
spanId: 2
......@@ -53,15 +61,39 @@ segmentItems:
spanType: Exit
peer: localhost:8080
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: '/vertx-web-3_6plus-scenario/dynamicEndpoint/100'}
- {key: status_code, value: '200'}
- operationName: '/vertx-web-3_6plus-scenario/case/healthCheck'
operationId: 0
parentSpanId: 1
spanId: 3
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_6plus-scenario/case/healthCheck}
- {key: url, value: '/vertx-web-3_6plus-scenario/case/healthCheck'}
- {key: status_code, value: '200'}
- {operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_6plus-scenario/case/web-case
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-web-3_6plus-scenario/case/web-case'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -75,15 +107,23 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-web-3_6plus-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: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_6plus-scenario/case/healthCheck
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{HEAD}/vertx-web-3_6plus-scenario/case/healthCheck'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -97,20 +137,63 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: HEAD}
- {key: url, value: /vertx-web-3_6plus-scenario/case/healthCheck}
- {key: url, value: '/vertx-web-3_6plus-scenario/case/healthCheck'}
- {key: status_code, value: '200'}
refs:
- {parentEndpoint: /vertx-web-3_6plus-scenario/case/web-case, networkAddress: 'localhost:8080',
- {parentEndpoint: '{GET}/vertx-web-3_6plus-scenario/case/web-case', networkAddress: 'localhost:8080',
refType: CrossProcess, parentSpanId: 3, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario,
traceId: not null}
- segmentId: not null
spans:
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-web-3_6plus-scenario/dynamicEndpoint/:id'
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_6plus-scenario/dynamicEndpoint/100'}
- {key: status_code, value: '200'}
refs:
- {parentEndpoint: '{GET}/vertx-web-3_6plus-scenario/case/web-case', networkAddress: 'localhost:8080',
refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario,
traceId: not null}
- segmentId: not null
spans:
- {operationName: io.vertx.ext.web.handler.impl.BodyHandlerImpl.handle(RoutingContext),
operationId: 0, parentSpanId: 0, spanId: 1, spanLayer: Http, startTime: nq 0,
endTime: nq 0, componentId: 59, isError: false, spanType: Local, peer: '',
skipAnalysis: false}
- operationName: /vertx-web-3_6plus-scenario/case/web-case/withBodyHandler
- operationName: io.vertx.ext.web.handler.impl.BodyHandlerImpl.handle(RoutingContext)
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 59
isError: false
spanType: Local
peer: ''
skipAnalysis: false
- operationName: '{GET}/vertx-web-3_6plus-scenario/case/web-case/withBodyHandler'
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -124,13 +207,32 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-web-3_6plus-scenario/case/web-case/withBodyHandler}
- {key: url, value: '/vertx-web-3_6plus-scenario/case/web-case/withBodyHandler'}
- {key: status_code, value: '200'}
refs:
- {parentEndpoint: '#/vertx-web-3_6plus-scenario/case/healthCheck', networkAddress: 'localhost:8080',
refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario,
traceId: not null}
- segmentId: not null
spans:
- operationName: '#/vertx-web-3_6plus-scenario/dynamicEndpoint/100'
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: '{GET}/vertx-web-3_6plus-scenario/case/web-case', networkAddress: '',
refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario,
traceId: not null}
- segmentId: not null
spans:
- operationName: org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController$$Lambda$.handle(RoutingContext)
......@@ -146,13 +248,13 @@ segmentItems:
peer: ''
skipAnalysis: false
refs:
- {parentEndpoint: /vertx-web-3_6plus-scenario/case/web-case/withBodyHandler,
- {parentEndpoint: '{GET}/vertx-web-3_6plus-scenario/case/web-case/withBodyHandler',
networkAddress: '', refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario,
traceId: not null}
- segmentId: not null
spans:
- operationName: /vertx-web-3_6plus-scenario/case/web-case/withBodyHandler
- operationName: '/vertx-web-3_6plus-scenario/case/web-case/withBodyHandler'
operationId: 0
parentSpanId: 0
spanId: 1
......@@ -166,7 +268,7 @@ segmentItems:
skipAnalysis: false
tags:
- {key: http.method, value: GET}
- {key: url, value: /vertx-web-3_6plus-scenario/case/web-case/withBodyHandler}
- {key: url, value: '/vertx-web-3_6plus-scenario/case/web-case/withBodyHandler'}
- {key: status_code, value: '200'}
- operationName: '#/vertx-web-3_6plus-scenario/case/healthCheck'
operationId: 0
......@@ -181,8 +283,8 @@ segmentItems:
peer: ''
skipAnalysis: false
refs:
- {parentEndpoint: /vertx-web-3_6plus-scenario/case/web-case, networkAddress: '',
refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null,
- {parentEndpoint: '{GET}/vertx-web-3_6plus-scenario/case/web-case', networkAddress: '',
refType: CrossThread, parentSpanId: 3, parentTraceSegmentId: not null,
parentServiceInstance: not null, parentService: vertx-web-3.6plus-scenario,
traceId: not null}
- segmentId: not null
......
......@@ -29,6 +29,7 @@ public class VertxWebController extends AbstractVerticle {
public void start() {
Router router = Router.router(vertx);
router.get("/vertx-web-3_6plus-scenario/case/web-case").handler(this::handleWebCase);
router.get("/vertx-web-3_6plus-scenario/dynamicEndpoint/:id").handler(this::dynamicEndpoint);
router.get("/vertx-web-3_6plus-scenario/case/web-case/withBodyHandler")
.handler(BodyHandler.create()).handler(this::withBodyHandler);
router.head("/vertx-web-3_6plus-scenario/case/healthCheck").handler(this::healthCheck);
......@@ -36,6 +37,12 @@ public class VertxWebController extends AbstractVerticle {
}
private void handleWebCase(RoutingContext routingContext) {
//dynamic endpoint test
WebClient.create(vertx).get(8080, "localhost",
"/vertx-web-3_6plus-scenario/dynamicEndpoint/100").send(it -> {
});
//non-body and body handler test
WebClient.create(vertx).head(8080, "localhost", "/vertx-web-3_6plus-scenario/case/healthCheck")
.send(healthCheck -> {
if (healthCheck.succeeded()) {
......@@ -48,6 +55,10 @@ public class VertxWebController extends AbstractVerticle {
});
}
private void dynamicEndpoint(RoutingContext routingContext) {
routingContext.response().setStatusCode(200).end("Success");
}
private void withBodyHandler(RoutingContext routingContext) {
routingContext.response().setStatusCode(200).end("Success");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册