Skip to content

test(o11y): add Discovery LRO tracing error integration tests#5892

Draft
haphungw wants to merge 5 commits into
googleapis:mainfrom
haphungw:fix-lro-tracing-discovery-errors
Draft

test(o11y): add Discovery LRO tracing error integration tests#5892
haphungw wants to merge 5 commits into
googleapis:mainfrom
haphungw:fix-lro-tracing-discovery-errors

Conversation

@haphungw

Copy link
Copy Markdown
Contributor

Add tracing integration tests for Discovery LRO error paths.

Stacked on top of #5891

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces integration tests for Long-Running Operation (LRO) tracing under tests/o11y, covering both Showcase (GAPIC) and Discovery-based client pollers across success, logical error, transient error, and permanent error scenarios. Feedback on the changes includes removing redundant inner #[cfg(google_cloud_unstable_tracing)] attributes since the entire file is already gated with that configuration, and addressing a discrepancy where the LRO Wait span status remains UNSET instead of ERROR during logical errors in Discovery LROs.

Comment thread tests/o11y/src/lro_tracing.rs Outdated
Comment on lines +502 to +503
#[cfg(google_cloud_unstable_tracing)]
google_cloud_lro::record_polling_attributes!(&span);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The inner #[cfg(google_cloud_unstable_tracing)] attribute is redundant because the entire file is already gated with #![cfg(google_cloud_unstable_tracing)] at the top (line 15). Removing these inner attributes simplifies the code.

This also applies to lines 607, 706, 719, and 820.

Suggested change
#[cfg(google_cloud_unstable_tracing)]
google_cloud_lro::record_polling_attributes!(&span);
google_cloud_lro::record_polling_attributes!(&span);

Comment thread tests/o11y/src/lro_tracing.rs
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.90%. Comparing base (d059878) to head (0d587a2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5892   +/-   ##
=======================================
  Coverage   97.89%   97.90%           
=======================================
  Files         233      233           
  Lines       59202    59202           
=======================================
+ Hits        57958    57961    +3     
+ Misses       1244     1241    -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haphungw haphungw force-pushed the fix-lro-tracing-discovery-errors branch 2 times, most recently from bc2a064 to 89f0be9 Compare June 16, 2026 19:05
_ => None,
};
if let Some((recorder, status)) = op_details {
recorder.span().record("otel.status_code", "ERROR");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a constant anywhere for "ERROR" or "otel.status_code"?

Comment thread tests/o11y/src/lro_tracing.rs Outdated

let query = move |name: String| async move {
let span = tracing::info_span!(
"client_request",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we call the actual client_request macro here?

Comment thread tests/o11y/src/lro_tracing.rs Outdated

let spans = TestLayer::capture(guard);

// 1. T2 span "LRO Wait" should be UNSET/None (because until_done returns Ok)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// 1. T2 span "LRO Wait" should be UNSET/None (because until_done returns Ok)
// 1. T2 span "LRO Wait" should be ERROR because the operation failed.

haphungw added 2 commits June 16, 2026 22:23
Add error.type attribute to the LRO Wait span and populate it from the status code if the long-running operation fails with a status code. This allows observability tools to track error rates by error type for long-running operations.
@haphungw haphungw force-pushed the fix-lro-tracing-discovery-errors branch from 89f0be9 to 9981700 Compare June 16, 2026 22:25
@haphungw haphungw force-pushed the fix-lro-tracing-discovery-errors branch from 9981700 to 0d587a2 Compare June 16, 2026 22:43
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.

2 participants