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
Check fields type and format #13188
Check fields type and format #13188
Changes from 10 commits
9b1ae19
e5e3aa0
3edaec9
278cc4c
95e2003
8ab0b49
64483f5
fffee3a
1bf0193
078e26d
e114175
4415247
29bad0c
b339108
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
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.
What about returning here
error trying to check 'type' field in 'fields.yml' fike '%s'. Check the 'fields.yml' in the module you are modifying for an incorrect or unknonwn 'type' value
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.
Ok, I have reordered error wrapping a little bit, this is what is printed now:
This is not ideal, but I haven't found a way to get more info from the underlying parsing library. In any case it is much better than what we have now.
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.
Totally agree. It's much better. Sorry for asking you a bit more 😅 maybe it's worth to just add
(source: 'beats/metricbeat/module/{your-module}/_meta/fields.yml')
or something similar. A new contributor won't know where the fields.yml is gonna be located.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 part of the message is generated by the library, we are a bit limitated by that.
Also take into account that code in this PR only checks the global
fields.yml
,fields.yml
files in modules and metricsets are not valid YAML by design, so they are not so easy to parse and check (and we don't). They are concatenated to create the globalfields.yml
and only this should be a valid YAML, but we are actually not even checking that, and this is not detected at all unless something mysteriously breaks in some integration test.In summary, yes, at the moment it is not possible to easily know the module of the fields causing the problems, but hopefully a PR will only touch a limited number of fields, so it shouldn't be so hard to spot.