public class B3TextMapCodec extends java.lang.Object implements Codec<io.opentracing.propagation.TextMap>
Example usage:
b3Codec = new B3TextMapCodec();
tracer = new JaegerTracer.Builder(serviceName, reporter, sampler)
.registerInjector(Format.Builtin.HTTP_HEADERS, b3Codec)
.registerExtractor(Format.Builtin.HTTP_HEADERS, b3Codec)
...
See Instrumenting a Library
Note that this codec automatically propagates baggage
(with "baggage-" prefix).
Baggage whitelisting can be configured in BaggageRestrictionManager
and then
passed to JaegerTracer.Builder#baggageRestrictionManager
Modifier and Type | Class and Description |
---|---|
static class |
B3TextMapCodec.Builder |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
BAGGAGE_PREFIX |
protected static byte |
DEBUG_FLAG |
protected static java.lang.String |
FLAGS_NAME |
protected static java.lang.String |
PARENT_SPAN_ID_NAME |
protected static byte |
SAMPLED_FLAG |
protected static java.lang.String |
SAMPLED_NAME |
protected static java.lang.String |
SPAN_ID_NAME |
protected static java.lang.String |
TRACE_ID_NAME |
Constructor and Description |
---|
B3TextMapCodec()
Deprecated.
use
B3TextMapCodec.Builder instead |
Modifier and Type | Method and Description |
---|---|
JaegerSpanContext |
extract(io.opentracing.propagation.TextMap carrier)
Called when
Tracer.extract(io.opentracing.propagation.Format, Object)
is used. |
void |
inject(JaegerSpanContext spanContext,
io.opentracing.propagation.TextMap carrier)
Called when
Tracer.inject(io.opentracing.SpanContext, Format, Object)
is used. |
protected static final java.lang.String TRACE_ID_NAME
protected static final java.lang.String SPAN_ID_NAME
protected static final java.lang.String PARENT_SPAN_ID_NAME
protected static final java.lang.String SAMPLED_NAME
protected static final java.lang.String FLAGS_NAME
protected static final java.lang.String BAGGAGE_PREFIX
protected static final byte SAMPLED_FLAG
protected static final byte DEBUG_FLAG
@Deprecated public B3TextMapCodec()
B3TextMapCodec.Builder
insteadpublic void inject(JaegerSpanContext spanContext, io.opentracing.propagation.TextMap carrier)
Injector
Called when Tracer.inject(io.opentracing.SpanContext, Format, Object)
is used. It should handle the logic behind injecting propagation scheme
specific information into the carrier (e.g. http request headers, amqp message headers,
etc.).
All exceptions thrown from this method will be caught and logged on ERROR
level so
that business code execution isn't affected. If possible, catch implementation specific
exceptions and log more meaningful information.
inject
in interface Injector<io.opentracing.propagation.TextMap>
spanContext
- span context that should be used to pass trace information with the carriercarrier
- holder of data that is used to pass tracing information between processesB3TextMapCodec
,
TextMapCodec
public JaegerSpanContext extract(io.opentracing.propagation.TextMap carrier)
Extractor
Called when Tracer.extract(io.opentracing.propagation.Format, Object)
is used. It should handle the logic behind extracting propagation-scheme
specific information from carrier (e.g. http request headers, amqp message headers, etc.).
This method must not modify the carrier
All exceptions thrown from this method will be caught and logged on WARN
level so
that business code execution isn't affected. If possible, catch implementation specific
exceptions and log more meaningful information.
extract
in interface Extractor<io.opentracing.propagation.TextMap>
carrier
- input that you extract Span information from, usually TextMap
.JaegerSpanContext
or null
if carrier doesn't contain tracing information, it
is not valid or is incompleteB3TextMapCodec
,
TextMapCodec