I’m using couchbase in a service that reads couchbase and makes remote calls based on the couchbase results. We are using spring-cloud-sleuth for distributed tracing across services.
Sleuth supports calls across RxJava threads using RxJavaSchedulersHook (https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java)
The distributed tracing is working across RxJava threads except in the case where we need to read couchbase get(id, target), then call other services for additional information.
I think the issue occurs in CouchbaseAsyncBucket.get(id, target). The method calls OnSubscribeDefer that ends up calling o.unsafeSubscribe(Subscribers.wrap(s)); (see javadoc below)
The call to unsafeSubscribe loses the information in the RxJavaSchedulersHook. Is there a way to use couchbase.java-client asyncBucket.get(id) without losing the RxJavaSchedulersHook?
Subscribes to an Observable and invokes OnSubscribe function without any contract protection, error handling, unsubscribe, or execution hooks.