Skip to content

[xds] Implement A114: WRR support for custom backend metrics#12645

Open
sauravzg wants to merge 1 commit intogrpc:masterfrom
sauravzg:wrr-custom-metrics
Open

[xds] Implement A114: WRR support for custom backend metrics#12645
sauravzg wants to merge 1 commit intogrpc:masterfrom
sauravzg:wrr-custom-metrics

Conversation

@sauravzg
Copy link
Contributor

@sauravzg sauravzg commented Feb 4, 2026

Description

This PR implements gRFC A114: WRR Support for Custom Backend Metrics.

It updates the weighted_round_robin policy to allow users to configure which backend metrics drive the load balancing weights.

Key Changes

  • Configuration: Supports the new metric_names_for_computing_utilization field in WeightedRoundRobinLbConfig.
  • Weight Calculation: Implements logic to resolve custom metrics (including map lookups like named_metrics.foo) when application_utilization is absent.
  • Refactor: Centralizes the complex metric lookup and validation logic (checking for NaN, <= 0, etc.) into a new internal utility MetricReportUtils.
  • Testing: Verifies correct precedence: application_utilization > custom_metrics (max valid value) > cpu_utilization.

Updates the Weighted Round Robin (WRR) load balancing policy to support
customizable utilization metrics via the `metric_names_for_computing_utilization` configuration.
This allows endpoint weights to be driven by arbitrary named metrics (e.g. `named_metrics.foo`)
or other standard metrics (e.g. `memory_utilization`) instead of solely `application_utilization`
or the `cpu_utilization` fallback.
Refactors metric resolution logic into `io.grpc.xds.internal.MetricReportUtils`
to handle the new map lookup and validation requirements.
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.

1 participant