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

Check for removed settings on startup #4726

Merged
merged 1 commit into from
Jul 24, 2017
Merged

Conversation

urso
Copy link

@urso urso commented Jul 20, 2017

  • Introduce cfgwarn package
  • move Beta/Deprecated/Experimental to from logp to cfgwarn
  • introduce CheckRemoved5xSettings looking for removed settings in a config object + constructs an error message with completely expanded setting name
  • use CheckRemoved5xSettigns in libbeat/filebeat/metricbeat to fail on startup if any settings removed by publisher refactoring is used
  • Add system tests for libbeat/filebeat/metricbeat checking removed settings are correctly identified.

@urso urso force-pushed the enh/warn-removed-cfg branch from ddc45d7 to 87c6438 Compare July 20, 2017 21:40
@urso urso added the review label Jul 20, 2017
@urso urso mentioned this pull request Jul 20, 2017
22 tasks
)

// Beta logs the usage of an beta feature.
func Beta(format string, v ...interface{}) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems to me this part would be more belong into logp?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with both locations, but I'm also curious why it got moved.

Copy link
Author

Choose a reason for hiding this comment

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

I introduced package cfgwarn to combine all configuration related warning messages in. Plus I find logp kind of messy right now.

"github.com/joeshaw/multierror"
)

func CheckRemoved5xSettings(cfg *common.Config, settings ...string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need the 5x in the name? looks liek this is a generic function.

Copy link
Author

Choose a reason for hiding this comment

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

I named it 5x so we can remove all references to 5.x at once (Just delete the function and compiler will tell you all places you have to modify).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Works for me for the moment. i think we can use such a method in a more generic way as this is no the only time we remove settings. Something like CheckRemoveSettings() and the one here with 5x is just a proxy for it.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it's not the only time we remove settings. But at some point in time I want to remove the messages (e.g. on 7.x release remove the 5.x checks). Being able to remove messages/warnings is the motivation for naming this 5x

"metricbeat.modules.0.filters.0.include_fields='field1,field2'"
])
assert exit_code == 1
assert self.log_contains("setting 'metricbeat.modules.0.filters'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Since filters is now renamed, can you update the default config files here and here.

@urso urso force-pushed the enh/warn-removed-cfg branch from d363445 to f056919 Compare July 21, 2017 13:26
# - include_fields:
# fields: ["stats"]
# fields: ["beat", "metricset", "redis.info.stats"]
Copy link
Author

Choose a reason for hiding this comment

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

The publisher pipeline right now applies processors after having constructed the complete event. The disadvantage is, when using include_fields, one must configure all event fields. Having to configure the full field name to keep is quite an advantage I think, as we also document the full field names in our reference.

Considering a change in the processors order, by applying the processors before adding beats fields like beat or metricset. For metricbeat this would require some refactoring such that each metricbeat has it's own beat.Client instance (right now all metricsets share one beat.Client by forwarding events to another go-routine). Then constant fields like metricset can be added by the publisher pipeline by configuring the ClientConfig.Fields = common.MapStr { "metricset": ... }.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is quite a breaking change i think. Meaning if someone use fields: ["abc"] before and keeps the config, it will now remove many more fields.

Copy link
Author

Choose a reason for hiding this comment

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

Right. This is what I'm saying. That's why I'm considering the changes to metricbeat and processors order in the publisher. Maybe we also want to introduce some whitelisting (fields that can not be removed).

@urso urso force-pushed the enh/warn-removed-cfg branch 3 times, most recently from c2f2654 to 08ebd20 Compare July 24, 2017 12:52
- introduce cfgwarn package:
  - use Beta, Experimental, Deprecated from cfgwarn package
  - use cfgwarn.CheckRemoved5xSettings for all settings removed by
    publisher pipeline refactoring
  - introduce system tests checking for removed settings being correctly
    reported on startup
@urso urso force-pushed the enh/warn-removed-cfg branch from 08ebd20 to ad0a3d2 Compare July 24, 2017 13:07
@tsg tsg merged commit a6db491 into elastic:master Jul 24, 2017
@urso urso deleted the enh/warn-removed-cfg branch February 19, 2019 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants