Tracing
Tracing Couchbase Distributed ACID transactions.
If configured, detailed telemetry on each transaction can be output that is compatible with various external systems including OpenTelemetry and its predecessor OpenTracing. This telemetry is particularly useful for monitoring performance.
See the SDK Request Tracing documentation for how to configure this.
Tracing should currently be regarded as 'developer preview' functionality, as the spans and attributes output may change over time.
Parent Spans
The application may wish to indicate that the transaction is part of a larger span — for instance, a user request. It can do this by passing that as a parent span.
This can be done using the SDK’s RequestTracer
abstraction as so:
var span = cluster.environment().requestTracer().requestSpan("your-span-name", null);
cluster.transactions().run((ctx) -> {
// your transaction
}, transactionOptions().parentSpan(span));
Or if you have an existing OpenTelemetry span you can easily convert it to a Couchbase RequestSpan
and pass it to the SDK:
var span = Span.current(); // this is a span created by your code earlier
var wrapped = OpenTelemetryRequestSpan.wrap(span);
cluster.transactions().run((ctx) -> {
// your transaction
}, transactionOptions().parentSpan(wrapped));