Remove write context
~(currently built on top of
MODIFY
instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/AttributeKeys.java
instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/AttributeKeys.java
@@ -22,9 +22,6 @@ public class AttributeKeys {
}
};
- public static final AttributeKey<Context> WRITE_CONTEXT =
- attributeKey(AttributeKeys.class.getName() + ".write-context");
-
// this is the context that has the server span
public static final AttributeKey<Context> SERVER_CONTEXT =
attributeKey(AttributeKeys.class.getName() + ".server-context");

MODIFY
instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/HttpClientRequestTracingHandler.java
instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/HttpClientRequestTracingHandler.java
@@ -26,10 +26,7 @@ public class HttpClientRequestTracingHandler extends ChannelOutboundHandlerAdapt
return;
}
- Context parentContext = ctx.channel().attr(AttributeKeys.WRITE_CONTEXT).getAndRemove();
- if (parentContext == null) {
- parentContext = Context.current();
- }
+ Context parentContext = Context.current();
HttpRequestAndChannel request = HttpRequestAndChannel.create((HttpRequest) msg, ctx.channel());
if (!instrumenter().shouldStart(parentContext, request)) {

MODIFY
instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/NettyClientTelemetry.java
instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/NettyClientTelemetry.java
@@ -71,7 +71,8 @@ public final class NettyClientTelemetry {
* Propagate the {@link Context} to the {@link Channel}. This MUST be called before each HTTP
* request executed on a {@link Channel}.
*/
+ // TODO (trask) rename to setParentContext()?
public static void setChannelContext(Channel channel, Context context) {
- channel.attr(AttributeKeys.WRITE_CONTEXT).set(context);
+ channel.attr(AttributeKeys.CLIENT_PARENT_CONTEXT).set(context);
}
}

MODIFY
instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/AttributeKeys.java
instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/AttributeKeys.java
@@ -14,9 +14,6 @@ import io.opentelemetry.context.Context;
*/
public final class AttributeKeys {
- public static final AttributeKey<Context> WRITE_CONTEXT =
- AttributeKey.valueOf(AttributeKeys.class, "passed-context");
-
// this is the context that has the server span
//
// note: this attribute key is also used by ratpack instrumentation

MODIFY
instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/client/HttpClientRequestTracingHandler.java
instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/client/HttpClientRequestTracingHandler.java
@@ -41,7 +41,7 @@ public class HttpClientRequestTracingHandler extends ChannelOutboundHandlerAdapt
return;
}
- Context parentContext = ctx.channel().attr(AttributeKeys.WRITE_CONTEXT).getAndSet(null);
+ Context parentContext = ctx.channel().attr(AttributeKeys.CLIENT_PARENT_CONTEXT).get();
if (parentContext == null) {
parentContext = Context.current();
}

Remove write context (#7735)

~(currently built on top of #7732)~