Class PassThroughPropagator
- java.lang.Object
-
- io.opentelemetry.extension.incubator.propagation.PassThroughPropagator
-
- All Implemented Interfaces:
io.opentelemetry.context.propagation.TextMapPropagator
public final class PassThroughPropagator extends Object implements io.opentelemetry.context.propagation.TextMapPropagator
ATextMapPropagator
which can be configured with a set of fields, which will be extracted and stored inContext
. If theContext
is used again to inject, the values will be injected as-is. ThisTextMapPropagator
is appropriate for a service that does not need to participate in telemetry in any way and provides the most efficient way of propagating incoming context to outgoing requests. In almost all cases, you will configure this singleTextMapPropagator
when usingOpenTelemetry.propagating(ContextPropagators)
to create anOpenTelemetry
that only propagates. Similarly, you will never need this when using the OpenTelemetry SDK to enable telemetry.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static io.opentelemetry.context.propagation.TextMapPropagator
create(Iterable<String> fields)
Returns aTextMapPropagator
which will propagate the givenfields
from extraction to injection.static io.opentelemetry.context.propagation.TextMapPropagator
create(String... fields)
Returns aTextMapPropagator
which will propagate the givenfields
from extraction to injection.<C> io.opentelemetry.context.Context
extract(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapGetter<C> getter)
Collection<String>
fields()
<C> void
inject(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapSetter<C> setter)
-
-
-
Method Detail
-
create
public static io.opentelemetry.context.propagation.TextMapPropagator create(String... fields)
Returns aTextMapPropagator
which will propagate the givenfields
from extraction to injection.
-
create
public static io.opentelemetry.context.propagation.TextMapPropagator create(Iterable<String> fields)
Returns aTextMapPropagator
which will propagate the givenfields
from extraction to injection.
-
fields
public Collection<String> fields()
- Specified by:
fields
in 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:
inject
in 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:
extract
in interfaceio.opentelemetry.context.propagation.TextMapPropagator
-
-