Skip to content

feat(storage): add resource span attributes for ACO ( App Centric Observability ) for async client#16151

Draft
bajajneha27 wants to merge 21 commits into
googleapis:mainfrom
bajajneha27:509338299-async
Draft

feat(storage): add resource span attributes for ACO ( App Centric Observability ) for async client#16151
bajajneha27 wants to merge 21 commits into
googleapis:mainfrom
bajajneha27:509338299-async

Conversation

@bajajneha27

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 Jun 10, 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 introduces a BucketMetadataCache to cache bucket metadata (ID and location) and uses it to enrich OpenTelemetry spans with destination resource attributes in both TracingConnection and AsyncConnectionTracing. When metadata is not cached, a background fetch is triggered. The review feedback highlights several important issues: a critical data race on bg_tasks_ in TracingConnection::MaybeTriggerBackgroundFetch due to a lack of mutex protection during push_back, potential undefined behavior in BucketMetadataCache::Put if max_size is initialized to 0, unnormalized bucket names on permission denied errors in TracingConnection, and performance concerns regarding the expensive creation of a new StorageConnection on every background fetch in AsyncConnectionTracing.

Comment thread google/cloud/storage/internal/tracing_connection.cc Outdated
Comment on lines +81 to +83
} else if (result.status().code() == StatusCode::kPermissionDenied) {
cache().Put(bucket_name, {"projects/_/buckets/" + bucket_name, "global"});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To be consistent with AsyncConnectionTracing and to handle any potentially unnormalized bucket names safely, normalize the bucket_name before constructing the fallback resource ID on kPermissionDenied errors.

    } else if (result.status().code() == StatusCode::kPermissionDenied) {
      auto const normalized = BucketMetadataCache::NormalizeBucketName(bucket_name);
      cache().Put(bucket_name, {"projects/_/buckets/" + normalized, "global"});
    }

Comment thread google/cloud/storage/internal/bucket_metadata_cache.h
Comment thread google/cloud/storage/internal/async/connection_tracing.cc Outdated
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.01722% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.29%. Comparing base (6fd3745) to head (4244a97).

Files with missing lines Patch % Lines
.../cloud/storage/internal/tracing_connection_test.cc 95.73% 9 Missing ⚠️
...cloud/storage/internal/async/connection_tracing.cc 93.80% 7 Missing ⚠️
...gle/cloud/storage/internal/storage_tracing_stub.cc 0.00% 7 Missing ⚠️
google/cloud/storage/grpc_plugin.cc 57.14% 3 Missing ⚠️
.../storage/internal/storage_round_robin_decorator.cc 0.00% 3 Missing ⚠️
google/cloud/storage/async/idempotency_policy.cc 50.00% 2 Missing ⚠️
...le/cloud/storage/internal/bucket_metadata_cache.cc 96.87% 2 Missing ⚠️
...oogle/cloud/storage/internal/tracing_connection.cc 99.10% 2 Missing ⚠️
google/cloud/storage/async/client_test.cc 98.14% 1 Missing ⚠️
google/cloud/storage/internal/grpc/stub.h 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16151      +/-   ##
==========================================
+ Coverage   92.27%   92.29%   +0.01%     
==========================================
  Files        2214     2217       +3     
  Lines      206537   207397     +860     
==========================================
+ Hits       190589   191408     +819     
- Misses      15948    15989      +41     

☔ 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 June 11, 2026 05:04
@bajajneha27
bajajneha27 requested review from a team as code owners June 11, 2026 05:04
@v-pratap
v-pratap self-requested a review June 11, 2026 05:20
@bajajneha27
bajajneha27 marked this pull request as draft July 16, 2026 14:24
@bajajneha27
bajajneha27 force-pushed the 509338299-async branch 2 times, most recently from 6b19ba0 to bdd8085 Compare July 17, 2026 02:46
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.

1 participant