feat(lro): trace GetOperation query and poll sleep#5640
feat(lro): trace GetOperation query and poll sleep#5640abhinavgautam01 wants to merge 2 commits intogoogleapis:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces tracing instrumentation for Long Running Operations (LRO) under the google_cloud_unstable_tracing feature flag. It adds span constants and instruments the poll and until_done methods to provide visibility into polling attempts and sleep intervals. A comprehensive test suite was added to verify span behavior. Feedback was provided regarding significant code duplication in the until_done method, where the polling loop is implemented twice for different configuration flags; a refactor was suggested to unify the logic and improve maintainability.
|
You are duplicating the work in 5621 and 5629. |
Thanks @coryan that makes sense. 5621 touches the same aip151.rs naming (e.g. longrunning_span / gcp.longrunning.*), so I’ll rebase onto it once it lands and match that. 5629 is the T2 + generator side; my change is #5625 (T3/T5 only) in the poller. I’ll rebase again after 5629 if the LRO factory API changes. No intent to redo the 5629 work...or should i close this one..!? |
Fixes #5625
Summary
This change improves LRO (
google.longrunning) polling observability when the crate is built with--cfg google_cloud_unstable_tracingand the poller is constructed with an LRO parent span.It implements the remaining tracing work described in #5625:
GetOperationspan: Each status/query RPC is wrapped in a span namedgoogle.longrunning.Operations/GetOperation, matching the API surface users and backends already talk about.sleepbetween polls is wrapped in its own child span (LRO Poll Sleep) so “waiting” time is separated from other polling work under the existingLRO Pollingspan.Behavior notes
LRO Wait,LRO Polling, sleep, andGetOperation) are only attached when an LRO parent span is provided; callers that do not opt in keep the previous, non-instrumented behavior.poll()now clones the operation name for the query closure and passes the original name intohandle_poll. That keeps semantics correct in all builds and avoids moving the name twice.Testing
tracing-subscriberwhengoogle_cloud_unstable_tracingis enabled.cargo clippy/cargo testwere run with and without the tracing cfg.