-
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
Reduce libbeat state being hold in beat for dynamic loading modules #7018
Conversation
Metricbeat/Filebeat modules and inputs require to create a connection to the shared libbeat per go-routine. This requires the beat to keep some libbeat state, in order to connect a module to the pipeline when loading a module dynamically (config reloading/autodiscovery). With this change, the pipeline is passed to the RunnerFactory, This way the libbeat-internal state required for connecting a dynamically loaded module to libbeat is managed by libbeat, not the beat itself.
metricbeat/mb/module/factory.go
Outdated
} | ||
} | ||
|
||
func (r *Factory) Create(c *common.Config, meta *common.MapStrPointer) (cfgfile.Runner, error) { | ||
func (r *Factory) Create(p beat.Pipeline, c *common.Config, meta *common.MapStrPointer) (cfgfile.Runner, error) { |
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 method Factory.Create should have comment or be unexported
filebeat/input/registry.go
Outdated
@@ -16,7 +16,7 @@ type Context struct { | |||
DynamicFields *common.MapStrPointer | |||
} | |||
|
|||
type Factory = func(config *common.Config, outletFactory channel.Factory, context Context) (Input, error) | |||
type Factory = func(config *common.Config, connector channel.Connector, context Context) (Input, error) |
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 type Factory should have comment or be unexported
filebeat/channel/interface.go
Outdated
|
||
// Outleter is the outlet for an input | ||
type Outleter interface { | ||
Close() error | ||
OnEvent(data *util.Data) bool | ||
} | ||
|
||
func ConnectTo(pipeline beat.Pipeline, factory Factory) Connector { |
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 ConnectTo 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.
LGTM. Would be good if @exekias could also have a look at this one.
@exekias All good for me, I am adding a post merge LGTM |
…lastic#7018) Reduce libbeat state being hold in beat for dynamic loading modules Metricbeat/Filebeat modules and inputs require to create a connection to the shared libbeat per go-routine. This requires the beat to keep some libbeat state, in order to connect a module to the pipeline when loading a module dynamically (config reloading/autodiscovery). With this change, the pipeline is passed to the RunnerFactory, This way the libbeat-internal state required for connecting a dynamically loaded module to libbeat is managed by libbeat, not the beat itself.
…lastic#7018) Reduce libbeat state being hold in beat for dynamic loading modules Metricbeat/Filebeat modules and inputs require to create a connection to the shared libbeat per go-routine. This requires the beat to keep some libbeat state, in order to connect a module to the pipeline when loading a module dynamically (config reloading/autodiscovery). With this change, the pipeline is passed to the RunnerFactory, This way the libbeat-internal state required for connecting a dynamically loaded module to libbeat is managed by libbeat, not the beat itself.
Metricbeat/Filebeat modules and inputs require to create a connection to
the shared libbeat per go-routine. This requires the beat to keep some
libbeat state, in order to connect a module to the pipeline when loading
a module dynamically (config reloading/autodiscovery).
With this change, the pipeline is passed to the RunnerFactory, This way
the libbeat-internal state required for connecting a dynamically loaded
module to libbeat is managed by libbeat, not the beat itself.