Skip to content

feat(storage): record gcp.storage.client.retries counter in Retrying - #15225

Open
nidhiii-27 wants to merge 2 commits into
feat/storage-http-ttfb-unary-uploadfrom
feat/storage-retries-metric-core
Open

nidhiii-27 wants to merge 2 commits into
feat/storage-http-ttfb-unary-uploadfrom
feat/storage-retries-metric-core

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #15066.

Adds the Standard-tier gcp.storage.client.retries OpenTelemetry counter (unit {attempt}) and records retries executed by Retrying.DefaultRetrier.run(...) across both HTTP/JSON and gRPC operations.

Changes

  • StorageClientMetrics: add Standard-tier gcp.storage.client.retries LongCounter (unit {attempt}, description "Number of GCS client retry attempts") and recordRetry(Context, String operationName, String networkPath, String errorType) emitting the 8 standard retry attributes (gcp.client.service, gcp.client.version, gcp.client.artifact, rpc.system.name, server.address, gcp.storage.operation, network.path, error.type).
  • OpenTelemetryBootstrappingUtils: register gcp.storage.client.retries in CLIENT_COUNTERS.
  • StorageMetricsContext: add recordRetry(StorageClientMetrics, Throwable) using the active operation, resolved network.path, and the failed attempt's mapped error.type.
  • Retrying.DefaultRetrier: whenever the retry algorithm schedules another attempt, record a retry with the failed attempt's error.type (shared handleAttemptError helper; StorageException | IllegalArgumentException multi-catch).
  • Unit tests in StorageClientMetricsTest and RetryingMetricsTest (end-to-end exact-attribute coverage via StorageOptions.grpc()).

[Generated-by: AI]

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new metric, gcp.storage.client.retries, to track the number of GCS client attempts that retried an earlier failed attempt of the same request. It refactors the exception handling in Retrying.java to use a helper method handleAttemptError which records both attempt failures and retries. Additionally, corresponding updates were made to StorageClientMetrics and StorageMetricsContext to support this new metric, and comprehensive unit tests were added to verify its behavior and attributes. I have no feedback to provide as there are no review comments to evaluate.

@nidhiii-27
nidhiii-27 marked this pull request as ready for review November 25, 2026 10:24
@nidhiii-27
nidhiii-27 requested review from a team as code owners November 25, 2026 10:24

@cpriti-os cpriti-os 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.

Initial review

- Combine the StorageException and IllegalArgumentException catches in Retrying.
- Shorten the retries counter description.
- Drop StorageClientMetricsTest.recordRetry_recordsExactAttributes; the end-to-end
  RetryingMetricsTest covers the exact attribute set.

[Generated-by: AI]
@nidhiii-27
nidhiii-27 requested a review from cpriti-os November 26, 2026 06:04

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

ai-generated Pull Request generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants