Repository navigation
feat(storage): record gcp.storage.client.server.duration metric on gRPC - #15228
Open
nidhiii-27 wants to merge 5 commits into
Open
nidhiii-27 wants to merge 5 commits into
nidhiii-27 wants to merge 5 commits into
Conversation
…PC [Generated-by: AI]
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for tracking and recording server duration metrics within the gRPC client interceptor by decoding the grpc-server-stats-bin metadata trailer. It also includes comprehensive unit tests to validate the decoding logic and metric recording. The feedback suggests optimizing the decodeServerDurationSeconds method by manually decoding the little-endian byte array using bitwise operations instead of allocating a ByteBuffer on every gRPC call, which will reduce garbage collection pressure in this hot path.
…erver-duration-metric [Generated-by: AI]
cpriti-os
requested changes
Nov 26, 2026
…erver-duration-metric Resolve the StorageClientMetricsTest conflict by dropping the duplicated record*_recordsExact* tests (recordServerDuration's exact 7-key coverage lives in StorageGrpcMetricsInterceptorTest). [Generated-by: AI]
- decodeServerDurationSeconds accepts payloads of at least 10 bytes, still requiring the version/field-id header and reading the LE nanos at offset 2. - Cover a 0ns trailer and a non-OK status in the server.duration test, assert its unit, and reuse createDebugInterceptor() in the request.active tests. [Generated-by: AI]
…e duplicated test [Generated-by: AI]
cpriti-os
approved these changes
Nov 27, 2026
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 #15227.
Adds Debug-tier
gcp.storage.client.server.duration(DoubleHistogram, units) on gRPC calls by decoding thegrpc-server-stats-binresponse trailer.Changes
StorageClientMetrics: addrecordServerDuration(Context, double durationSeconds, String operationName, String networkPath)emitting exact 7-key attributes (gcp.client.service,gcp.client.version,gcp.client.artifact,rpc.system.name,server.address,gcp.storage.operation,network.path).StorageGrpcMetricsInterceptor: decodegrpc-server-stats-binpayloads of at least 10 bytes (headerbytes[0] == 0 && bytes[1] == 0, little-endian 8-byte nanosecond int64 at offset 2, negative values rejected, trailing fields ignored) and recordserver.durationononClose, regardless of status. Intentionally gRPC-only.StorageGrpcMetricsInterceptorTestcovering valid, 0ns, trailing-field, short, wrong-prefix, negative, and missing trailers, plus non-OK status.[Generated-by: AI]