Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

fix: Refine connectivity metric for RPCs that receive no response and sent to Transport layer - #4220

Closed
surbhigarg92 wants to merge 1 commit into
mainfrom
connectivity_metrics
Closed

fix: Refine connectivity metric for RPCs that receive no response and sent to Transport layer #4220
surbhigarg92 wants to merge 1 commit into
mainfrom
connectivity_metrics

Conversation

@surbhigarg92

@surbhigarg92 surbhigarg92 commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

This PR enhances the connectivity error metrics in the Java Spanner client library to provide a more accurate and comprehensive tracking of network-related issues.

Description:
The current connectivity error metric is only incremented in the rare event that a response header is received from the server but lacks GFE/AFE server timing latency. This limitation means that more common and critical connectivity problems are not captured, such as:

  1. Network issues that prevent requests from being sent to the server.
  2. Requests that are sent but for which no response is ever received or cancelled from Client.

To address this gap, this change updates the logic to also capture RPCs that have been passed to the gRPC transport layer but for which no response is received. This will result in a more accurate and reliable connectivity error metric.

Note Client-side timeouts that occur before an RPC is sent to the transport layer are explicitly excluded from this metric.

@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/java-spanner API. labels Nov 14, 2025
@surbhigarg92
surbhigarg92 marked this pull request as ready for review November 27, 2025 08:24
@surbhigarg92
surbhigarg92 requested review from a team November 27, 2025 08:24
@sakthivelmanii

Copy link
Copy Markdown
Collaborator

@surbhigarg92 nit: Can you please update the PR title? it should reflect little more on what are you trying to fix since it comes in the release tag

@surbhigarg92 surbhigarg92 changed the title fix: Connectivity Error Metrics fix: Refine connectivity metric for RPCs that receive no response and sent to Transport layer Nov 27, 2025
@surbhigarg92

Copy link
Copy Markdown
Contributor Author

@surbhigarg92 nit: Can you please update the PR title? it should reflect little more on what are you trying to fix since it comes in the release tag

Done

*/
package com.google.cloud.spanner;

import io.grpc.ClientStreamTracer;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an experimental API right? Until tracer is launched, we can't use it right? https://github.com/grpc/grpc-java/blob/master/api/src/main/java/io/grpc/ClientStreamTracer.java#L27

return new SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) {
final AtomicBoolean headersReceived = new AtomicBoolean(false);
SpannerGrpcStreamTracer streamTracer = new SpannerGrpcStreamTracer();
CallOptions newOptions =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does customer have access to CallOptions? If yes, We need to make sure we are not overriding withStreamTracerFactory which is set by the customer

@surbhigarg92

Copy link
Copy Markdown
Contributor Author

Closing this PR as we can't use Experimental API

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/java-spanner API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants