Skip to content

feat(storage): add resource span attributes for ACO ( App Centric Observability ) for rewrite API in async client - #16285

Open
bajajneha27 wants to merge 2 commits into
googleapis:mainfrom
bajajneha27:509338299-async-rewrite
Open

feat(storage): add resource span attributes for ACO ( App Centric Observability ) for rewrite API in async client#16285
bajajneha27 wants to merge 2 commits into
googleapis:mainfrom
bajajneha27:509338299-async-rewrite

Conversation

@bajajneha27

@bajajneha27 bajajneha27 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 29, 2026

@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 adds support for span enrichment in RewriteObject within the asynchronous connection tracing implementation. It introduces an overload of MakeTracingAsyncRewriterConnection that accepts an OpenTelemetry span, allowing the span to be created and enriched with destination bucket details before being passed to the tracing connection. A unit test has been added to verify that the span is correctly enriched using cached bucket metadata. I have no feedback to provide as the changes are well-implemented and include appropriate test coverage.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.31%. Comparing base (d799c3f) to head (73a7ed6).

Files with missing lines Patch % Lines
.../storage/internal/async/connection_tracing_test.cc 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16285      +/-   ##
==========================================
- Coverage   92.31%   92.31%   -0.01%     
==========================================
  Files        2223     2223              
  Lines      208086   208121      +35     
==========================================
+ Hits       192086   192117      +31     
- Misses      16000    16004       +4     

☔ 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.

@bajajneha27
bajajneha27 marked this pull request as ready for review July 29, 2026 10:55
@bajajneha27
bajajneha27 requested review from a team as code owners July 29, 2026 10:55
@bajajneha27

Copy link
Copy Markdown
Contributor Author

/gcbrun

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

There is a limitation in our overall ACO caching design. Because we call EnrichSpan() immediately at span creation across the async client, a background cache miss results in the span never being enriched. For long-running operations, the cache populates milliseconds later, but the span stays unenriched. In the Java SDK, they avoid this by wrapping spans in an AcoSpan decorator that lazily pulls from the cache right at span.end(). Let's track this as a separate issue.

auto r = f.get();
internal::DetachOTelContext(oc);
if (!r) {
span->AddEvent("gl-cpp.storage.rewrite.iterate",

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.

There is a pre-existing issue here that we should probably track as a follow-up.

Currently, in AsyncRewriterTracingConnection::Iterate() (and similarly for .Write() and .Read() in the async client), we call span->AddEvent(...) for every single loop iteration.

The risk here is that OpenTelemetry SDKs enforce a limit on the number of events per span. For large object rewrites, .Iterate() can execute hundreds or thousands of times. Once we exceed the limit, OTel silently drops the rest, affecting observability for the tail end of any large data transfer.

Other Storage SDKs have managed to avoid this issue, so let's chat about how C++ can also avoid it.

@bajajneha27
bajajneha27 force-pushed the 509338299-async-rewrite branch from ae615ff to 73a7ed6 Compare July 30, 2026 05:59

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

nit: pls fix the PR title + description.

@bajajneha27

Copy link
Copy Markdown
Contributor Author

There is a limitation in our overall ACO caching design. Because we call EnrichSpan() immediately at span creation across the async client, a background cache miss results in the span never being enriched. For long-running operations, the cache populates milliseconds later, but the span stays unenriched. In the Java SDK, they avoid this by wrapping spans in an AcoSpan decorator that lazily pulls from the cache right at span.end(). Let's track this as a separate issue.

Ack! I've created issues to fix both the concerns.

@bajajneha27 bajajneha27 changed the title feat(storage): add resource span attributes for ACO ( App Centric Obs… feat(storage): add resource span attributes for ACO ( App Centric Observability ) for rewrite API in async client Jul 30, 2026
@bajajneha27
bajajneha27 enabled auto-merge (squash) July 30, 2026 08:43
@bajajneha27

Copy link
Copy Markdown
Contributor Author

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants