-
Notifications
You must be signed in to change notification settings - Fork 833
Implement Hashicorps's recommendations when watching consul key #1713
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
Conversation
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.
Thanks for the PR @pstibrany. It's a pity we had to fork the rate limiter code vs just referencing it, but other than that it LGTM
Thanks for your review. I couldn't find any other fitting rate limiter in dependencies that Cortex already has, and I didn't want to introduce new dependency. I'm open to switching to a different one if you have a good suggestion, although I quite like how simple this one is. |
@pstibrany have you seen https://godoc.org/golang.org/x/time/rate? ps we already use it here: https://github.com/cortexproject/cortex/blob/master//pkg/distributor/distributor.go#L403 |
Replaced with rate limiter from golang.org/x/time/rate. Not as nice, but it works and we avoid copying. |
Oh, I guess rate-limit should apply for WatchPrefix as well, not just WatchKey. I missed that. |
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.
Looks good, left some comments.
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.
LGTM
@pstibrany Could you add a changelog entry and I'll merge this after that and Jacob's nit. |
https://www.consul.io/api/features/blocking.html#implementation-details Fixes issue #1708 Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
This makes lint happy. Signed-off-by: Peter Štibraný <[email protected]>
Removed copy of modified jaegers' rate-limiter Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Added changelog, fixed "Zero" -> "0", and rebased on top of master. |
Signed-off-by: Peter Štibraný <[email protected]>
This PR implements Hashicorp's recommendations for using blocking queries at https://www.consul.io/api/features/blocking.html:
Fixes issue #1708.