Skip to content

Conversation

@shubham-up-47
Copy link
Contributor

@shubham-up-47 shubham-up-47 commented Oct 15, 2025

This PR adds a new configuration option GrpcMetricsExportTimeoutOption to allow users to control metrics export timing for the Google Cloud Storage C++ gRPC client. This is particularly important for short-lived programs where metrics were previously lost due to fixed, long export timeouts.

Example usage:

auto client = google::cloud::storage::MakeGrpcClient(
    google::cloud::Options{}
        .set<storage_experimental::EnableGrpcMetricsOption>(true)
        .set<storage_experimental::GrpcMetricsPeriodOption>(
            std::chrono::seconds(5))                                 // Fast export
        .set<storage_experimental::GrpcMetricsExportTimeoutOption>(
            std::chrono::seconds(2)));                               // Quick timeout

@shubham-up-47 shubham-up-47 requested review from a team as code owners October 15, 2025 16:07
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Oct 15, 2025
@shubham-up-47 shubham-up-47 marked this pull request as draft October 15, 2025 16:07
@gemini-code-assist
Copy link

Summary of Changes

Hello @shubham-up-47, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Google Cloud Storage C++ gRPC client by introducing a new configuration option, GrpcMetricsExportTimeoutOption. This option empowers users to define a custom timeout for exporting telemetry metrics, which is particularly beneficial for short-lived applications. By allowing a shorter export timeout, the change ensures that metrics are reliably flushed and captured before the program exits, thereby preventing data loss that could occur with the previously fixed, longer default timeout.

Highlights

  • Configurable Metrics Export Timeout: Introduced a new configuration option, GrpcMetricsExportTimeoutOption, for the Google Cloud Storage C++ gRPC client.
  • Addresses Short-Lived Programs: Allows users to set a custom, shorter timeout for metrics export, which is crucial for short-lived applications to ensure metrics are flushed before program termination.
  • Improved Metrics Reliability: Enhances the reliability of telemetry data collection by preventing metrics loss that could occur with a fixed, longer default timeout.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

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 configurable timeout for gRPC metrics export, which is a valuable addition for short-lived programs. The implementation is mostly correct, but I've found a critical issue where the default timeout is not being set, which would lead to a crash. I've also noted a discrepancy in the default timeout value between the documentation and the code, and I've suggested aligning them to a more sensible value for the intended use case. Finally, I've proposed a small improvement to the example code for better readability.

@shubham-up-47 shubham-up-47 marked this pull request as ready for review October 16, 2025 07:15
@shubham-up-47 shubham-up-47 changed the title fix(storage): add configurable metrics export timeout for GCS gRPC Client feat(storage): add configurable metrics export timeout for GCS gRPC Client Oct 16, 2025
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.11%. Comparing base (60befd1) to head (8fb9752).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...oud/storage/internal/grpc/metrics_exporter_impl.cc 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15629   +/-   ##
=======================================
  Coverage   93.11%   93.11%           
=======================================
  Files        2418     2418           
  Lines      222664   222702   +38     
=======================================
+ Hits       207323   207366   +43     
+ Misses      15341    15336    -5     

☔ View full report in Codecov by Sentry.
📢 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.

@shubham-up-47 shubham-up-47 merged commit 250231e into googleapis:main Oct 17, 2025
65 of 71 checks passed
@shubham-up-47 shubham-up-47 deleted the configure_metrics_export_timeout branch October 17, 2025 14:40
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.

4 participants