Skip to content

Commit c30f9d8

Browse files
opentelemetrybotPeriecle
andauthoredJan 23, 2024
[release/v1.32.x] Make Netty Instrumentation HttpServerRequestTracingHandler propagate "Channel Inactive" event to downstream according to parent contract (#10315)
Co-authored-by: Roman Kvasnytskyi <roman@kvasnytskyi.net>
1 parent 775620c commit c30f9d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/server/HttpServerRequestTracingHandler.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,21 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
7373
}
7474

7575
@Override
76-
public void channelInactive(ChannelHandlerContext ctx) {
76+
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
7777
// connection was closed, close all remaining requests
7878
Attribute<Deque<ServerContext>> contextAttr = ctx.channel().attr(AttributeKeys.SERVER_CONTEXT);
7979
Deque<ServerContext> serverContexts = contextAttr.get();
8080

8181
if (serverContexts == null) {
82+
super.channelInactive(ctx);
8283
return;
8384
}
8485

8586
ServerContext serverContext;
8687
while ((serverContext = serverContexts.pollFirst()) != null) {
8788
instrumenter.end(serverContext.context(), serverContext.request(), null, null);
8889
}
90+
super.channelInactive(ctx);
8991
}
9092

9193
private static <T> Deque<T> getOrCreate(Channel channel, AttributeKey<Deque<T>> key) {

0 commit comments

Comments
 (0)
Please sign in to comment.