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

feat(events): configurable buffers and predicates #7735

Merged

Conversation

jakubdyszkiewicz
Copy link
Contributor

Checklist prior to review

This PR improves an event bus.

Until now, every event listener created a channel and whenever we send an event, we send it into a channel. This means that whenever there is a full channel we are stuck on .Send. The cause of this can be a single listener that is not reading fast enough.
I changed the event bus to drop the event in this case and emit a log. Additionally:

  • I created a config for the channel buffer. If we see that listeners are not consuming events on time, we can always increase this buffer without releasing a new version of Kuma.
  • I introduced predicates. For example, if there is a listener that only cares about a specific event we can define a predicate. This way we can avoid putting unnecessary events into a channel.
  • Link to relevant issue as well as docs and UI issues --
  • This will not break child repos: it doesn't hardcode values (.e.g "kumahq" as a image registry) and it will work on Windows, system specific functions like syscall.Mkfifo have equivalent implementation on the other OS --
  • Tests (Unit test, E2E tests, manual test on universal and k8s) --
  • Do you need to update UPGRADE.md? --
  • Does it need to be backported according to the backporting policy? (this GH action will add "backport" label based on these file globs, if you want to prevent it from adding the "backport" label use no-backport-autolabel label) --
  • Do you need to explicitly set a > Changelog: entry here or add a ci/ label to run fewer/more tests?

Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team as a code owner September 12, 2023 08:37
@jakubdyszkiewicz jakubdyszkiewicz requested review from slonka and bartsmykla and removed request for a team September 12, 2023 08:37
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

I think it might be better to not do the reconcile where we dequeue from the eventBus.

docs/generated/kuma-cp.md Outdated Show resolved Hide resolved
pkg/events/eventbus.go Show resolved Hide resolved
pkg/events/eventbus.go Outdated Show resolved Hide resolved
pkg/kds/v2/server/event_based_watchdog.go Show resolved Hide resolved
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
@jakubdyszkiewicz jakubdyszkiewicz merged commit 8a3776b into kumahq:master Sep 12, 2023
5 checks passed
@jakubdyszkiewicz jakubdyszkiewicz deleted the feat/insights-filters branch September 12, 2023 11:21
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.

2 participants