-
Notifications
You must be signed in to change notification settings - Fork 463
Adding middleware call in host queue writes #4337
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
base: circuit_breaker_middleware
Are you sure you want to change the base?
Conversation
|
src/dbnode/client/host_queue.go
Outdated
@@ -674,7 +677,7 @@ func (q *queue) asyncWrite( | |||
} | |||
|
|||
ctx, _ := thrift.NewContext(q.opts.WriteRequestTimeout()) | |||
err = client.WriteBatchRaw(ctx, req) | |||
err = q.middleware(client).WriteBatchRaw(ctx, req) |
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.
simplify this middleware wrapping to be done at construction time, instead of each request
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.
Yes, I have updated it.
src/dbnode/client/host_queue.go
Outdated
@@ -92,6 +93,29 @@ func newHostQueue( | |||
iOpts = iOpts.SetMetricsScope(scope) | |||
opts = opts.SetInstrumentOptions(iOpts.SetMetricsScope(scope)) | |||
|
|||
// Create circuit breaker middleware | |||
cbMiddleware, err := middleware.New( |
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.
do you want to add support for a no-op middleware somehow?
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.
Added it.
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.
you added the type but it's not used anywhere. should we do something like if circuitbreaker not enabled use the noop else current path?
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.
please add unit + integration tests for this
What this PR does / why we need it:
This PR uses circuit breaker middleware in M3DB client write calls.
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: