Skip to content

Conversation

@surbhigarg92
Copy link
Contributor

No description provided.

@surbhigarg92 surbhigarg92 requested review from a team as code owners December 5, 2025 07:49
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner API. labels Dec 5, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @surbhigarg92, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the connectivity metrics collection within the Spanner client library to more accurately capture the state of RPCs, particularly those that might not provide complete server-timing header information. By centralizing the metric recording to the end of the RPC lifecycle and explicitly counting instances where GFE or AFE latency headers are absent, the changes ensure a more comprehensive understanding of network performance and potential issues. This enhancement provides better visibility into RPCs that previously might have been overlooked in metric reporting.

Highlights

  • Refactored Metric Recording Logic: The process of recording server-timing header metrics (GFE and AFE latencies) has been moved from the onHeaders event to the onClose event of the gRPC call. This ensures that metrics are processed after the entire RPC lifecycle, including potential errors or missing headers.
  • Explicitly Capture Missing Headers: The system now explicitly records a 'missing header' count for GFE and AFE latencies when the corresponding latency values are not present in the server-timing header. This addresses the original problem of not capturing RPCs with no response headers.
  • Streamlined Metric API: The BuiltInMetricsTracer and CompositeTracer classes have been updated to use a single, consolidated recordServerTimingHeaderMetrics method, simplifying the interface for recording GFE and AFE latencies along with direct path and AFE enabled flags.
  • Improved Test Coverage: New assertions have been added to the unit tests to verify that GFE_CONNECTIVITY_ERROR_NAME and AFE_CONNECTIVITY_ERROR_NAME metrics are correctly recorded when server-timing headers are missing or when there's no network connection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

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 refactors the connectivity metrics recording to correctly capture RPCs that fail before receiving a response header. The logic is moved from onHeaders to onClose, which is a significant correctness improvement. The changes also simplify the tracer classes by consolidating metric recording methods.

My review includes a few suggestions to improve code style and maintainability, such as using specific imports, adjusting variable scope, and adhering to naming conventions. Overall, this is a solid improvement.

@surbhigarg92 surbhigarg92 force-pushed the connectivity_metrics_fix_1 branch from 738a23f to 7d50f13 Compare December 5, 2025 08:05
@surbhigarg92 surbhigarg92 force-pushed the connectivity_metrics_fix_1 branch from cdf3d66 to b474d3b Compare December 5, 2025 10:05
@surbhigarg92 surbhigarg92 merged commit 7b49412 into main Dec 9, 2025
41 of 42 checks passed
@surbhigarg92 surbhigarg92 deleted the connectivity_metrics_fix_1 branch December 9, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants