diff --git a/server/src/main/java/org/opensearch/telemetry/tracing/channels/TraceableTcpTransportChannel.java b/server/src/main/java/org/opensearch/telemetry/tracing/channels/TraceableTcpTransportChannel.java index 5ecea2fef1351..333e06eb037cb 100644 --- a/server/src/main/java/org/opensearch/telemetry/tracing/channels/TraceableTcpTransportChannel.java +++ b/server/src/main/java/org/opensearch/telemetry/tracing/channels/TraceableTcpTransportChannel.java @@ -16,7 +16,6 @@ import org.opensearch.telemetry.tracing.SpanScope; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.transport.BaseTcpTransportChannel; -import org.opensearch.transport.TcpChannel; import org.opensearch.transport.TcpTransportChannel; import org.opensearch.transport.TransportChannel; @@ -50,12 +49,11 @@ public TraceableTcpTransportChannel(TcpTransportChannel delegate, Span span, Tra * @param delegate delegate * @param span span * @param tracer tracer - * @param tcpChannel tcpChannel * @return transport channel */ - public static TransportChannel create(TcpTransportChannel delegate, final Span span, final Tracer tracer, final TcpChannel tcpChannel) { + public static TransportChannel create(TcpTransportChannel delegate, final Span span, final Tracer tracer) { if (FeatureFlags.isEnabled(FeatureFlags.TELEMETRY) == true) { - tcpChannel.addCloseListener(new ActionListener() { + delegate.getChannel().addCloseListener(new ActionListener() { @Override public void onResponse(Void unused) { onFailure(null); diff --git a/server/src/main/java/org/opensearch/transport/InboundHandler.java b/server/src/main/java/org/opensearch/transport/InboundHandler.java index f6e90aed860b3..c14a53e799319 100644 --- a/server/src/main/java/org/opensearch/transport/InboundHandler.java +++ b/server/src/main/java/org/opensearch/transport/InboundHandler.java @@ -211,7 +211,7 @@ private void handleRequest(TcpChannel channel, Head header.isHandshake(), message.takeBreakerReleaseControl() ); - TransportChannel traceableTransportChannel = TraceableTcpTransportChannel.create(transportChannel, span, tracer, channel); + TransportChannel traceableTransportChannel = TraceableTcpTransportChannel.create(transportChannel, span, tracer); try { handshaker.handleHandshake(traceableTransportChannel, requestId, stream); } catch (Exception e) { @@ -241,7 +241,7 @@ private void handleRequest(TcpChannel channel, Head header.isHandshake(), message.takeBreakerReleaseControl() ); - TransportChannel traceableTransportChannel = TraceableTcpTransportChannel.create(transportChannel, span, tracer, channel); + TransportChannel traceableTransportChannel = TraceableTcpTransportChannel.create(transportChannel, span, tracer); try { messageListener.onRequestReceived(requestId, action); if (message.isShortCircuit()) {