Port fields.yml collector to Golang#6911
Conversation
There was a problem hiding this comment.
exported function Generate should have comment or be unexported
filebeat/generator/module/module.go
Outdated
There was a problem hiding this comment.
exported function Generate should have comment or be unexported
There was a problem hiding this comment.
exported function CollectModuleFiles should have comment or be unexported
There was a problem hiding this comment.
exported function CollectFiles should have comment or be unexported
libbeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
exported function Generate should have comment or be unexported
filebeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
exported function Generate should have comment or be unexported
filebeat/cmd/generate.go
Outdated
There was a problem hiding this comment.
error strings should not be capitalized or end with punctuation or a newline
filebeat/cmd/generate.go
Outdated
There was a problem hiding this comment.
error strings should not be capitalized or end with punctuation or a newline
filebeat/cmd/generate.go
Outdated
There was a problem hiding this comment.
error strings should not be capitalized or end with punctuation or a newline
filebeat/cmd/generate.go
Outdated
There was a problem hiding this comment.
error strings should not be capitalized or end with punctuation or a newline
|
Could this PR be split up in 2 parts:
This should make reviewing easier and will separate the two different concerns. |
2530189 to
21922fd
Compare
ruflin
left a comment
There was a problem hiding this comment.
Thanks for splitting up in 2 PR's. Review is probably to early but left some notes.
This is really great as soon all the fields.yml collection is directly in golang.
filebeat/beater/filebeat.go
Outdated
There was a problem hiding this comment.
Leftover from the other PR?
filebeat/Makefile
Outdated
There was a problem hiding this comment.
Does this only support one path? I could see especially in libbeat or filebeat that a module, processor and inputs have fields.yml.
There was a problem hiding this comment.
Yes, but it can be changed easily to support lists.
heartbeat/beater/heartbeat.go
Outdated
libbeat/cmd/instance/beat.go
Outdated
There was a problem hiding this comment.
Probably also part of the other PR?
21922fd to
05cb292
Compare
|
I removed the leftovers from the other PR and added tests. However, I have a Winlogbeat issue I am still investigating. |
ruflin
left a comment
There was a problem hiding this comment.
As this is a breaking change for all our community beats, this should be documented on the CHANGELOG-developer with a note on how to migrate.
libbeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
Should this be uncommented or removed? Same next line.
libbeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
Should we also add a newline after to make sure it ends with a newline?
libbeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
Shouldn't the global fields.yml end up outside the _meta directory?
There was a problem hiding this comment.
In Makefiles of Beats the generated file ends up under _meta. See for example Metricbeat: https://github.com/elastic/beats/blob/master/metricbeat/Makefile#L28
There was a problem hiding this comment.
should we call this collectModuleas this is quite specific to modules?
libbeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
Is this used somewhere except for the tests? Should this be moved to the tests?
05cb292 to
92e2e85
Compare
libbeat/generator/fields/fields.go
Outdated
There was a problem hiding this comment.
exported type YmlFile should have comment or be unexported
|
I tried the code locally by run |
|
An other thing I spotted when testing is that the indentation of |
|
Yes, I started to refactor the code, so things got messed up and a few things are not working properly. I will ping you when it's ready for a next round of review. |
11f5363 to
f59fd4b
Compare
|
@ruflin I fixed the problems in the code. It should be ready to be reviewed. |
|
@kvch Could you have a look at the generator tests? The change seems to break it. |
2c5415d to
133509e
Compare
91794a4 to
e982a79
Compare
per elastic/beats#6911 set FIELDS_FILE_PATH accordingly.
* use beats provided fields target per elastic/beats#6911 set FIELDS_FILE_PATH accordingly. * Update beats framework to 245b3e1 * removes fields target from top-level Makefile * vendors github.com/elastic/beats/libbeat/generator/fields * cleans up github.com/ericchiang/k8s/...
Existing Python and shell code is ported to Golang. The previous Beat specific field collection is is generalized and moved to the
Makefileoflibbeat. A new variable is added to makefiles:FIELDS_FILE_PATH. This specifies wherefields.ymlare.Misc
fields_base.ymlis renamed tofields.common.ymlto be the same as in other BeatsBreaking change for community Beats
If your Beat has partial
fields.ymlfiles which need to be collected bymake update, please fill in theFIELDS_FILE_PATHvariable in yourMakefilewith the root directory of your fields files.If you need a custom collector function you can implement it
module_fields_collector.gowith the following type signature: