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

Reduce libbeat state being hold in beat for dynamic loading modules #7018

Merged
merged 4 commits into from
May 7, 2018

Conversation

urso
Copy link

@urso urso commented May 4, 2018

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.
@urso urso added the in progress Pull request is currently in progress. label May 4, 2018
}
}

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) {

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

@@ -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)

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


// 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 {

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

@urso urso added review and removed in progress Pull request is currently in progress. labels May 6, 2018
@urso urso requested review from ph and exekias May 6, 2018 19:11
@ruflin ruflin added the libbeat label May 7, 2018
Copy link
Member

@ruflin ruflin left a 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 exekias merged commit c83a4cb into elastic:master May 7, 2018
@exekias
Copy link
Contributor

exekias commented May 7, 2018

OK I think I pressed the wrong button, as I realize now @ph review was still missing 😞

@ph I think we can ask for follow up PRs if you see anything that needs to be changed, or I can open a revert PR

Sorry everyone

@ph
Copy link
Contributor

ph commented May 7, 2018

@exekias All good for me, I am adding a post merge LGTM

stevea78 pushed a commit to stevea78/beats that referenced this pull request May 20, 2018
…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.
stevea78 pushed a commit to stevea78/beats that referenced this pull request May 20, 2018
…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.
@urso urso deleted the autodiscover-runner-setup branch February 19, 2019 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants