Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add secondary source of modules to Metricbeat to read light modules #12465
Add secondary source of modules to Metricbeat to read light modules #12465
Changes from 29 commits
c100145
8ba9a38
758afb2
0a6b190
c181e51
4ceab7b
3a1768e
5f85188
e23df08
c138347
ae9c7e2
d64ccb1
b53acb3
1e9272c
a25ec8c
0135353
8b8521a
29c55b2
8652a0c
db6d303
ae9e00f
3f3d046
6af6437
af38b6b
6f38790
2af1d4c
49f5648
8722e1a
6bfb015
53bbabd
a70c415
9a6c336
edcd41b
38ee770
724f41a
84cba87
9e2cdb8
d701bff
b3dbfda
f175eb5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit: naming.
cmd.ModulesManager
is somewhat generic. Consider naming the constructor based on what is going to be constructed/initialized. For exampleNewLightweightModulesManager
?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.
The only change made here is to make this method public so it can be used from x-pack,
cmd.ModulesManager
is the generic manager for modules subcommand.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.
Yeah, I noticed this symbol becoming public here. But with it becoming public, the descriptive nature of the names used is even more important (a.k.a naming is hard).
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.
I wonder if this is a save operation. Are we guaranteed to always get a copy when calling
Config
? In ModuleConfig the fields Hosts, MetricSets, and Query are not values, but shared references. The values can be replaced by new instances, but must not be modified (e.g. operations likeconfig.Query["abc"] = X
are forbidden).We call 'UnpackConfig
with target
config` a few lines down from here. Could this call overwrite entries in Hosts, MetricSets and Query?What is the expected result after UnpackConfig if Hosts/MetricSets/Query was not empty?
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.
It worked as expected on my tests, but yes, it doesn't look safe, I will try to get a better copy of this module config.
Hosts and MetricSets shouldn't be changed here, query could be, in this case the map should be merged. It may require more tests to cover these cases.
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.
This was not safe, and this was actually not needed as we copy from the raw config later. I have extended the tests to check that original base module is not modified, and that we apply the overrides in the case of query.