To include the Datadog integration for RxJava in your project, simply add the
following to your application's build.gradle.kts file.
dependencies {
implementation("com.datadoghq:dd-sdk-android-rum:<latest-version>")
implementation("com.datadoghq:dd-sdk-android-rx:<latest-version>")
}- Setup RUM monitoring, see the dedicated Datadog Android RUM Collection documentation to learn how.
- Following RxJava's Generated API documentation, you just have to apply the
doOnErroroperator on yourObservable,Flowable,Single,MaybeorCompletableand pass an instance ofDatadogErrorConsumer.
Doing so will automatically intercept any Exception thrown in the upper stream by creating RUM Error events.
Note : If you are using Kotlin in your codebase you could also use the extension: sendErrorToDatadog().
Java:
Observable.create<T>{...}
.doOnError(new DatadogErrorConsumer())
...Kotlin:
Observable.create<T>{...}
.publishErrorsToRum()
...Pull requests are welcome, but please open an issue first to discuss what you would like to change. For more information, read the Contributing Guide.