Repository navigation
feat(storage): promote server.unreached to Standard tier with gRPC and HTTP heuristics - #15229
nidhiii-27 wants to merge 5 commits into
Conversation
…d HTTP heuristics
Promote gcp.storage.client.server.unreached to the Standard metrics tier
with unit "{request}" and record exact 8-key attributes across gRPC
(DirectPath/CloudPath heuristics) and HTTP (X-GUploader-UploadID /
X-Goog-Gfe-Service-Time markers and IOException handler).
[Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request promotes the gcp.storage.client.server.unreached metric from debug to standard tier, implementing tracking logic in both gRPC and HTTP interceptors along with comprehensive unit tests. The review feedback highlights critical bugs where successful requests lacking specific headers (common in local tests or emulators) are incorrectly classified as unreached, causing NullPointerException crashes due to passing null error types to OpenTelemetry's AttributesBuilder. Actionable suggestions are provided to safely handle successful requests and defensively default null error types to prevent runtime crashes.
…server-unreached-metric [Generated-by: AI]
…server-unreached-metric Resolve StorageHttpMetricsInterceptor conflicts by dropping the isRetry parameter from recordResponse (retries now come from the pending-retry hook) while keeping the per-response server.unreached evaluation, and drop the duplicated StorageClientMetricsTest recordServerUnreached exact-attribute test (covered end-to-end by the interceptor tests). [Generated-by: AI]
[Generated-by: AI]
…server-unreached-metric [Generated-by: AI]
| urlTemplate, | ||
| StorageErrorTypeMapper.STATUS_CONNECTION_ERROR); | ||
| StorageMetricsContext ctx = StorageMetricsContext.current(); | ||
| metrics.recordServerUnreached( |
There was a problem hiding this comment.
HttpIOExceptionHandler also fires on SocketTimeoutException read timeouts and hides DNS/TLS subtypes, so can we record server.unreached where the actual IOException is available instead of counting every IOException as CONNECTION_ERROR?
| Metadata trailerNonEmpty = new Metadata(); | ||
| trailerNonEmpty.put(Metadata.Key.of("x-custom-trailer", Metadata.ASCII_STRING_MARSHALLER), "v"); | ||
|
|
||
| // DirectPath & unknown: only pre-server errors with no headers/trailers/stats/OK are unreached. |
There was a problem hiding this comment.
Nit: This comment says unknown follows the DirectPath pre-server rule, but isServerUnreached routes NETWORK_PATH_UNKNOWN through the CloudPath branch, so could we align the comment (or branch) and add a non-pre-server case like bare UNAVAILABLE on Attributes.EMPTY?
Summary
Stacked on #15228.
Promotes
gcp.storage.client.server.unreachedto the Standard metrics tier with unit{request}and wires server-reachability heuristics across both gRPC and HTTP/JSON transports.Changes
StorageClientMetrics: movegcp.storage.client.server.unreachedinto the Standard tier (enableOtelMetrics), update unit to{request}, and addrecordServerUnreached(Context, String operationName, String networkPath, String errorType)emitting exact 8-key attributes (gcp.client.service,gcp.client.version,gcp.client.artifact,rpc.system.name,server.address,gcp.storage.operation,network.path,error.type).StorageGrpcMetricsInterceptor: detect unreached server failures on gRPC using DirectPath/CloudPath response header & trailer heuristics (receivedServerHeaders,x-guploader-uploadid, ambiguous client abort checks, pre-server error types).StorageHttpMetricsInterceptor: detect unreached server failures on HTTP usingX-GUploader-UploadID/X-Goog-Gfe-Service-Timeresponse markers andHttpIOExceptionHandlerconnection/transport failures.StorageClientMetricsTest,StorageGrpcMetricsInterceptorTest, andStorageHttpMetricsInterceptorTest.[Generated-by: AI]