Skip to content

Orion internal repo sync - part 1#43

Merged
kmesh-bot merged 64 commits intokmesh-net:mainfrom
fciaccia:orion-internal-sync-part-1
Aug 25, 2025
Merged

Orion internal repo sync - part 1#43
kmesh-bot merged 64 commits intokmesh-net:mainfrom
fciaccia:orion-internal-sync-part-1

Conversation

@fciaccia
Copy link
Contributor

This is the first of a series of pull requests meant to align the internal Huawei repository with the kmesh open source branch so that it includes the work of the last few months. This PR includes:

  • the introduction of the orion-format crate that will be used for access logging (to be merged in a future PR); orion-format is a log formatter compatible with Envoy’s access-log grammar and designed with performance in mind.
  • add support for websocket protocol; Websockets can be configured at the HCM level and/or at the RouteAction level for forwarding routes.
  • added a service runtime to spawn service tasks such as xds, admin, and access logging.
  • improved reliability of xDS client code.
  • various formatting and cleaning up.

@kmesh-bot
Copy link
Contributor

Welcome @fciaccia! It looks like this is your first PR to kmesh-net/orion 🎉

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 @fciaccia, 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 is the first part of a series aimed at synchronizing the internal Huawei repository with the kmesh open-source branch. Key changes include the introduction of a new orion-format crate for access logging, the addition of WebSocket protocol support, and the implementation of a dedicated service runtime for managing background tasks. The xDS client code has also seen reliability improvements, alongside general code formatting and cleanup.

Highlights

  • New orion-format Crate: The orion-format crate has been introduced, providing a high-performance, Envoy-compatible access log formatter. This will be crucial for detailed request logging.
  • WebSocket Protocol Support: Support for the WebSocket protocol has been added, allowing WebSocket connections to be configured at both the HTTP Connection Manager (HCM) and RouteAction levels. This significantly expands the proxy's capabilities for real-time applications.
  • Dedicated Service Runtime: A new service runtime has been implemented to manage and spawn various background tasks, including xDS client operations, administrative functions, and access logging. This improves the modularity and scalability of these services.
  • Improved xDS Client Reliability: The xDS client code has received reliability improvements, enhancing its ability to maintain stable connections and process configuration updates from the control plane.
  • Dependency Updates and Cleanup: Numerous dependencies across the project have been updated to their latest versions, and several unused dependencies have been removed. This helps maintain a healthy and secure dependency tree.
  • HTTP Connection Manager and Routing Enhancements: The HTTP Connection Manager (HCM) and routing configurations have undergone significant refactoring to support the new WebSocket and CONNECT upgrade functionalities, ensuring proper request handling and routing for these protocols.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is a substantial pull request that syncs a significant amount of work from an internal repository. It introduces the orion-format crate for access logging, adds WebSocket support, a new service runtime, and improves the xDS client. The changes are extensive, including major refactoring, dependency updates, and new features. The overall code quality is high, with many improvements to error handling, code structure, and performance considerations. I've identified one potential issue with range validation that could lead to incorrect behavior. Besides that, the changes look solid and well-implemented.

@awgn awgn force-pushed the orion-internal-sync-part-1 branch from 3e18127 to 79571ca Compare August 22, 2025 12:58
oarcas-huawei and others added 23 commits August 22, 2025 15:03
Signed-off-by: Oriol Arcas <oriol.arcas@huawei-partners.com>
Signed-off-by: Rui Ferreira <rui.ferreira@huawei.com>
- fix broken comparison where n_bytes >= *bytes_read would error on new data
- fix incorrect read buffer alignment for init and outbound copy
- change read buffer size to be adaptive

Signed-off-by: Alan Keane <alan.keane1@huawei.com>
Signed-off-by: Alan Keane <alan.keane1@huawei.com>
Signed-off-by: Hayley Deckers <hayley.deckers@huawei-partners.com>
Signed-off-by: Alan Keane <alan.keane1@huawei.com>
Signed-off-by: Alan Keane <alan.keane1@huawei.com>
Includes:
- EnvoyGrammar for parsing Envoy-style log templates
- Token definitions and argument handling
- Unit tests for various parsing scenarios

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Introduced Criterion-based benchmarks for request formatting.
- Added `Context` trait implementations for `Request` and `Response`.
- Updated `EnvoyGrammar` to handle placeholders with original strings.
- Refactored `Template` to include original placeholder strings.
- Added tests for request context evaluation and default format string.
- Removed `strum` dependency for token display.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Updated `LogFormatter` to include response context.
- Added `%RESPONSE_CODE%` and response headers to supported tokens.
- Modified benchmarks to include response context.
- Updated tests to validate response context functionality.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Updated `Template::Literal` and `Template::Placeholder` to use
`SmolStr`.
- Replaced `String` with `SmolStr` in relevant parts of the code.
- Adjusted `LogFormatter` and `Context` implementations accordingly.
- Added a new benchmark for cloning `LogFormatter`.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Introduce SmolCow enum to reduce memory allocations and improve
performance (~30% on average). Update Context trait and related implementations to
use SmolCow instead of Cow. Add smol_cow module to define SmolCow
and its associated methods.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Introduced `StartContext` and `EndContext` for capturing start time,
  duration, bytes received, and bytes sent.
- Updated benchmarks and tests to include the new context types.
- Added `chrono` dependency for timestamp formatting.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Renamed StartContext to DownStreamContext and EndContext to UpStreamContext.
- Updated benchmarks and tests to use the new context struct names.
- Added a write_to method to LogFormatter for writing formatted output to a writer.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Includes a new `benchmark_rust_format` function to measure the
performance of pure log formatting.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
reasons.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Dawid Nowak <dawid.nowak@huawei.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Renamed `DownStreamContext` to `InitContext` and `UpStreamContext` to `FinishContext`.
- Renamed `DownStreamRequest`/`DownStreamResponse` to `DownstreamRequest`/`DownstreamResponse`.
- Added `number_keys` method to `Context` trait for optimization.
- Updated benchmarks to reflect new context names and structure.
- Improved `LogFormatter::with_context` to limit token evaluations.
- Adjusted tests to use updated context types and methods

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
awgn and others added 14 commits August 22, 2025 15:05
…tealth_unwrap to avoid clippy warnings or errors in benchmarks.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
…e cases and add Bytes variant to StringType

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Replaced `String::from_utf8_lossy` with `to_str` for header value
processing.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Introduced `benchmark_log_headers` to test log header formatting.
- Fixed typo in error message: "braket" -> "bracket".
- Simplified `StringType::Bytes` handling by unconditinally use Box<[u8]> and removing redundant conversions.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Alan Keane <alan.keane1@huawei.com>
Signed-off-by: Dawid Nowak <dawid.nowak@huawei.com>
- Create service runtime where to accomodate xds, admin and access
logging.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
Signed-off-by: Francesco Ciaccia <francesco.ciaccia1@huawei-partners.com>
- Refactored ServiceInfo to include the entire Bootstrap struct instead
of duplicating listeners. Updated related function calls and logic
to use Bootstrap directly.
- Bootstrap in ServiceInfo is currently not used in run_services but
it will be needed when adding access_log and admin tasks.

Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
- Added `tracing-subscriber` to dependencies in `Cargo.lock` and `Cargo.toml`.
- Introduced a test route name in `http_connection_manager.rs`.
- Refactored allocator configuration in `main.rs` to prevent simultaneous feature usage.
- Removed unused imports of `tracing_subscriber` in several example files.

Signed-off-by: Francesco Ciaccia <francesco.ciaccia1@huawei-partners.com>
- Removed files for specific versioning for dependencies and clean up unused
  entries.

Signed-off-by: Francesco Ciaccia <francesco.ciaccia1@huawei-partners.com>
@fciaccia fciaccia force-pushed the orion-internal-sync-part-1 branch from 79571ca to 22301c9 Compare August 22, 2025 13:07
@hzxuzhonghu
Copy link
Member

@fciaccia We donot want such big pr in the future, please develope in this repo via per pr per feature.

.gitignore Outdated
@@ -1,4 +1,5 @@
/target
advisory-db
Copy link
Member

Choose a reason for hiding this comment

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

what's this for

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was an internal leftover, removed.

Cargo.toml Outdated


[workspace.package]
description = "Orion Proxy is a highly experimental cloud native proxy. Orion Proxy is configurable via Envoy xDS protocol"
Copy link
Member

Choose a reason for hiding this comment

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

remove such word experimental

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

@fciaccia fciaccia force-pushed the orion-internal-sync-part-1 branch from 3674dbb to 63d0ef0 Compare August 25, 2025 10:32
Signed-off-by: Francesco Ciaccia <francesco.ciaccia1@huawei-partners.com>
@fciaccia fciaccia force-pushed the orion-internal-sync-part-1 branch from 63d0ef0 to 9b97fe9 Compare August 25, 2025 10:34
@fciaccia
Copy link
Contributor Author

@fciaccia We donot want such big pr in the future, please develope in this repo via per pr per feature.

Hi @hzxuzhonghu , I am Francesco, one of the original authors of Orion - the code in this repository has been open sourced by Huawei starting from our internal repo.

This PR is a push of recent updates from the original authors of Orion proxy. We continued to work on Orion when it was selected for open source at the beginning of the year. Because that process took a few months, we are now sharing some recent work that we have been continuing with (and there is more to come in the same regard - a lot more).

Honestly, it feels odd that the original authors of the project have not been added to the kmesh committership in the first place.

We totally agree that the scope of PRs in general should be much smaller and should be on a per-feature basis - but this and subsequent PRs are a completely different matter. This code has already been thoroughly peer reviewed internally and these PRs should just be a formality.

Hope this clarifies the situation and that we can keep the process on this PRs as smooth as possible so that we can all continue working on Orion effectively. Thank you.

@hzxuzhonghu
Copy link
Member

/lgtm

@hzxuzhonghu
Copy link
Member

/approve

@kmesh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

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

The pull request process is described here

Details 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

@kmesh-bot kmesh-bot merged commit 1a6de53 into kmesh-net:main Aug 25, 2025
2 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.

6 participants