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 MetadataGetterINSTANCEprivate static java.util.logging.Loggerlogger
-
Constructor Summary
Constructors Constructor Description MetadataGetter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringget(io.grpc.Metadata carrier, java.lang.String key)byte[]getBinary(io.grpc.Metadata carrier, java.lang.String key)static MetadataGettergetInstance()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:
keysin 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:
getin interfaceio.opentelemetry.context.propagation.TextMapGetter<io.grpc.Metadata>
-
getBinary
@Nullable public byte[] getBinary(@Nullable io.grpc.Metadata carrier, java.lang.String key)
-
-