Skip to content

feat(storage): record HTTP ReadObject stall.duration on SocketTimeoutException - #15232

Open
nidhiii-27 wants to merge 10 commits into
feat/storage-grpc-stall-duration-metricfrom
feat/storage-http-stall-duration-metric
Open

nidhiii-27 wants to merge 10 commits into
feat/storage-grpc-stall-duration-metricfrom
feat/storage-http-stall-duration-metric

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

Summary

Stacked on #15231.

Adds HTTP/JSON ReadObject stall detection for Debug-tier gcp.storage.client.stall.duration (DoubleHistogram, unit s) on SocketTimeoutException failures across both initial open attempts and mid-stream socket reads.

Changes

  • StorageErrorTypeMapper: add cycle-safe, depth-bounded hasSocketTimeoutCause(Throwable) helper.
  • StorageMetricsContext: track lastActivityNanos, add markActivity(), and add recordHttpReadStallIfTimeout(Throwable) emitting gcp.storage.client.stall.duration with exact 8-key attributes (gcp.storage.operation = "ReadObject", rpc.method = "google.storage.v2.Storage/ReadObject", network.path = "cloudpath") exclusively for HTTP ReadObject SocketTimeoutException failures.
  • ApiaryUnbufferedReadableByteChannel: call markMetricsActivity() immediately before sbc.read(...) (so inter-read application processing time does not inflate stall duration) and invoke recordHttpReadStall(t) in catch.
  • Unit tests in StorageErrorTypeMapperTest, StorageMetricsContextTest, and ApiaryUnbufferedReadableByteChannelTest.

[Generated-by: AI]

…Exception

Record Debug-tier gcp.storage.client.stall.duration (unit "s", exact
8-key attributes with rpc.method=google.storage.v2.Storage/ReadObject
and network.path=cloudpath) on HTTP ReadObject SocketTimeoutException
failures across initial open attempts and mid-stream socket reads while
excluding non-timeout errors, non-ReadObject operations, and inter-read
application processing time.

[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 tracking and recording of HTTP read stall durations during ReadObject operations when a socket timeout occurs. It adds activity tracking to StorageMetricsContext and ApiaryUnbufferedReadableByteChannel to measure the time elapsed since the last progress. Feedback on the changes suggests addressing a potential double-recording of the stall duration during a terminal failure to open a stream by ensuring mid-stream stalls are only recorded when the channel is not null.

…age-http-stall-duration-metric [Generated-by: AI]
…age-http-stall-duration-metric

[Generated-by: AI]
…age-http-stall-duration-metric

[Generated-by: AI]
…age-http-stall-duration-metric

[Generated-by: AI]
recordAttemptFailure(String, long) passes no Throwable for google-http-client internal retries.

[Generated-by: AI]
@nidhiii-27
nidhiii-27 marked this pull request as ready for review November 26, 2026 06:05
@nidhiii-27
nidhiii-27 requested review from a team as code owners November 26, 2026 06:05
@nidhiii-27
nidhiii-27 requested review from Dhriti07 and cpriti-os and removed request for a team November 26, 2026 06:05

@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

…est for Java 8 compatibility

Replace Mockito.mock(StreamController.class) with TestUtils.nullStreamController()
in stubMidStreamReadFailure to avoid ByteBuddy JDK 8 failures when copying JSpecify
@NullMarked annotations from StreamController.

[Generated-by: AI]
- Track streaming write activity in StorageImpl.downloadTo and HttpStorageRpc.load/read
- Read lastActivityNanos before clock.nanoTime() and clamp elapsedNanos >= 0
- Early-return in markActivity() when stall metrics disabled and reuse in incrementAttempts()
- Reuse retryIf in ApiaryUnbufferedReadableByteChannelTest and fakeClock in StorageMetricsContextTest
- Add unit tests for downloadTo/readAllBytes mid-stream SocketTimeoutException and clock skew clamping
Merge commit cdca421 from feat/storage-grpc-veneer-operation-metrics
to replace Mockito.mock(StreamController.class) with
TestUtils.nullStreamController() in GrpcStorageImplTest, resolving
split-units (java-storage, 8) failures caused by JSpecify @NullMarked on
StreamController under JDK 8.

[Generated-by: AI]

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