Skip to content

dynamic_modules: add a method to get host health by address#43769

Merged
agrawroh merged 1 commit intoenvoyproxy:mainfrom
agrawroh:feat-dm-lbs-1
Mar 4, 2026
Merged

dynamic_modules: add a method to get host health by address#43769
agrawroh merged 1 commit intoenvoyproxy:mainfrom
agrawroh:feat-dm-lbs-1

Conversation

@agrawroh
Copy link
Copy Markdown
Member

@agrawroh agrawroh commented Mar 4, 2026

Description

This PR adds a method to get the host health by address in the LB Dynamic Module.


Commit Message: dynamic_modules: add a method to get host health by address
Additional Description: Adds a method to get the host health by address in the LB Dynamic Module.
Risk Level: Low
Testing: Added Tests
Docs Changes: Added
Release Notes: N/A

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a new capability to the Envoy Dynamic Module load balancer, allowing modules to efficiently retrieve the health status of a host by its network address. This enhancement provides an O(1) lookup mechanism, significantly improving performance for dynamic modules that require quick access to host health information without iterating through all hosts.

Highlights

  • New ABI Function: A new ABI function, envoy_dynamic_module_callback_lb_get_host_health_by_address, has been added to allow dynamic modules to efficiently look up host health by address string.
  • Rust SDK Integration: The Rust SDK has been updated to expose the new host health lookup method, get_host_health_by_address, within the EnvoyLoadBalancer trait and its implementation.
  • C++ Implementation: The C++ implementation for the new ABI function utilizes the crossPriorityHostMap for O(1) lookup of host health based on the provided address.
  • Comprehensive Testing: New test cases have been added in both C and C++ to validate the functionality of the host health lookup by address, covering successful lookups, non-existent addresses, and null input handling.
Changelog
  • source/extensions/dynamic_modules/abi/abi.h
    • Declared envoy_dynamic_module_callback_lb_get_host_health_by_address with detailed Doxygen comments.
  • source/extensions/dynamic_modules/sdk/rust/src/lib.rs
    • Added get_host_health_by_address to the EnvoyLoadBalancer trait.
    • Implemented get_host_health_by_address in EnvoyLoadBalancerImpl, wrapping the new ABI function.
  • source/extensions/load_balancing_policies/dynamic_modules/abi_impl.cc
    • Implemented envoy_dynamic_module_callback_lb_get_host_health_by_address, including null pointer checks and using crossPriorityHostMap for efficient lookup.
  • test/extensions/dynamic_modules/test_data/c/lb_callbacks_test.c
    • Added C test cases to verify envoy_dynamic_module_callback_lb_get_host_health_by_address for existing and non-existent hosts.
  • test/extensions/load_balancing_policies/dynamic_modules/config_test.cc
    • Added HostHealthByAddressSuccess test to confirm correct health status retrieval for healthy and degraded hosts.
    • Added HostHealthByAddressNullInputs test to validate error handling for null pointers and non-existent host maps.
Activity
  • No human activity has occurred on this pull request yet.
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
Copy Markdown
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 a new ABI function envoy_dynamic_module_callback_lb_get_host_health_by_address to allow dynamic modules to efficiently query a host's health status by its address. This is a useful performance improvement, avoiding the need for modules to iterate over all hosts. The changes span the C ABI header, the Rust SDK, the C++ implementation, and associated tests. The implementation is well-tested, covering success, failure, and null input cases. I have one suggestion to refactor the C++ implementation for improved readability and maintainability.

Note: Security Review did not run due to the size of the PR.

Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
@agrawroh agrawroh merged commit c4ef6d1 into envoyproxy:main Mar 4, 2026
29 checks passed
bmjask pushed a commit to bmjask/envoy that referenced this pull request Mar 14, 2026
…xy#43769)

## Description

This PR adds a method to get the host health by address in the LB
Dynamic Module.

---

**Commit Message:** dynamic_modules: add a method to get host health by
address
**Additional Description:** Adds a method to get the host health by
address in the LB Dynamic Module.
**Risk Level:** Low
**Testing:** Added Tests
**Docs Changes:** Added
**Release Notes:** N/A

Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
Signed-off-by: bjmask <11672696+bjmask@users.noreply.github.com>
bvandewalle pushed a commit to bvandewalle/envoy that referenced this pull request Mar 17, 2026
…xy#43769)

## Description

This PR adds a method to get the host health by address in the LB
Dynamic Module.

---

**Commit Message:** dynamic_modules: add a method to get host health by
address
**Additional Description:** Adds a method to get the host health by
address in the LB Dynamic Module.
**Risk Level:** Low
**Testing:** Added Tests
**Docs Changes:** Added
**Release Notes:** N/A

Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
fishcakez pushed a commit to fishcakez/envoy that referenced this pull request Mar 25, 2026
…xy#43769)

## Description

This PR adds a method to get the host health by address in the LB
Dynamic Module.

---

**Commit Message:** dynamic_modules: add a method to get host health by
address
**Additional Description:** Adds a method to get the host health by
address in the LB Dynamic Module.
**Risk Level:** Low
**Testing:** Added Tests
**Docs Changes:** Added
**Release Notes:** N/A

Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants