Skip to content
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

Add rate limiter to event http servers #167

Merged
merged 5 commits into from
Apr 1, 2021
Merged

Conversation

phillebaba
Copy link
Member

@phillebaba phillebaba commented Mar 21, 2021

Adds a rate limiter to the events http server. The limiters are keyed based on the request.

The event endpoint is keyed based on the involved object, severity of the event, and if present reference. A new severity for a throttled involved object should not be throttled and the previous severity throttling should be reset. This is useful when KC or HC will reconcile a resource multiple times if the reconcile errors. A large amount of duplicate events will be sent during a short amount of time until the back off becomes large enough. This protects NC from spamming providers with the same events.

Fixes #158
Fixes #179

@phillebaba phillebaba marked this pull request as draft March 21, 2021 22:19
@phillebaba phillebaba force-pushed the feature/rate-limit branch 2 times, most recently from 4927594 to 061fae5 Compare March 21, 2021 22:23
main.go Outdated Show resolved Hide resolved
internal/server/event_server_test.go Outdated Show resolved Hide resolved
internal/server/event_server_test.go Outdated Show resolved Hide resolved
internal/server/event_server.go Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
internal/server/event_server.go Outdated Show resolved Hide resolved
@phillebaba phillebaba marked this pull request as ready for review March 25, 2021 15:48
@phillebaba phillebaba force-pushed the feature/rate-limit branch 3 times, most recently from ef07dc0 to 59234b1 Compare March 30, 2021 22:11
@phillebaba phillebaba force-pushed the feature/rate-limit branch 2 times, most recently from fd9526d to 95c293e Compare March 31, 2021 14:49
@phillebaba phillebaba changed the title Add rate limiter to receiver and events Add rate limiter to receiver and event http servers Mar 31, 2021
main.go Outdated Show resolved Hide resolved
Signed-off-by: Philip Laine <[email protected]>
@phillebaba phillebaba changed the title Add rate limiter to receiver and event http servers Add rate limiter to event http servers Apr 1, 2021
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @phillebaba 🏅

@phillebaba phillebaba merged commit 5f4440d into main Apr 1, 2021
@phillebaba phillebaba deleted the feature/rate-limit branch April 1, 2021 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Prometheus instrumentation to the HTTP servers HelmRelease errors spam slack
2 participants