grpc-go
grpc-go copied to clipboard
examples: Add custom load balancer example
Contains #6679. This PR adds a custom load balancer example, deployed as the top level balancer of the channel through a service config. This custom load balancer is a petiole policy wrapping pick first, which is the intended way we want users to write their own custom load balancers, as users get features such as Sticky Transient Failure, Health Checking, and the Happy Eyeballs algorithm out of the box.
As part of this PR, pick_first is changed to work on the endpoints list and handle the endpoints list as defined in A61. This change works within system because the Channel is already emitting a Slice of Endpoints.
RELEASE NOTES:
- examples: Add custom lb example
Codecov Report
Merging #6691 (944499d) into master (adf976b) will decrease coverage by
0.47%
. Report is 6 commits behind head on master. The diff coverage is13.21%
.
:exclamation: Current head 944499d differs from pull request most recent head 7af9e93. Consider uploading reports for the commit 7af9e93 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #6691 +/- ##
==========================================
- Coverage 81.24% 80.77% -0.47%
==========================================
Files 345 346 +1
Lines 33941 34094 +153
==========================================
- Hits 27574 27541 -33
- Misses 5202 5379 +177
- Partials 1165 1174 +9
Files | Coverage Δ | |
---|---|---|
pickfirst.go | 82.69% <88.46%> (+0.47%) |
:arrow_up: |
balancer/balanceraggregator/balanceraggregator.go | 0.00% <0.00%> (ø) |
Please rebase your comment before merging.
Done.
Added BalancerAggregator utility we discussed offline :). This is ready to review now.
Added to examples test as discussed offline.
Added e2e test that tested the main behaviors I view endpoint sharding to have (a child per endpoint, default behavior of round robin over pickers in aggregated state, access to child picker in parent UpdateState).
And move pick first :).