Class ExtendedContextPropagators


  • public final class ExtendedContextPropagators
    extends java.lang.Object
    Utility class to simplify context propagation.

    The README explains the use cases in more detail.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static TextMapGetter<java.util.Map<java.lang.String,​java.lang.String>> TEXT_MAP_GETTER  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Context extractTextMapPropagationContext​(java.util.Map<java.lang.String,​java.lang.String> carrier, ContextPropagators propagators)
      Extract the context from a string map, which you get from HTTP headers of the metadata of a message you're processing.
      static java.util.Map<java.lang.String,​java.lang.String> getTextMapPropagationContext​(ContextPropagators propagators)
      Injects the current context into a string map, which can then be added to HTTP headers or the metadata of a message.
      • Methods inherited from class java.lang.Object

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

      • TEXT_MAP_GETTER

        private static final TextMapGetter<java.util.Map<java.lang.String,​java.lang.String>> TEXT_MAP_GETTER
    • Constructor Detail

      • ExtendedContextPropagators

        private ExtendedContextPropagators()
    • Method Detail

      • getTextMapPropagationContext

        public static java.util.Map<java.lang.String,​java.lang.String> getTextMapPropagationContext​(ContextPropagators propagators)
        Injects the current context into a string map, which can then be added to HTTP headers or the metadata of a message.
        Parameters:
        propagators - provide the propagators from OpenTelemetry.getPropagators()
      • extractTextMapPropagationContext

        public static Context extractTextMapPropagationContext​(java.util.Map<java.lang.String,​java.lang.String> carrier,
                                                               ContextPropagators propagators)
        Extract the context from a string map, which you get from HTTP headers of the metadata of a message you're processing.
        Parameters:
        carrier - the string map
        propagators - provide the propagators from OpenTelemetry.getPropagators()