-
Notifications
You must be signed in to change notification settings - Fork 324
Closed
Labels
inst: othersAll other instrumentationsAll other instrumentationsinst: vertxEclipse Vert.x instrumentationEclipse Vert.x instrumentation
Milestone
Description
When the route is a regex path it doesn't have a path attribute. Class datadog.trace.instrumentation.vertx_4_0.server.RouteHandlerWrapper reads the property and inserts it in the routing context:
private void updateRoutingContextWithRoute(RoutingContext routingContext) {
final String method = routingContext.request().method().name();
final String mountPoint = routingContext.mountPoint();
String path = routingContext.currentRoute().getPath();
if (mountPoint != null) {
final String noBackslashhMountPoint =
mountPoint.endsWith("/")
? mountPoint.substring(0, mountPoint.lastIndexOf("/"))
: mountPoint;
path = noBackslashhMountPoint + path;
}
if (method != null && path != null) {
routingContext.put(ROUTE_CONTEXT_KEY, path);
}
}
The result is that under resources a regex path shows up as "parentSpan" + null, i.e.: GET /apinull.
I think a viable solution would be to check
Route.isRegexPath() and if true, use routingContext.currentRoute().getName(), perhaps like:
private void updateRoutingContextWithRoute(RoutingContext routingContext) {
final String method = routingContext.request().method().name();
final String mountPoint = routingContext.mountPoint();
Route = routingContext.currentRoute();
String path;
if(route.isRegexPath()) {
path = routingContext.currentRoute().getName();
} else {
path = routingContext.currentRoute().getPath();
}
if (mountPoint != null) {
final String noBackslashhMountPoint =
mountPoint.endsWith("/")
? mountPoint.substring(0, mountPoint.lastIndexOf("/"))
: mountPoint;
path = noBackslashhMountPoint + path;
}
if (method != null && path != null) {
routingContext.put(ROUTE_CONTEXT_KEY, path);
}
}
This would produce a resource like: /api/v1/entity/{id}, at least in my testing using vertx openapi support.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
inst: othersAll other instrumentationsAll other instrumentationsinst: vertxEclipse Vert.x instrumentationEclipse Vert.x instrumentation