Skip to content

feat(o11y): propagate LRO destination ID to child spans#5871

Closed
haphungw wants to merge 2 commits into
googleapis:mainfrom
haphungw:feat-lro-propagate-resource-id
Closed

feat(o11y): propagate LRO destination ID to child spans#5871
haphungw wants to merge 2 commits into
googleapis:mainfrom
haphungw:feat-lro-propagate-resource-id

Conversation

@haphungw

Copy link
Copy Markdown
Contributor

Introduce stateful propagation of the LRO destination ID (resource ID/operation name) across LRO polling attempts inside google-cloud-lro.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces tracking and recording of the destination ID for long-running operations (LRO) within LroRecorder by adding a thread-safe destination_id field, implementing helper methods, updating the polling attributes macro, and adding corresponding tests. The review feedback recommends simplifying the implementation by replacing std::sync::RwLock with std::sync::Mutex for the destination_id field, which aligns with the repository's style guide to avoid unnecessary complexity.

Comment thread src/lro/src/internal/tracing.rs Outdated
Comment thread src/lro/src/internal/tracing.rs Outdated
Comment thread src/lro/src/internal/tracing.rs Outdated
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.89%. Comparing base (094bf6d) to head (b40da83).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5871   +/-   ##
=======================================
  Coverage   97.89%   97.89%           
=======================================
  Files         227      227           
  Lines       57995    57995           
=======================================
  Hits        56774    56774           
  Misses       1221     1221           

☔ 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 feat-lro-propagate-resource-id branch from 0eb02c1 to c9a339a Compare June 10, 2026 21:58
@haphungw haphungw marked this pull request as ready for review June 10, 2026 22:00
@haphungw haphungw requested a review from a team as a code owner June 10, 2026 22:00
Comment thread src/lro/src/internal/tracing.rs Outdated
Comment on lines 23 to 28

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.

I'm not sure its as immutable anymore as it mutates the destination ID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed the comment.

As for the immutability, when I was planning this in the first place, I forgot that the destination ID is only available after the first response comes back. Only then can we propagate it to the clones of the recorder. So it can't be strictly immutable anymore, but the ID is only set once.

Comment thread src/lro/src/internal/tracing.rs Outdated
pub struct LroRecorder {
span: Span,
attempt_count: Option<u32>,
destination_id: std::sync::Arc<std::sync::Mutex<Option<String>>>,

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 this be a oncelock to simplify reads (I feel like we did this somewhere before?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you're right, fixed!

@haphungw haphungw force-pushed the feat-lro-propagate-resource-id branch from c9a339a to b40da83 Compare June 11, 2026 19:17
@haphungw

Copy link
Copy Markdown
Contributor Author

Closing this PR in favor of #5819. I have force-pushed the latest updates (including the rename to destination_id and the Discovery LRO macro fixes) directly to the branch on #5819 to preserve the existing approvals and review history. Apologies for the confusion and duplication."

@haphungw haphungw closed this Jun 11, 2026
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