Skip to content

Conversation

@awgn
Copy link
Contributor

@awgn awgn commented Sep 16, 2025

Enable the following access-log operators: ROUTE_NAME, REQUESTED_SERVER_NAME, UPSTREAM_TRANSPORT_FAILURE_REASON, RESPONSE_CODE_DETAILS, and CONNECTION_TERMINATION_DETAILS.

Specifically, perform the following refactoring:

  • Track upstream transport errors in FinishContext and access logs
  • Refactor error handling to propagate EventKind/Error through SyntheticHttpResponse
  • Update BodyWithMetrics to pass EventError to completion callback
  • Simplify Context trait implementations using map_or
  • Move EventError from retry_policy to event_error module
  • Update synthetic response constructors to accept EventKind/EventError
  • Pass upstream_failure to access log contexts in TCP and HTTP handlers
  • Add response_code_details to FinishContext
  • Include ConnectionTerminationDetails in FinishContext, access logs, and log formatting
  • Apply other minor improvements and bug fixes

REQUESTED_SERVER_NAME, UPSTREAM_TRANSPORT_FAILURE_REASON,
RESPONSE_CODE_DETAILS, and CONNECTION_TERMINATION_DETAILS.

Specifically, perform the following refactorings:

- Track upstream transport errors in FinishContext and access logs
- Refactor error handling to propagate EventKind/Error through SyntheticHttpResponse
- Update BodyWithMetrics to pass EventError to completion callback
- Simplify Context trait implementations using map_or
- Move EventError from retry_policy to event_error module
- Update synthetic response constructors to accept EventKind/EventError
- Pass upstream_failure to access log contexts in TCP and HTTP handlers
- Add response_code_details to FinishContext
- Include ConnectionTerminationDetails in FinishContext, access logs, and log formatting
- Apply other minor improvements and bug fixes

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
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.

Summary of Changes

Hello @awgn, 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 enhances the access logging capabilities by introducing several new operators that provide more detailed insights into request processing, upstream failures, and connection terminations. It centralizes error handling logic into a dedicated module, allowing for a more structured and informative propagation of event-specific errors throughout the system. These changes collectively aim to provide richer, more actionable data for monitoring and troubleshooting, particularly beneficial for operators managing services with Istio.

Highlights

  • Enhanced Access Log Operators: Enabled new access log operators including ROUTE_NAME, REQUESTED_SERVER_NAME, UPSTREAM_TRANSPORT_FAILURE_REASON, RESPONSE_CODE_DETAILS, and CONNECTION_TERMINATION_DETAILS to provide more granular and comprehensive logging for Istio operators.
  • Refactored Error Handling: Introduced a new event_error module to centralize EventError and EventKind definitions, improving error propagation and allowing for more specific error details to be captured in access logs and synthetic responses.
  • Improved Contextual Information: Updated various context structs (FinishContext, UpstreamContext, DownstreamContext, InitHttpContext) to include new fields like upstream_failure, response_code_details, connection_termination_details, route_name, and server_name, enriching the data available for logging and metrics.
  • Simplified Code with map_or: Refactored Context trait implementations, particularly in TcpContext and DownstreamContext, to leverage map_or for more concise and idiomatic handling of optional values.
  • Updated Synthetic HTTP Responses: Modified SyntheticHttpResponse constructors to accept EventKind, ensuring that internally generated responses carry specific event information for better debugging and logging.
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 introduces significant improvements to access logging by enabling several new Istio-compatible operators. The refactoring to propagate detailed error and event information via EventKind and SyntheticHttpResponse is well-executed and enhances observability. The code is also cleaner with the move of error-related logic to a dedicated event_error module and the consistent use of map_or for conciseness. I've found one potential issue with error chain traversal that should be addressed. Otherwise, this is a great set of changes.

Correct the logic to preserve each source level: avoid direct source
recursion and unwrap the inner error instead.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
@kmesh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dawid-nowak

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hzxuzhonghu
Copy link
Member

/lgtm

@kmesh-bot kmesh-bot added the lgtm label Sep 23, 2025
@kmesh-bot kmesh-bot merged commit 8f42acc into kmesh-net:main Sep 23, 2025
4 checks passed
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.

4 participants