Class B3Propagator
- java.lang.Object
-
- io.opentelemetry.extension.trace.propagation.B3Propagator
-
- All Implemented Interfaces:
io.opentelemetry.context.propagation.TextMapPropagator
@Immutable public final class B3Propagator extends Object implements io.opentelemetry.context.propagation.TextMapPropagator
Implementation of the B3 propagation protocol. See openzipkin/b3-propagation.Also see B3 Requirements
To register the default B3 propagator, which injects a single header, use:
OpenTelemetry.setPropagators( DefaultContextPropagators .builder() .addTextMapPropagator(B3Propagator.injectingSingleHeader()) .build());To register a B3 propagator that injects multiple headers, use:
OpenTelemetry.setPropagators( DefaultContextPropagators .builder() .addTextMapPropagator(B3Propagator.injectingMultiHeaders()) .build());
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <C> io.opentelemetry.context.Contextextract(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapGetter<C> getter)Collection<String>fields()<C> voidinject(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapSetter<C> setter)static B3PropagatorinjectingMultiHeaders()Returns an instance of theB3Propagatorthat injects multi headers format.static B3PropagatorinjectingSingleHeader()Returns an instance of theB3Propagatorthat injects single header format.
-
-
-
Method Detail
-
injectingMultiHeaders
public static B3Propagator injectingMultiHeaders()
Returns an instance of theB3Propagatorthat injects multi headers format.This instance extracts both formats, in the order: single header, multi header.
- Returns:
- an instance of the
B3Propagatorthat injects multi headers format.
-
injectingSingleHeader
public static B3Propagator injectingSingleHeader()
Returns an instance of theB3Propagatorthat injects single header format.This instance extracts both formats, in the order: single header, multi header.
This is the default instance for
B3Propagator.- Returns:
- an instance of the
B3Propagatorthat injects single header format.
-
fields
public Collection<String> fields()
- Specified by:
fieldsin interfaceio.opentelemetry.context.propagation.TextMapPropagator
-
inject
public <C> void inject(io.opentelemetry.context.Context context, @Nullable C carrier, io.opentelemetry.context.propagation.TextMapSetter<C> setter)- Specified by:
injectin interfaceio.opentelemetry.context.propagation.TextMapPropagator
-
extract
public <C> io.opentelemetry.context.Context extract(io.opentelemetry.context.Context context, @Nullable C carrier, io.opentelemetry.context.propagation.TextMapGetter<C> getter)- Specified by:
extractin interfaceio.opentelemetry.context.propagation.TextMapPropagator
-
-