Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcian committed Feb 11, 2025
1 parent c6cb568 commit 1e21862
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions sentry-reactor/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# sentry-reactor

This module provides a set of utilities to manually instrument your application to send data to Sentry when using [Reactor](https://projectreactor.io/).
This module provides a set of utilities to use Sentry with [Reactor](https://projectreactor.io/).

## Setup

Please refer to the documentation on how to set up our [Java SDK](https://docs.sentry.io/platforms/java/),
or our [Spring](https://docs.sentry.io/platforms/java/guides/spring/)
or [Spring Boot](https://docs.sentry.io/platforms/java/guides/spring-boot/) integrations if you are using Spring WebFlux.
or [Spring Boot](https://docs.sentry.io/platforms/java/guides/spring-boot/) integrations if you're using Spring WebFlux.

If you're using our Spring Boot integration, this module will be available and set up automatically.
If you're using our Spring Boot integration, this module will be available and used under the hood to automatically instrument WebFlux.
If you're using our Spring integration, you need to configure WebFlux as we do in [SentryWebFluxAutoConfiguration](https://github.com/getsentry/sentry-java/blob/a5098280b52aec28c71c150e286b5c937767634d/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfiguration.java) for Spring Boot.
Then, read on to the next section to find out how to use the utilities.

Otherwise, you'll need to perform the following steps to get started.
If you're not using Spring or Spring Boot, you'll need to perform the following steps to get started.

Add the latest version of `io.sentry.reactor` as a dependency.
Make sure you are using `io.micrometer:context-propagation:1.0.2` or later, provided by `io.projectreactor:reactor-core:3.5.3` or later.
Add the latest version of `io.sentry.reactor` as a dependency.
Make sure you're using `io.micrometer:context-propagation:1.0.2` or later, and `io.projectreactor:reactor-core:3.5.3` or later.

Then, enable automatic context propagation, which should happen as early as possible in your application lifecycle:
Then, enable automatic context propagation:
```java
import reactor.core.publisher.Hooks;
// ...
Expand Down Expand Up @@ -43,17 +45,16 @@ ContextRegistry.getInstance().loadThreadLocalAccessors();

## Usage

You can use the provided utilities to wrap `Mono` and `Flux` objects to enable correct errors, breadcrumbs and tracing reporting in your application.
You can use the utilities provided by this module to wrap `Mono` and `Flux` objects to enable correct errors, breadcrumbs and tracing in your application.

For normal use cases, you should wrap your operations on `Mono` or `Flux` objects using the `withSentry` function.
This will fork the *current scopes* and use them throughout the stream's execution context.

You can use the provided utilities to wrap `Mono` and `Flux` objects to enable correct error, breadcrumbs and tracing reporting for your reactive streams.
For more complex use cases, you can also use `withSentryForkedRoots` to fork the root scopes or `withSentryScopes` to wrap the operation in arbitrary scopes.

For more complex use cases, you can also use the `withSentryForkedRoots` to fork the root scopes or `withSentryScopes` to wrap the operation in arbitrary scopes.
For more information, you can consult our [scopes documentation](https://docs.sentry.io/platforms/java/enriching-events/scopes).
For more information on scopes and scope forking, please consult our [scopes documentation](https://docs.sentry.io/platforms/java/enriching-events/scopes).

Examples of usage of this module with Spring WebFlux are provided in
Examples of usage of this module with (Spring WebFlux) are provided in
[sentry-samples-spring-boot-webflux](https://github.com/getsentry/sentry-java/tree/main/sentry-samples/sentry-samples-spring-boot-webflux)
and
[sentry-samples-spring-boot-webflux-jakarta](https://github.com/getsentry/sentry-java/tree/main/sentry-samples/sentry-samples-spring-boot-webflux-jakarta)
Expand Down

0 comments on commit 1e21862

Please sign in to comment.