Class ContextPropagationOperator

java.lang.Object
io.opentelemetry.instrumentation.reactor.v3_1.ContextPropagationOperator

public final class ContextPropagationOperator extends Object
Based on Spring Sleuth's Reactor instrumentation.
  • Method Details

    • create

      public static ContextPropagationOperator create()
    • builder

      public static ContextPropagationOperatorBuilder builder()
    • storeOpenTelemetryContext

      public static reactor.util.context.Context storeOpenTelemetryContext(reactor.util.context.Context context, io.opentelemetry.context.Context traceContext)
      Stores Trace Context in Reactor Context.
      Parameters:
      context - Reactor's context to store trace context in.
      traceContext - Trace context to be stored.
    • getOpenTelemetryContext

      public static io.opentelemetry.context.Context getOpenTelemetryContext(reactor.util.context.Context context, io.opentelemetry.context.Context defaultTraceContext)
      Gets Trace Context from Reactor Context.
      Parameters:
      context - Reactor's context to get trace context from.
      defaultTraceContext - Default value to be returned if no trace context is found on Reactor context.
      Returns:
      Trace context or default value.
    • registerOnEachOperator

      public void registerOnEachOperator()
      Registers a hook that applies to every operator, propagating Context to downstream callbacks to ensure spans in the Context are available throughout the lifetime of a reactive stream. This should generally be called in a static initializer block in your application.
    • resetOnEachOperator

      public void resetOnEachOperator()
      Unregisters the hook registered by registerOnEachOperator().
    • runWithContext

      public static <T> reactor.core.publisher.Mono<T> runWithContext(reactor.core.publisher.Mono<T> publisher, io.opentelemetry.context.Context tracingContext)
      Forces Mono to run in traceContext scope.
    • runWithContext

      public static <T> reactor.core.publisher.Flux<T> runWithContext(reactor.core.publisher.Flux<T> publisher, io.opentelemetry.context.Context tracingContext)
      Forces Flux to run in traceContext scope.