Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadbalancer-experimental: add LB observer method for when the host set changes #3003

Merged

Conversation

bryce-anderson
Copy link
Contributor

Motivation:

It can be valuable to know what the current host set is but we don't have a way to directly observer that right now.

Modifications:

Add a method to the LoadBalancerObserver that can capture when the host set changes and use it in DefaultLoadBalancer.

…et changes

Motivation:

It can be valuable to know what the current host set is but we don't
have a way to directly observer that right now.

Modifications:

Add a method to the LoadBalancerObserver that can capture when the host set
changes and use it in DefaultLoadBalancer.
@bryce-anderson bryce-anderson force-pushed the bl_anderson/host_set_changed_observer branch from 75eed92 to bf3d1b9 Compare July 12, 2024 16:33
@bryce-anderson bryce-anderson requested review from mgodave and tkountis and removed request for mgodave July 12, 2024 16:34
this.hostSelector = hostSelector.rebuildWithHosts(priorityStrategy.prioritize(usedHosts));
nextHosts = priorityStrategy.prioritize(nextHosts);
this.hostSelector = hostSelector.rebuildWithHosts(nextHosts);
loadBalancerObserver.onHostSetChanged(Collections.unmodifiableCollection(nextHosts));
Copy link
Member

Choose a reason for hiding this comment

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

After the 2nd look: priorityStrategy returns a List. Why does the observer provide a Collection? Just to align with SD discovery publisher contract? Will List be beneficial to signal Host priorities to users of LB-observer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We talked offline and the static type of Collection is fine and I've used the unmodifiableList method to make the dynamic type more helpful.

@bryce-anderson bryce-anderson merged commit 0a7f539 into apple:main Jul 15, 2024
11 checks passed
@bryce-anderson bryce-anderson deleted the bl_anderson/host_set_changed_observer branch July 15, 2024 19:56
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