Skip to content

fix(storage): propagate client options to the gRPC metrics exporter - #16708

Open
kalragauri wants to merge 2 commits into
googleapis:mainfrom
kalragauri:fix/otel-options
Open

kalragauri wants to merge 2 commits into
googleapis:mainfrom
kalragauri:fix/otel-options

Conversation

@kalragauri

Copy link
Copy Markdown
Contributor

MetricsExporterConnectionOptions() now forwards the Storage client's credential, CA certificates, and proxy options to the Cloud Monitoring connection, and DetectMetricsExportMode() enables metrics export only for compatible in-universe endpoints and credentials. Standard Storage gRPC clients using metadata-server credentials in the client's universe domain keep their existing Cloud Monitoring destination and host-attributed monitored resource labels, while other credentials use the configured project with default resource labels.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Nov 25, 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 the DetectMetricsExportMode mechanism to determine whether and how to export gRPC metrics to Cloud Monitoring based on the client's endpoint, credentials, and universe domain. It also propagates client connection options (such as credentials, CA certificates, and proxy configurations) to the exporter and adds comprehensive unit tests. The review feedback recommends avoiding auto when it obscures the Options return type in enable_metrics.cc and refactoring the IsHostName helper in metrics_exporter_options.cc to use simpler range-based loops instead of nested std::all_of with lambdas to prevent heap allocation and reduce complexity.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.71127% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.78%. Comparing base (6f1c3c3) to head (7c45ce0).

Files with missing lines Patch % Lines
...torage/internal/grpc/metrics_exporter_impl_test.cc 97.23% 12 Missing ⚠️
...ogle/cloud/storage/internal/grpc/enable_metrics.cc 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16708      +/-   ##
==========================================
- Coverage   92.78%   92.78%   -0.01%     
==========================================
  Files        2271     2271              
  Lines      227688   228244     +556     
==========================================
+ Hits       211255   211767     +512     
- Misses      16433    16477      +44     

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

@kalragauri
kalragauri marked this pull request as ready for review November 25, 2026 09:43
@kalragauri
kalragauri requested review from a team as code owners November 25, 2026 09:43

This branch has not been deployed

No deployments
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