Skip to content

feat(o11y): add record_polling_attributes macro - #5838

Merged
haphungw merged 4 commits into
googleapis:mainfrom
haphungw:feat-macro-record-polling-attributes
Jun 10, 2026
Merged

haphungw merged 4 commits into
googleapis:mainfrom
haphungw:feat-macro-record-polling-attributes

Conversation

@haphungw

@haphungw haphungw commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Introduce the record_polling_attributes! macro to google-cloud-lro to encapsulate the boilerplate required for injecting LRO telemetry attributes (e.g., poll attempt count) into the active span.

For googleapis/librarian#6275

@haphungw haphungw changed the title feat(o11y): add record_polling_attributes macro feat(o11y): add record_polling_attributes macro Jun 3, 2026
@haphungw
haphungw requested a review from westarle June 3, 2026 22:37

@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 a new macro, record_polling_attributes, to inject LRO-specific telemetry attributes into the active span. The review feedback points out that the macro evaluates the $span expression twice when the google_cloud_unstable_tracing feature is enabled, which could lead to side effects, and ignores it when disabled, potentially triggering unused variable warnings. A refactoring is suggested to bind $span to a local reference and handle the disabled case safely.

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

codecov Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.89%. Comparing base (1059b90) to head (f87dadb).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5838   +/-   ##
=======================================
  Coverage   97.89%   97.89%           
=======================================
  Files         226      226           
  Lines       57713    57713           
=======================================
+ Hits        56496    56497    +1     
+ Misses       1217     1216    -1     

☔ 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 marked this pull request as ready for review June 4, 2026 18:07
@haphungw
haphungw requested a review from a team as a code owner June 4, 2026 18:07
@haphungw
haphungw force-pushed the feat-macro-record-polling-attributes branch from 167c3e0 to c6c4d38 Compare June 4, 2026 20:06

@westarle westarle 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.

please fix the comments before submitting

Comment thread src/lro/src/internal/tracing.rs Resolved
Comment thread src/lro/src/internal/tracing.rs Outdated
async fn record_polling_attributes_macro() {
let guard = google_cloud_test_utils::test_layer::TestLayer::initialize();

let span = tracing::info_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.

is there a macro to create the span? It might help to make sure you've put the attribute names consistently to use that (or create it)

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.

good suggestion, i added one

Comment thread src/lro/src/internal/tracing.rs Resolved
Comment thread src/lro/src/internal/tracing.rs Resolved
Comment thread src/lro/src/internal/tracing.rs Resolved
Comment thread src/lro/src/internal/tracing.rs Resolved
@haphungw
haphungw force-pushed the feat-macro-record-polling-attributes branch from 668283d to e210d47 Compare June 10, 2026 15:43
@haphungw
haphungw force-pushed the feat-macro-record-polling-attributes branch from aca37f9 to a6c1347 Compare June 10, 2026 16:17
@haphungw
haphungw merged commit 817555e into googleapis:main Jun 10, 2026
37 checks passed
@haphungw
haphungw deleted the feat-macro-record-polling-attributes branch June 10, 2026 20:12
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