-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish Netty 4.1 spans after response has completed not when it started. #2641
Finish Netty 4.1 spans after response has completed not when it started. #2641
Conversation
@iNikem your favorite instrumentation! |
// Headers before body has been sent, store them to use when finishing the span. | ||
ctx.channel().attr(HTTP_RESPONSE).set((HttpResponse) msg); | ||
} else if (msg instanceof LastHttpContent) { | ||
// Not a FullHttpResponse so this is content that has been sent after headers. Finish the | ||
// span using what we stored in attrs. | ||
tracer().end(context, ctx.channel().attr(HTTP_RESPONSE).get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it confusing that you talk about "sending" here. This is client response handler, it receives data, not sends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
...ntelemetry/javaagent/instrumentation/netty/v4_1/client/HttpClientResponseTracingHandler.java
Outdated
Show resolved
Hide resolved
...ntelemetry/javaagent/instrumentation/netty/v4_1/server/HttpServerResponseTracingHandler.java
Outdated
Show resolved
Hide resolved
...ntelemetry/javaagent/instrumentation/netty/v4_1/server/HttpServerResponseTracingHandler.java
Outdated
Show resolved
Hide resolved
…ntelemetry/javaagent/instrumentation/netty/v4_1/client/HttpClientResponseTracingHandler.java Co-authored-by: Trask Stalnaker <[email protected]>
…ntelemetry/javaagent/instrumentation/netty/v4_1/server/HttpServerResponseTracingHandler.java Co-authored-by: Trask Stalnaker <[email protected]>
…ntelemetry/javaagent/instrumentation/netty/v4_1/server/HttpServerResponseTracingHandler.java Co-authored-by: Trask Stalnaker <[email protected]>
Currently, we end an outbound span as soon as headers are sent, even if the data is chunked and it will take some time to send it all. We should end the span after the last (potentially only but still should wait for the I/O) write is finished instead.
Guessing this applies to other Netty instrumentations too but just started with 4.1 to confirm the approach.