Repository navigation
feat(storage): record gRPC stall.duration and Watchdog TIMEOUT classification - #15231
Open
nidhiii-27 wants to merge 9 commits into
Open
nidhiii-27 wants to merge 9 commits into
nidhiii-27 wants to merge 9 commits into
Conversation
…fication Add Debug-tier gcp.storage.client.stall.duration (unit "s", exact 8-key attributes) and a zero-race Watchdog timeout callback scope between StorageGrpcMetricsInterceptor and GapicUnbufferedReadableByteChannel so GAX Watchdog aborts synchronously tag rpc.client.call.duration with error.type=TIMEOUT, record stall duration since the last received message, and avoid false server.unreached counts. [Generated-by: AI]
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces watchdog timeout tracking and stall duration metrics for Google Cloud Storage. It updates the gRPC metrics interceptor to track the last activity time and record stall duration metrics when a watchdog timeout occurs, supported by new thread-local scope management in StorageMetricsContext. The review feedback highlights two concurrency-related improvements in StorageGrpcMetricsInterceptor.java: declaring lastActivityNanos as volatile to ensure proper memory visibility across threads, and replacing a raw boolean[] array with AtomicBoolean to guarantee thread-safe execution of the onClose metrics recording.
…stall-duration-metric [Generated-by: AI]
…stall-duration-metric Keep the shared releaseActive() exactly-once request.active decrement in the restructured recordOnCloseMetrics finally block. [Generated-by: AI]
interceptCall_watchdogTimeout_recordsStallDurationAndTimeoutErrorType already asserts the exact attribute set, unit, and debug-tier gating end to end. [Generated-by: AI]
…stall-duration-metric [Generated-by: AI]
…stall-duration-metric [Generated-by: AI]
nidhiii-27
marked this pull request as ready for review
November 26, 2026 06:05
nidhiii-27
requested review from
Dhriti07 and
cpriti-os
and removed request for
a team
November 26, 2026 06:05
cpriti-os
requested changes
Nov 26, 2026
…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]
…review feedback - Merge origin-auth/feat/storage-network-io-metric (062ea02) - Update lastActivityNanos in finally after super.onMessage(message) and clamp stallSeconds >= 0 - Split watchdog test into 4 focused @test methods including watchdog-before-first-onMessage - Add non-watchdog CancellationException test inside enterWatchdogScope
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #15230.
Adds Debug-tier
gcp.storage.client.stall.duration(DoubleHistogram, units) on gRPC streaming reads and introduces a zero-race GAXWatchdogtimeout feedback hook betweenStorageGrpcMetricsInterceptorandGapicUnbufferedReadableByteChannel, resolving #14743#discussion_r4596591825.Changes
StorageClientMetrics: addrecordStallDuration(Context, double durationSeconds, String operationName, String rpcMethod, String networkPath)emitting exact 8-key attributes (gcp.client.service,gcp.client.version,gcp.client.artifact,rpc.system.name,server.address,gcp.storage.operation,rpc.method,network.path).StorageMetricsContext: addenterWatchdogScope(Runnable)andnotifyWatchdogTimeout()thread-local callback scope soWatchdogTimeoutExceptionsignals synchronously before the reader thread unblocks.GapicUnbufferedReadableByteChannel.ReadObjectObserver.onErrorImpl: invokeStorageMetricsContext.notifyWatchdogTimeout()synchronously whent instanceof WatchdogTimeoutExceptionbefore completingopenor enqueueingt.StorageGrpcMetricsInterceptor: tracklastActivityNanoson the listener and, whenonClosereceivesStatus.Code.CANCELLED, wrapsuper.onCloseinStorageMetricsContext.enterWatchdogScope(...)so real GAX Watchdog aborts synchronously tagrpc.client.call.durationwitherror.type = "TIMEOUT", recordstall.durationsince the last received message, and prevent falseserver.unreachedincrements (non-cancelled closes continue recording beforesuper.onClose).StorageClientMetricsTest,StorageMetricsContextTest,GapicUnbufferedReadableByteChannelTest, andStorageGrpcMetricsInterceptorTest(including real GAXWatchdog.createDuration(...)tests).[Generated-by: AI]