Class WebFluxSleuthOperators
java.lang.Object
org.springframework.cloud.sleuth.instrument.web.WebFluxSleuthOperators
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
Modifier and TypeMethodDescriptionstatic 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 Details
-
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
Wraps a runnable with a span.- Parameters:
runnable- - lambda to execute within the tracing context- Returns:
- consumer of a signal
-
withSpanInScope
Wraps a runnable with a span.- Parameters:
context- - Reactor context that contains theTraceContextrunnable- - lambda to execute within the tracing context
-
withSpanInScope
Wraps a runnable with a span.- Parameters:
context- - Reactor context that contains theTraceContextrunnable- - lambda to execute within the tracing context
-
withSpanInScope
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
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
Returns the current trace context.- Parameters:
context- - Reactor context that can contain theTraceContext- Returns:
- current trace context or
nullif it's not present
-
currentTraceContext
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
-