Fix Operation name logging for Netty based applications (#2317)

This commit is contained in:
neinoi 2021-02-19 12:59:50 -05:00 committed by GitHub
parent 1ca7276593
commit 1f884e4d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 6 deletions

View File

@ -46,7 +46,9 @@ public class HttpServerRequestTracingHandler extends SimpleChannelUpstreamHandle
HttpRequest request = (HttpRequest) message;
Context context =
tracer().startSpan(request, ctx.getChannel(), channelTraceContext, "netty.request");
tracer()
.startSpan(
request, ctx.getChannel(), channelTraceContext, "HTTP " + request.getMethod());
try (Scope ignored = context.makeCurrent()) {
ctx.sendUpstream(event);
// the span is ended normally in HttpServerResponseTracingHandler

View File

@ -143,6 +143,6 @@ class Netty38ServerTest extends HttpServerTest<ServerBootstrap> implements Agent
@Override
String expectedServerSpanName(ServerEndpoint endpoint) {
return "netty.request"
return "HTTP GET"
}
}

View File

@ -32,7 +32,8 @@ public class HttpServerRequestTracingHandler extends ChannelInboundHandlerAdapte
return;
}
Context context = tracer().startSpan((HttpRequest) msg, channel, channel, "netty.request");
HttpRequest request = (HttpRequest) msg;
Context context = tracer().startSpan(request, channel, channel, "HTTP " + request.getMethod());
try (Scope ignored = context.makeCurrent()) {
ctx.fireChannelRead(msg);
// the span is ended normally in HttpServerResponseTracingHandler

View File

@ -115,6 +115,6 @@ class Netty40ServerTest extends HttpServerTest<EventLoopGroup> implements AgentT
@Override
String expectedServerSpanName(ServerEndpoint endpoint) {
return "netty.request"
return "HTTP GET"
}
}

View File

@ -32,7 +32,8 @@ public class HttpServerRequestTracingHandler extends ChannelInboundHandlerAdapte
return;
}
Context context = tracer().startSpan((HttpRequest) msg, channel, channel, "netty.request");
HttpRequest request = (HttpRequest) msg;
Context context = tracer().startSpan(request, channel, channel, "HTTP " + request.method());
try (Scope ignored = context.makeCurrent()) {
ctx.fireChannelRead(msg);
// the span is ended normally in HttpServerResponseTracingHandler

View File

@ -114,6 +114,6 @@ class Netty41ServerTest extends HttpServerTest<EventLoopGroup> implements AgentT
@Override
String expectedServerSpanName(ServerEndpoint endpoint) {
return "netty.request"
return "HTTP GET"
}
}