-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
xds: Implement circuit breaking support. #4050
Changes from 29 commits
f002b7e
81840c4
027f3b9
45960e9
7ce9958
6efeb41
4021d5d
a60e3b6
a53d4b4
ceb64d4
8bc9b02
63ca25b
23e96d4
f3beb84
eff8dfa
4cd2b4f
3308919
13c8c41
b74f32e
96282cb
dbe85ec
bb4e674
d00cc36
62648b9
abd41f8
249fc60
fad40e7
67e9563
3406b64
1c16e68
3d4130d
8cbb4f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,8 @@ type edsBalancerImplInterface interface { | |
handleSubConnStateChange(sc balancer.SubConn, state connectivity.State) | ||
// updateState handle a balancer state update from the priority. | ||
updateState(priority priorityType, s balancer.State) | ||
// updateServiceRequestsCounter handles an update to the service name. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updates the service requests counter to the one for the given service name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made this change. |
||
updateServiceRequestsCounter(serviceName string) | ||
// close closes the eds balancer. | ||
close() | ||
} | ||
|
@@ -212,6 +214,8 @@ func (x *edsBalancer) handleGRPCUpdate(update interface{}) { | |
x.logger.Warningf("failed to update xDS client: %v", err) | ||
} | ||
|
||
x.edsImpl.updateServiceRequestsCounter(cfg.EDSServiceName) | ||
|
||
// We will update the edsImpl with the new child policy, if we got a | ||
// different one. | ||
if !cmp.Equal(cfg.ChildPolicy, x.config.ChildPolicy, cmpopts.EquateEmpty()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,7 @@ type fakeEDSBalancer struct { | |
childPolicy *testutils.Channel | ||
subconnStateChange *testutils.Channel | ||
edsUpdate *testutils.Channel | ||
serviceName *testutils.Channel | ||
} | ||
|
||
func (f *fakeEDSBalancer) handleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { | ||
|
@@ -131,6 +132,10 @@ func (f *fakeEDSBalancer) handleEDSResponse(edsResp xdsclient.EndpointsUpdate) { | |
|
||
func (f *fakeEDSBalancer) updateState(priority priorityType, s balancer.State) {} | ||
|
||
func (f *fakeEDSBalancer) updateServiceRequestsCounter(serviceName string) { | ||
f.serviceName.Send(serviceName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. And call it to verify in the test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made this change. Wasn't 100% sure what test you are talking about, added the check to |
||
} | ||
|
||
func (f *fakeEDSBalancer) close() {} | ||
|
||
func (f *fakeEDSBalancer) waitForChildPolicy(ctx context.Context, wantPolicy *loadBalancingConfig) error { | ||
|
@@ -175,6 +180,7 @@ func newFakeEDSBalancer(cc balancer.ClientConn) edsBalancerImplInterface { | |
childPolicy: testutils.NewChannelWithSize(10), | ||
subconnStateChange: testutils.NewChannelWithSize(10), | ||
edsUpdate: testutils.NewChannelWithSize(10), | ||
serviceName: testutils.NewChannelWithSize(10), | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a CDS test to check that counter is updated.
(Since you cannot read counter's fields, update max to small values, and
add
, and check return values)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made this change.