Class 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 gRPC Metadata. 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
    • Constructor Detail

      • MetadataGetter

        MetadataGetter()
    • Method Detail

      • keys

        public java.lang.Iterable<java.lang.String> keys​(io.grpc.Metadata carrier)
        Specified by:
        keys in interface io.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 interface io.opentelemetry.context.propagation.TextMapGetter<io.grpc.Metadata>
      • getBinary

        @Nullable
        public byte[] getBinary​(@Nullable
                                io.grpc.Metadata carrier,
                                java.lang.String key)