Class PassThroughPropagator

  • All Implemented Interfaces:
    io.opentelemetry.context.propagation.TextMapPropagator

    public final class PassThroughPropagator
    extends Object
    implements io.opentelemetry.context.propagation.TextMapPropagator
    A TextMapPropagator which can be configured with a set of fields, which will be extracted and stored in Context. If the Context is used again to inject, the values will be injected as-is. This TextMapPropagator is appropriate for a service that does not need to participate in telemetry in any way and provides the most efficient way of propagating incoming context to outgoing requests. In almost all cases, you will configure this single TextMapPropagator when using OpenTelemetry.propagating(ContextPropagators) to create an OpenTelemetry that only propagates. Similarly, you will never need this when using the OpenTelemetry SDK to enable telemetry.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static io.opentelemetry.context.propagation.TextMapPropagator create​(Iterable<String> fields)
      Returns a TextMapPropagator which will propagate the given fields from extraction to injection.
      static io.opentelemetry.context.propagation.TextMapPropagator create​(String... fields)
      Returns a TextMapPropagator which will propagate the given fields from extraction to injection.
      <C> io.opentelemetry.context.Context extract​(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapGetter<C> getter)  
      Collection<String> fields()  
      <C> void inject​(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapSetter<C> setter)  
    • Method Detail

      • create

        public static io.opentelemetry.context.propagation.TextMapPropagator create​(String... fields)
        Returns a TextMapPropagator which will propagate the given fields from extraction to injection.
      • create

        public static io.opentelemetry.context.propagation.TextMapPropagator create​(Iterable<String> fields)
        Returns a TextMapPropagator which will propagate the given fields from extraction to injection.
      • fields

        public Collection<String> fields()
        Specified by:
        fields in interface io.opentelemetry.context.propagation.TextMapPropagator
      • inject

        public <C> void inject​(io.opentelemetry.context.Context context,
                               @Nullable
                               C carrier,
                               io.opentelemetry.context.propagation.TextMapSetter<C> setter)
        Specified by:
        inject in interface io.opentelemetry.context.propagation.TextMapPropagator
      • extract

        public <C> io.opentelemetry.context.Context extract​(io.opentelemetry.context.Context context,
                                                            @Nullable
                                                            C carrier,
                                                            io.opentelemetry.context.propagation.TextMapGetter<C> getter)
        Specified by:
        extract in interface io.opentelemetry.context.propagation.TextMapPropagator