Class PassThroughPropagator

java.lang.Object
io.opentelemetry.api.incubator.propagation.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

    Modifier and Type
    Method
    Description
    static io.opentelemetry.context.propagation.TextMapPropagator
    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)
     
     
    <C> void
    inject(io.opentelemetry.context.Context context, C carrier, io.opentelemetry.context.propagation.TextMapSetter<C> setter)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object