Class ContextPropagationOperator
java.lang.Object
io.opentelemetry.instrumentation.reactor.v3_1.ContextPropagationOperator
Based on Spring Sleuth's Reactor instrumentation.
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()static ContextPropagationOperatorcreate()static io.opentelemetry.context.ContextgetOpenTelemetryContext(reactor.util.context.Context context, io.opentelemetry.context.Context defaultTraceContext) Gets TraceContextfrom ReactorContext.voidRegisters a hook that applies to every operator, propagatingContextto downstream callbacks to ensure spans in theContextare available throughout the lifetime of a reactive stream.voidUnregisters the hook registered byregisterOnEachOperator().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.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.static reactor.util.context.ContextstoreOpenTelemetryContext(reactor.util.context.Context context, io.opentelemetry.context.Context traceContext) Stores TraceContextin ReactorContext.
-
Method Details
-
create
-
builder
-
storeOpenTelemetryContext
public static reactor.util.context.Context storeOpenTelemetryContext(reactor.util.context.Context context, io.opentelemetry.context.Context traceContext) Stores TraceContextin ReactorContext.- 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 TraceContextfrom ReactorContext.- 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, propagatingContextto downstream callbacks to ensure spans in theContextare 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 byregisterOnEachOperator(). -
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.
-