Class WebFluxSleuthOperators
- java.lang.Object
-
- org.springframework.cloud.sleuth.instrument.web.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TraceContextcurrentTraceContext(org.springframework.web.server.ServerWebExchange exchange)Returns the current trace context.static TraceContextcurrentTraceContext(reactor.core.publisher.Signal signal)Returns the current trace context.static TraceContextcurrentTraceContext(reactor.util.context.Context context)Returns the current trace context.static Consumer<reactor.core.publisher.Signal>withSpanInScope(Runnable runnable)Wraps a runnable with a span.static voidwithSpanInScope(Tracer tracer, CurrentTraceContext currentTraceContext, org.springframework.web.server.ServerWebExchange exchange, Runnable runnable)Wraps a runnable with a span.static <T> TwithSpanInScope(Tracer tracer, CurrentTraceContext currentTraceContext, org.springframework.web.server.ServerWebExchange exchange, Callable<T> callable)Wraps a callable with a span.static Consumer<reactor.core.publisher.Signal>withSpanInScope(reactor.core.publisher.SignalType signalType, Runnable runnable)Wraps a runnable with a span.static Consumer<reactor.core.publisher.Signal>withSpanInScope(reactor.core.publisher.SignalType signalType, Consumer<reactor.core.publisher.Signal> consumer)Wraps a runnable with a span.static voidwithSpanInScope(reactor.util.context.Context context, Runnable runnable)Wraps a runnable with a span.static <T> TwithSpanInScope(reactor.util.context.Context context, Callable<T> callable)Wraps a callable with a span.static voidwithSpanInScope(reactor.util.context.ContextView context, Runnable runnable)Wraps a runnable with a span.static <T> TwithSpanInScope(reactor.util.context.ContextView context, Callable<T> callable)Wraps a callable with a span.
-
-
-
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 typerunnable- - 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 typeconsumer- - 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 theTraceContextrunnable- - 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 theTraceContextrunnable- - 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 theTraceContextcallable- - 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 theTraceContextcallable- - 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 beancurrentTraceContext- - currentTraceContext beanexchange- - server web exchange that can contain theTraceContextin its attributerunnable- - 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 beancurrentTraceContext- - currentTraceContext beanexchange- - server web exchange that can contain theTraceContextin its attributecallable- - 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 theTraceContextin its attribute- Returns:
- current trace context or
nullif 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 theTraceContext- Returns:
- current trace context or
nullif 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 theTraceContextin its context- Returns:
- current trace context or
nullif it's not present
-
-