balancer: expose endpoint weight and hostname as experimental APIs - #9074
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9074 +/- ##
==========================================
+ Coverage 80.52% 83.14% +2.62%
==========================================
Files 413 418 +5
Lines 33543 33649 +106
==========================================
+ Hits 27012 27979 +967
+ Misses 4316 4248 -68
+ Partials 2215 1422 -793
🚀 New features to boost your workflow:
|
…rpc#8971) - Add new public packages balancer/weight and balancer/hostname with Set/FromEndpoint and Set/Hostname/HostnameFromAddress helpers. - Mark all new APIs as # Experimental with the standard notice. - Update internal callers (ringhash, pickfirst, cdsbalancer, xdsresource) to use the public packages. - Remove dead hostnameKeyType from xdsresource and delegate legacy Hostname() to the public API (fixes Authority_Rewrite_Mismatch test). - Keep deprecated internal/balancer/weight package for transition. - Add tests for the new public packages. - Verified end-to-end with custom DAPerture balancer.
7e7f078 to
5ed3447
Compare
Yes, that is expected. |
|
@Pranjali-2501 : Could you please do a first pass. |
Pranjali-2501
left a comment
There was a problem hiding this comment.
Hi @hpathak01, thanks for raising the PR.
I have added some comments, please take a look.
|
@hpathak01 , please fix Testing / static checks (latest-1) (pull_request). |
hi @Pranjali-2501 done |
|
Hi @easwars , just checking in — I've addressed all the review comments. Would you have a chance to take a look when you get a moment? Thanks! |
easwars
left a comment
There was a problem hiding this comment.
Apologies for the delay in reviewing this.
…rpc#9074) ### Description This PR exposes two new **experimental** public APIs so that custom load balancing policies can access endpoint attributes that were previously only available via internal packages: - `google.golang.org/grpc/balancer/weight` — `Set`, `FromEndpoint`, `EndpointInfo` - `google.golang.org/grpc/balancer/hostname` — `Set`, `FromEndpoint` These attributes (especially `weight`) are required by custom balancers such as deterministic aperture / P2C that need EDS-provided endpoint details like weights etc. Fixes grpc#8971 RELEASE NOTES: - experimental/balancer/hostname: New APIs to access endpoint hostname attributes - experimental/balancer/weight: New APIs to access endpoint weight attributes
Description
This PR exposes two new experimental public APIs so that custom load balancing policies can access endpoint attributes that were previously only available via internal packages:
google.golang.org/grpc/balancer/weight—Set,FromEndpoint,EndpointInfogoogle.golang.org/grpc/balancer/hostname—Set,FromEndpoint,FromAddressThese attributes (especially
weight) are required by custom balancers such as deterministic aperture / P2C that need EDS-provided endpoint details like weights etc.Changes
balancer/hostnamewith full experimental notices.internal/balancer/weightto publicbalancer/weightvia git mv, added experimental notices.SetHostnameandHostnamewrappers fromxdsresource; callers now usehostname.Setandhostname.FromAddressdirectly.Related Issues
Fixes #8971
Testing
go test -count=1 ./...)Notes for Reviewers
resolver/ringhash.balancer/weightandbalancer/hostname).RELEASE NOTES: none