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

Update metricbeat to use new publisher API #4699

Merged
merged 7 commits into from
Jul 19, 2017

Conversation

urso
Copy link

@urso urso commented Jul 18, 2017

  • update metricbeat to use new publisher API
  • remove NewModules, NewWrappers... in favor of single instance constructors NewModule, NewWrapper, ...
  • rename setting filters to processors (consistent with other beats)
  • move fields, tags and processors to publisher pipeline (-> processors will handle complete event)
  • adjust unit + integration tests

@urso urso added in progress Pull request is currently in progress. Metricbeat Metricbeat refactoring labels Jul 18, 2017
@urso urso mentioned this pull request Jul 18, 2017
22 tasks
@urso urso force-pushed the pipeline/metricbeat branch from c43890c to bf27d72 Compare July 18, 2017 23:43
@urso urso force-pushed the pipeline/metricbeat branch from afc6c2b to c8bda89 Compare July 19, 2017 13:29
@urso urso changed the title [WIP] Update metricbeat to use new publisher API Update metricbeat to use new publisher API Jul 19, 2017
@urso urso added review and removed in progress Pull request is currently in progress. labels Jul 19, 2017
func NewModules(config []*common.Config, r *Register) (map[Module][]MetricSet, error) {
if config == nil || len(config) == 0 {
return nil, ErrEmptyConfig
// returns a the Modules and its configured MetricSets or an error.
Copy link
Member

Choose a reason for hiding this comment

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

s/a the Modules/a Module/ - It should be singular in this context.

Copy link
Author

Choose a reason for hiding this comment

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

argh... copy'n paste

// returns a the Modules and its configured MetricSets or an error.
func NewModule(config *common.Config, r *Register) (Module, []MetricSet, error) {
if !config.Enabled() {
return nil, nil, nil
Copy link
Member

Choose a reason for hiding this comment

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

WDYT about returning an error in this case? Without an error callers always need to check if Module is non-nil.

Copy link
Author

Choose a reason for hiding this comment

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

Yep, that's on purpose, but an value would make sense.

Module string `config:"module" validate:"required"`
MetricSets []string `config:"metricsets" validate:"required"`
Enabled bool `config:"enabled"`
Filters processors.PluginConfig `config:"filters"`
Copy link
Member

Choose a reason for hiding this comment

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

So filters is now processors? I think it would be beneficial to users to Validate() that filters is not set. If it is set then include in the error that they should be using processors.

Copy link
Member

Choose a reason for hiding this comment

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

We'll need documentation updates too for this since filters is gone? If so please drop a note into #4540.

Copy link
Author

Choose a reason for hiding this comment

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

See: #4598 . All this is already on the todo list.

Copy link
Member

Choose a reason for hiding this comment

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

Great, I didn't see that.

"github.com/elastic/beats/libbeat/publisher/beat"
)

// Connector configures an establishes a beat.Client for publishing events
Copy link
Member

Choose a reason for hiding this comment

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

s/an/and/?

Copy link
Author

Choose a reason for hiding this comment

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

yep

event = common.MapStr{} // TODO (akroh): do we want to send an empty event field?
fields := b.Event
if fields == nil {
fields = common.MapStr{} // TODO (akroh): do we want to send an empty event field?
Copy link
Member

Choose a reason for hiding this comment

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

Could you please remove this comment. This seems to be well established behavior at this point.

Copy link
Author

Choose a reason for hiding this comment

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

k

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM, WFG.

@andrewkroh andrewkroh merged commit a6f43f8 into elastic:master Jul 19, 2017
@tsg tsg mentioned this pull request Jul 24, 2017
28 tasks
@urso urso deleted the pipeline/metricbeat branch February 19, 2019 18:27
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.

2 participants