Class MetadataSetter

  • All Implemented Interfaces:
    io.opentelemetry.context.propagation.TextMapSetter<io.grpc.Metadata>

    final class MetadataSetter
    extends java.lang.Object
    implements io.opentelemetry.context.propagation.TextMapSetter<io.grpc.Metadata>
    A TextMapSetter that sets value to 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 MetadataSetter INSTANCE  
      private static java.util.logging.Logger logger  
    • Constructor Summary

      Constructors 
      Constructor Description
      MetadataSetter()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static MetadataSetter getInstance()  
      (package private) void set​(io.grpc.Metadata carrier, java.lang.String key, byte[] value)  
      void set​(io.grpc.Metadata carrier, java.lang.String key, java.lang.String value)  
      • 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

      • MetadataSetter

        MetadataSetter()
    • Method Detail

      • set

        public void set​(@Nullable
                        io.grpc.Metadata carrier,
                        java.lang.String key,
                        java.lang.String value)
        Specified by:
        set in interface io.opentelemetry.context.propagation.TextMapSetter<io.grpc.Metadata>
      • set

        void set​(@Nullable
                 io.grpc.Metadata carrier,
                 java.lang.String key,
                 byte[] value)