Skip to content

[router][grpc] Move all error logs to their call sites#12859

Merged
CatherineSue merged 11 commits intomainfrom
chang/error-msg
Nov 7, 2025
Merged

[router][grpc] Move all error logs to their call sites#12859
CatherineSue merged 11 commits intomainfrom
chang/error-msg

Conversation

@CatherineSue
Copy link
Collaborator

@CatherineSue CatherineSue commented Nov 7, 2025

Motivation

Currently, error.rs logs error or warn logs for errors. It is hard to trace back the call's original call sites in this way.

Since rust doesn't support log_exception. This PR moves all the logs to error's call site. This way it is easier to tell where the error comes from.

Modifications

  • Remove log in all functions in error.rs
  • Add log for all call sites of error::

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CatherineSue, 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 significantly refactors the error logging strategy within the GRPC router by decentralizing error log statements. The primary goal is to enhance the debuggability of the system by ensuring that error messages are emitted directly at their point of origin, enriched with relevant contextual data. This change moves away from generic error logging in a dedicated error handling module towards more precise, location-aware logging, which will streamline the identification and resolution of runtime errors.

Highlights

  • Improved Error Traceability: Error log statements have been moved from a centralized error.rs module to their specific call sites across various GRPC router stages and utility functions. This change ensures that error messages are logged with more contextual information, such as the function name and specific error details, making it significantly easier to trace the origin of issues.
  • Refactored Error Handling: The error.rs file has been cleaned up by removing direct error! and warn! macro calls. Instead, these calls are now strategically placed where errors are generated or handled, often including structured fields like function and error for enhanced debugging.
  • Enhanced Debugging Information: New error! macros have been introduced at critical failure points, such as connection failures, missing pipeline stage outputs (e.g., preparation, client acquisition, dispatch metadata), unsupported request types, parsing failures, and worker execution issues. This provides immediate, detailed insights into where and why an operation failed.
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
Contributor

@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 error logging to move it from the central error.rs module to the specific call sites. This is a valuable change for improving the traceability and debuggability of errors. The implementation is consistent across the codebase. I've identified several minor issues where incorrect function names are used in the new log messages, likely due to copy-pasting. Correcting these will enhance the utility of the new logs.

CatherineSue and others added 10 commits November 7, 2025 15:45
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@CatherineSue CatherineSue merged commit e434187 into main Nov 7, 2025
34 of 37 checks passed
@CatherineSue CatherineSue deleted the chang/error-msg branch November 7, 2025 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments