Skip to content

fix(telemetry): keep async polling retries non-terminal - #290

Closed
jay-xiao446 wants to merge 1 commit into
mainfrom
fix/telemetry-transient-poll-success
Closed

jay-xiao446 wants to merge 1 commit into
mainfrom
fix/telemetry-transient-poll-success

Conversation

@jay-xiao446

Copy link
Copy Markdown
Collaborator

Summary

  • Keep async statement telemetry open when status() returns a retryable polling RPC error so a later successful poll/fetch can emit the terminal success event.
  • Defuse await_result()'s drop-cancel guard when returning a retryable status poll RPC error, preserving the server query for caller retry.
  • Add a wiremock regression for transient status poll failure -> retry -> successful result drain -> exactly one successful async statement telemetry event.

Test Plan

  • cargo test async_statement_retryable_status_error_then_success_exports_one_success_event --lib --locked
  • cargo test async_statement_ --lib --locked
  • cargo test telemetry --lib --locked
  • cargo clippy --all-targets --locked -- -D warnings

Signed-off-by: Jay Xiao <jay.xiao@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good — the change correctly keeps telemetry open and defuses the drop-cancel guard on retryable status-poll RPC errors, is well-scoped, and has a solid wiremock regression. finalize idempotency and the Error.retryable gating check out. One low-severity note: the Drop fallback now reports success (finalize(None)) for a statement abandoned after only transient poll errors, where it previously reported the error.

.instrument(span)
.await;
if let Err(error) = &result {
if !Self::should_finalize_poll_error(error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — Leaving telemetry open on a retryable poll error changes the telemetry outcome for an abandoned statement from error to success.

Before this PR, a caller that polled status() (or await_result()), received a retryable RPC error, and then gave up (dropped the handle without a successful retry) produced a terminal telemetry event carrying that error (finalize(Some(error))). After this change, the retryable branch returns early without finalizing, so the only finalize that runs is Drop's fallback self.statement_telemetry.finalize(None) — which emits a success event for a statement that never completed for this client.

This is consistent with the existing "submit-and-drop emits success" convention in Drop, so it may be acceptable, but it does mean a statement abandoned mid-poll due to transient failures is now reported as a successful async statement operation. Worth confirming that's the intended telemetry semantics — if not, the abandoned-after-retryable case would need to distinguish "never reached terminal" from "succeeded" at drop time.

This branch was previously deployed

1 inactive deployment
azure-prod — 3d232fea Deployed Aug 24, 2026 by oss-reviewer-bot[bot] via followup #987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant