Class WebFluxSleuthOperators


  • public final class WebFluxSleuthOperators
    extends Object
    WebFlux operators that are capable to reuse tracing context from Reactor's Context. IMPORTANT: This API is experimental and might change in the future.
    Since:
    3.0.0
    Author:
    Marcin Grzejszczak
    • Method Detail

      • withSpanInScope

        public static Consumer<reactor.core.publisher.Signal> withSpanInScope​(reactor.core.publisher.SignalType signalType,
                                                                              Runnable runnable)
        Wraps a runnable with a span.
        Parameters:
        signalType - - Reactor's signal type
        runnable - - lambda to execute within the tracing context
        Returns:
        consumer of a signal
      • withSpanInScope

        public static Consumer<reactor.core.publisher.Signal> withSpanInScope​(reactor.core.publisher.SignalType signalType,
                                                                              Consumer<reactor.core.publisher.Signal> consumer)
        Wraps a runnable with a span.
        Parameters:
        signalType - - Reactor's signal type
        consumer - - lambda to execute within the tracing context
        Returns:
        consumer of a signal
      • withSpanInScope

        public static Consumer<reactor.core.publisher.Signal> withSpanInScope​(Runnable runnable)
        Wraps a runnable with a span.
        Parameters:
        runnable - - lambda to execute within the tracing context
        Returns:
        consumer of a signal
      • withSpanInScope

        public static void withSpanInScope​(reactor.util.context.Context context,
                                           Runnable runnable)
        Wraps a runnable with a span.
        Parameters:
        context - - Reactor context that contains the TraceContext
        runnable - - lambda to execute within the tracing context
      • withSpanInScope

        public static void withSpanInScope​(reactor.util.context.ContextView context,
                                           Runnable runnable)
        Wraps a runnable with a span.
        Parameters:
        context - - Reactor context that contains the TraceContext
        runnable - - lambda to execute within the tracing context
      • withSpanInScope

        public static <T> T withSpanInScope​(reactor.util.context.Context context,
                                            Callable<T> callable)
        Wraps a callable with a span.
        Type Parameters:
        T - callable's return type
        Parameters:
        context - - Reactor context that contains the TraceContext
        callable - - lambda to execute within the tracing context
        Returns:
        value from the callable
      • withSpanInScope

        public static <T> T withSpanInScope​(reactor.util.context.ContextView context,
                                            Callable<T> callable)
        Wraps a callable with a span.
        Type Parameters:
        T - callable's return type
        Parameters:
        context - - Reactor context that contains the TraceContext
        callable - - lambda to execute within the tracing context
        Returns:
        value from the callable
      • withSpanInScope

        public static void withSpanInScope​(Tracer tracer,
                                           CurrentTraceContext currentTraceContext,
                                           org.springframework.web.server.ServerWebExchange exchange,
                                           Runnable runnable)
        Wraps a runnable with a span.
        Parameters:
        tracer - - tracer bean
        currentTraceContext - - currentTraceContext bean
        exchange - - server web exchange that can contain the TraceContext in its attribute
        runnable - - lambda to execute within the currentTraceContext context
      • withSpanInScope

        public static <T> T withSpanInScope​(Tracer tracer,
                                            CurrentTraceContext currentTraceContext,
                                            org.springframework.web.server.ServerWebExchange exchange,
                                            Callable<T> callable)
        Wraps a callable with a span.
        Type Parameters:
        T - callable's return type
        Parameters:
        tracer - - tracer bean
        currentTraceContext - - currentTraceContext bean
        exchange - - server web exchange that can contain the TraceContext in its attribute
        callable - - lambda to execute within the tracing context
        Returns:
        value from the callable
      • currentTraceContext

        public static TraceContext currentTraceContext​(org.springframework.web.server.ServerWebExchange exchange)
        Returns the current trace context.
        Parameters:
        exchange - - server web exchange that can contain the TraceContext in its attribute
        Returns:
        current trace context or null if it's not present
      • currentTraceContext

        public static TraceContext currentTraceContext​(reactor.util.context.Context context)
        Returns the current trace context.
        Parameters:
        context - - Reactor context that can contain the TraceContext
        Returns:
        current trace context or null if it's not present
      • currentTraceContext

        public static TraceContext currentTraceContext​(reactor.core.publisher.Signal signal)
        Returns the current trace context.
        Parameters:
        signal - - Reactor signal that can contain the TraceContext in its context
        Returns:
        current trace context or null if it's not present