feat: expose k_top_nodes in DynamicRouteProviderBuilder#716
Open
shilingwang wants to merge 3 commits intodfinity:mainfrom
Open
feat: expose k_top_nodes in DynamicRouteProviderBuilder#716shilingwang wants to merge 3 commits intodfinity:mainfrom
shilingwang wants to merge 3 commits intodfinity:mainfrom
Conversation
blind-oracle
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
LatencyRoutingSnapshothas long supported ak_top_nodesoption that limits routing to only the top k nodes ranked by latency score. However, this option became inaccessible after #694 removed the generic snapshot parameter fromDynamicRouteProviderBuilder, leavingset_k_top_nodeseffectively dead code.Changes
Added
k_top_nodes: Option<usize>as an explicit parameter to bothDynamicRouteProviderBuilder::new()andDynamicRouteProviderBuilder::from_components(). PassSome(k)to cap routing to the top k nodes by latency score, or None to use all healthy nodes (existing default behaviour).Removed
#[allow(unused)]fromLatencyRoutingSnapshot::set_k_top_nodes, since it is now called from the builder.Updated all internal call sites to pass None.
Usage