Class GrpcTraceBinContextPropagator
java.lang.Object
io.grpc.opentelemetry.GrpcTraceBinContextPropagator
- All Implemented Interfaces:
io.opentelemetry.context.propagation.TextMapPropagator
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/11400")
public final class GrpcTraceBinContextPropagator
extends Object
implements io.opentelemetry.context.propagation.TextMapPropagator
A
TextMapPropagator for transmitting "grpc-trace-bin" span context.
This propagator can transmit the "grpc-trace-bin" context in either binary or Base64-encoded
text format, depending on the capabilities of the provided TextMapGetter and
TextMapSetter.
If the TextMapGetter and TextMapSetter only support text format, Base64
encoding and decoding will be used when communicating with the carrier API. But gRPC uses
it with gRPC's metadata-based getter/setter, and the propagator can directly transmit the binary
header, avoiding the need for Base64 encoding.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final io.grpc.Metadata.BinaryMarshaller<io.opentelemetry.api.trace.SpanContext> static final Stringprivate static final GrpcTraceBinContextPropagatorprivate static final Logger -
Constructor Summary
ConstructorsConstructorDescriptionGrpcTraceBinContextPropagator(io.grpc.Metadata.BinaryMarshaller<io.opentelemetry.api.trace.SpanContext> binaryFormat) -
Method Summary
Modifier and TypeMethodDescription<C> io.opentelemetry.context.Contextextract(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapGetter<C> getter) fields()<C> voidinject(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapSetter<C> setter)
-
Field Details
-
log
-
GRPC_TRACE_BIN_HEADER
- See Also:
-
binaryFormat
private final io.grpc.Metadata.BinaryMarshaller<io.opentelemetry.api.trace.SpanContext> binaryFormat -
INSTANCE
-
-
Constructor Details
-
GrpcTraceBinContextPropagator
GrpcTraceBinContextPropagator(io.grpc.Metadata.BinaryMarshaller<io.opentelemetry.api.trace.SpanContext> binaryFormat)
-
-
Method Details
-
defaultInstance
-
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
-