parent
b9918ab513
commit
7be766a78b
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue