Add tracing spans to public Client RPC methods - #86
Open
divbhasin wants to merge 1 commit into
Open
Conversation
Each public RPC and MultiReader/MultiWriter::commit now opens a `zk.<op>` `info_span!` and records errors via `tracing::error!`. Methods returning `impl Future<Output = Result<…>>` can't use `#[instrument(err)]`, so a `Client::traced` helper awaits the future inside the span and emits the error event.
Owner
|
The two spans are there for reasons:
In contrast, most client apis are simple request-response style channels to get responses. I guess you probably should wrap the client somewhat to fit your application needs. |
kezhuw
self-requested a review
July 30, 2026 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
tracing::info_span!to the public RPC entry points on Client, MultiReader, and MultiWriter so callers with a tracing subscriber can observe per-call latency, span hierarchy, and errors for their ZooKeeper operations.The crate already uses tracing internally (#[instrument] on session functions, tracing::error! in the watcher loop). This extends the same pattern to the public API surface.
What's instrumented
Client::{mkdir, create, delete, get_data, set_data, get_and_watch_data, check_stat, check_and_watch_stat, get_children, get_and_watch_children, sync}, plusMultiReader::commit and MultiWriter::commit.Each call opens an
info_span!("zk.<op>", path = %path)(orkind = "reader" | "writer"for the multivariants) and records
Erroutcomes via atracing::error!event so tracing-opentelemetry and similarsubscriber bridges mark the span as errored.
Testing
This has been tested with our internal usage of the client.