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

Make conditions in autodiscovery configs optional #9029

Merged
merged 5 commits into from
Nov 28, 2018

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Nov 10, 2018

This change lets users leave the condition option undeclared when writing autodiscover configurations. When not declared all configurations will match all events.

This also changes the type of the autodiscovery Mapper from *Mapper to Mapper. Since this type is backed by a slice, which is internally a pointer, there's no need to make it a pointer type, as it it makes the append operation awkward. If we internally mutated the slice via method's it'd make sense to keep the pointer, but we don't.

This takes over from #8897 .

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Thanks for the change, this is looking good! Left a minor comment. I think this will also need an update in docs?

@@ -42,20 +42,20 @@ type MapperSettings []*struct {
}

// NewConfigMapper builds a template Mapper from given settings
func NewConfigMapper(configs MapperSettings) (*Mapper, error) {
var mapper Mapper
func NewConfigMapper(configs MapperSettings) (mapper Mapper, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

are you using the named return values? I think that's not needed from code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It prevents me having to declare mapper on line 55 in the call to append.

@exekias
Copy link
Contributor

exekias commented Nov 23, 2018

This would close #6084, as it would make it trivial to add a last "conditionless" config. Added the needs_backport tag just in case we can get it in by 6.6

@exekias exekias added the needs_backport PR is waiting to be backported to other branches. label Nov 23, 2018
@andrewvc andrewvc added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label Nov 26, 2018
@andrewvc
Copy link
Contributor Author

@exekias I've rebased and added a small change to the docs. We never really documented conditions before, I don't think we need to explicitly say much here.

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

CHANGELOG needs a line removed I think, feel free to fix it and merge

CHANGELOG.asciidoc Outdated Show resolved Hide resolved
@exekias
Copy link
Contributor

exekias commented Nov 27, 2018

Uhm, I just saw tests are not passing, it seems related to this change

This change lets users leave the `condition` option undeclared when writing autodiscover configurations. When not declared all configurations will match all events.
@andrewvc
Copy link
Contributor Author

@exekias I believe I've fixed the issue causing the tests to fail. I've also rebased off master.

@andrewvc andrewvc merged commit a1bec73 into elastic:master Nov 28, 2018
andrewvc added a commit to andrewvc/beats that referenced this pull request Dec 4, 2018
* Make conditions in autodiscovery configs optional

This change lets users leave the `condition` option undeclared when writing autodiscover configurations. When not declared all configurations will match all events.

* Cleanup

* Fix fmt

* Fix changelog

* Fix failing conditions test

(cherry picked from commit a1bec73)
@andrewvc andrewvc added v6.6.0 and removed needs_backport PR is waiting to be backported to other branches. labels Dec 4, 2018
andrewvc added a commit that referenced this pull request Dec 4, 2018
This change lets users leave the `condition` option undeclared when writing autodiscover configurations. When not declared all configurations will match all events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement libbeat review Team:obs-ds-hosted-services Label for the Observability Hosted Services team v6.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants