All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.couchbase.transactions.docs.OpenTracing.md Maven / Gradle / Ivy

The newest version!
NOTE: This is preserved for historical reference, but may be severely outdated.  The design document should be used as the
reference now.

The Java client does take an OpenTracing span currently, and instead uses the ThreadLocalScope's active span.  This
does not work well with reactive programming which can schedule operations on different threads.  To work around it,
just before calling any Couchbase operation, the library calls something like

tracer.scopeManager().activate(span)

This puts the span into thread-local storage, ready for the Couchbase operation to pick up.
Still feel this is somewhat hacky as it relies on an implementation detail of the current client threading model,
but best I can do for now.


, TransactionConfig config, Optional span

                            // See OpenTracing.md
                            pspan.ifPresent(s -> config.tracer().ifPresent(tracer -> tracer.scopeManager().activate(s, false)));


        Optional pspan = config.tracer().map(tracer -> tracer.buildSpan("transaction_client_record_process")
                .withTag("client_uuid", clientUuid)
                .withTag("bucket_name", bucketName)
                .ignoreActiveSpan().start());







© 2015 - 2025 Weber Informatics LLC | Privacy Policy