Package io.grpc.opentelemetry
Class MetadataGetter
- java.lang.Object
-
- io.grpc.opentelemetry.MetadataGetter
-
- All Implemented Interfaces:
io.opentelemetry.context.propagation.TextMapGetter<io.grpc.Metadata>
final class MetadataGetter extends java.lang.Object implements io.opentelemetry.context.propagation.TextMapGetter<io.grpc.Metadata>
A TextMapGetter that reads value from gRPCMetadata
. Supports both text and binary headers. Supporting binary header is an optimization path for GrpcTraceBinContextPropagator to work around the lack of binary propagator API and thus avoid base64 (de)encoding when passing data between propagator API interfaces.
-
-
Field Summary
Fields Modifier and Type Field Description private static MetadataGetter
INSTANCE
private static java.util.logging.Logger
logger
-
Constructor Summary
Constructors Constructor Description MetadataGetter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
get(io.grpc.Metadata carrier, java.lang.String key)
byte[]
getBinary(io.grpc.Metadata carrier, java.lang.String key)
static MetadataGetter
getInstance()
java.lang.Iterable<java.lang.String>
keys(io.grpc.Metadata carrier)
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
INSTANCE
private static final MetadataGetter INSTANCE
-
-
Method Detail
-
getInstance
public static MetadataGetter getInstance()
-
keys
public java.lang.Iterable<java.lang.String> keys(io.grpc.Metadata carrier)
- Specified by:
keys
in interfaceio.opentelemetry.context.propagation.TextMapGetter<io.grpc.Metadata>
-
get
@Nullable public java.lang.String get(@Nullable io.grpc.Metadata carrier, java.lang.String key)
- Specified by:
get
in interfaceio.opentelemetry.context.propagation.TextMapGetter<io.grpc.Metadata>
-
getBinary
@Nullable public byte[] getBinary(@Nullable io.grpc.Metadata carrier, java.lang.String key)
-
-