Provides OpenTelemetry instrumentation for Project Reactor, enabling context propagation through Reactor's execution model.
Replace OPENTELEMETRY_VERSION with the latest release.
For Maven, add to your pom.xml dependencies:
<dependencies>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-reactor-3.1</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>
</dependencies>For Gradle, add to your dependencies:
implementation("io.opentelemetry.instrumentation:opentelemetry-reactor-3.1:OPENTELEMETRY_VERSION")import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.reactor.v3_1.ContextPropagationOperator;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class ReactorExample {
public static void main(String[] args) {
ContextPropagationOperator contextPropagationOperator = ContextPropagationOperator.create();
contextPropagationOperator.registerOnEachOperator();
Mono<String> mono = Mono.just("Hello, World!");
Flux<String> flux = Flux.just("Hello", "World");
...
}
}