-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Allow Bus to buffer events in case listeners are not configured #8527
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
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.
I'm not against this but I believe it should be optional, like accepting a parameter when creating the bus: NewBusWithStore(100)
. Current uses of the bugs should not be affected, even if there are no listeners
libbeat/common/bus/bus.go
Outdated
@@ -62,6 +63,7 @@ func New(name string) Bus { | |||
return &bus{ | |||
name: name, | |||
listeners: make([]*listener, 0), | |||
store: make(chan Event, 100), |
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.
this number sounds too arbitrary? I would put it as a parameter
@@ -65,11 +66,40 @@ func New(name string) Bus { | |||
} | |||
} | |||
|
|||
func NewBusWithStore(name string, size int) Bus { |
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.
exported function NewBusWithStore should have comment or be unexported
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.
lol. does hound not recognize multiline comments? @exekias
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.
weird, I think it does, let's ignore it this time :)
842b3ad
to
297f6a2
Compare
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, can you please fix the format issues? https://travis-ci.org/elastic/beats/jobs/436753359
jenkins test this please |
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.
WFG
This PR allows Beats to store events in a temporary channel in case there is not subscribed listener.
cc: @exekias please see if this is a valid usecase.