Skip to content

impl(storage): add retry counter support to AttemptMetrics - #16722

Open
cpriti-os wants to merge 3 commits into
googleapis:mainfrom
cpriti-os:impl-storage-attempt-retry-metrics
Open

cpriti-os wants to merge 3 commits into
googleapis:mainfrom
cpriti-os:impl-storage-attempt-retry-metrics

Conversation

@cpriti-os

@cpriti-os cpriti-os commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Extends storage_internal::AttemptMetrics with RetryLabels, RecordGrpcRetry(), and RecordHttpRetry() for the gcp.storage.client.retries (UInt64Counter, unit {retry}) OpenTelemetry counter.

Records client-initiated retries with the standard Storage base attributes (gcp.client.version, gcp.client.artifact, gcp.client.service, server.address) plus rpc.system.name, gcp.storage.operation, error.type, and network.path, propagating the explicit opentelemetry::context::Context and safely no-oping when the provider, meter, or instrument is null.

Also consolidates kAttemptsMetric, kErrorsMetric, and kRetriesMetric in metrics_constants.h.


Created by cpriti-o11y-agent

Extend `storage_internal::AttemptMetrics` with `RetryLabels` and
`RecordRetry()` for the `gcp.storage.client.retries` (`{retry}`)
OpenTelemetry counter.

[Generated-by: AI]
@cpriti-os
cpriti-os requested review from a team as code owners November 30, 2026 08:28
@cpriti-os
cpriti-os requested a review from kalragauri November 30, 2026 08:28
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Nov 30, 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 tracking client-initiated retry attempts in the Google Cloud Storage C++ SDK. It introduces a RetryLabels struct, adds a retries counter to AttemptMetrics, and implements the RecordRetry method to record retry attempts with relevant attributes (such as RPC system, operation, error type, and network path). It also refactors metric names into constants in metrics_constants.h and adds corresponding unit tests. There are no review comments to evaluate, and the changes conform to the repository's style guidelines.

@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.80%. Comparing base (fdcfe38) to head (6eae34f).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16722      +/-   ##
==========================================
+ Coverage   92.78%   92.80%   +0.02%     
==========================================
  Files        2279     2279              
  Lines      228396   228461      +65     
==========================================
+ Hits       211921   212033     +112     
+ Misses      16475    16428      -47     

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

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