Class MetadataSetter

java.lang.Object
io.grpc.opentelemetry.MetadataSetter
All Implemented Interfaces:
io.opentelemetry.context.propagation.TextMapSetter<io.grpc.Metadata>

final class MetadataSetter extends 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 Details

    • logger

      private static final Logger logger
    • INSTANCE

      private static final MetadataSetter INSTANCE
  • Constructor Details

    • MetadataSetter

      MetadataSetter()
  • Method Details

    • getInstance

      public static MetadataSetter getInstance()
    • set

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

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