Refactor: Renaming prospector to input#6078
Refactor: Renaming prospector to input#6078ruflin merged 3 commits intoelastic:masterfrom ph:refactor/type-aliasing-input
Conversation
|
Missed the docker compose commit. . . |
ruflin
left a comment
There was a problem hiding this comment.
Change looks good to me. The only thing missing from my perspective is some system tests that validate that the old options are still working as expected. As this is a pretty major change without expecting to break BC we should make sure the old options still work as intended and deprecated messages are logged as expected to make sure users knows about it.
filebeat/beater/filebeat.go
Outdated
There was a problem hiding this comment.
Can you add some system tests with the old config options to make sure this works as expected? We have done this for previous renamings and I think it's pretty useful to make sure it actually works and be remembered that we break something, when we remove it.
There was a problem hiding this comment.
Of course, I was planning to do it in a dedicated PR, because right now all the tests use the old config options :)
There was a problem hiding this comment.
SGTM. Didn't realise it's all on the old config. Good to know.
filebeat/channel/factory.go
Outdated
There was a problem hiding this comment.
In case the comment is correct, this is a breaking change of the data format I think.
There was a problem hiding this comment.
Why its a breaking changes? The name of the private struct changed and the only the comment changed?
There was a problem hiding this comment.
Only indirectly breaking if the comment is correct. I assume when looking at it that you removed prospector.type from the event, but you copied it to input.type.
There was a problem hiding this comment.
I did not remove the prospector.type in the event. https://github.com/elastic/beats/pull/6078/files#diff-b6244e3a701e1fad9969756499d1e8fcR99
filebeat/channel/factory.go
Outdated
There was a problem hiding this comment.
Could we call this event.type instead if we already duplicate the field? Thinking of ECS here.
There was a problem hiding this comment.
I can change it to event.type, I would prefer to not mix concerns of ECS, but since we already add this fields it should be OK.
filebeat/config/config.go
Outdated
There was a problem hiding this comment.
Some system tests for this would also be nice.
filebeat/config/config.go
Outdated
There was a problem hiding this comment.
Nit but code wise I would prefer if you would do here what you did above which is copying tmpConfig.Filebeat.Prospectors to tmpConfig.Filebeat.Inputs and then not do an else. Like this when the code is removed later, nothing changes in the "correct" code.
There was a problem hiding this comment.
I have the same logic there https://github.com/elastic/beats/pull/6078/files/c2b149f7d67b082b20f8201db719ba1c01755683#diff-7a00b9fb331934c8b3bb7cf5eac57576R37, So I will remove both.
There was a problem hiding this comment.
nevermind, my previous comments, I understand your proposal.
filebeat/docker-compose.yml
Outdated
There was a problem hiding this comment.
What is the reason you changed this back?
There was a problem hiding this comment.
I shouldn't have changed this.
filebeat/fileset/config.go
Outdated
There was a problem hiding this comment.
I have added unit test for this path, which are a lot simplier than integration test.
There was a problem hiding this comment.
There was a problem hiding this comment.
The part which I think unit tests here can't cover is to check if it's logged correctly. +1 on the unit test.
filebeat/input/input.go
Outdated
There was a problem hiding this comment.
I assume that code is mostly copy/paste/rename
There was a problem hiding this comment.
Exact, this should be as is.
filebeat/prospector/prospector.go
Outdated
There was a problem hiding this comment.
Do you really want to add this build flag as we already require Golang 1.9 for beats. Not having it would make us detect if by accident something is built previous to 1.9 and have an error.
There was a problem hiding this comment.
We do require golang 1.9, but after looking at it I am not sure we enforce it the correct way.
go version
go version go1.8.3 darwin/amd64
This is with the pragma build go1.9
make
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2018-01-16T14:18:24Z -X github.com/elastic/beats/libbeat/version.commit=c2b149f7d67b082b20f8201db719ba1c01755683"
fileset/factory.go:7:2: no buildable Go source files in /Users/ph/go/src/github.com/elastic/beats/filebeat/prospector
make: *** [filebeat] Error 1
This is without the pragma build go1.9
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2018-01-16T14:18:42Z -X github.com/elastic/beats/libbeat/version.commit=c2b149f7d67b082b20f8201db719ba1c01755683"
# github.com/elastic/beats/libbeat/logp
../libbeat/logp/logger.go:8: syntax error: unexpected = in type declaration
make: *** [filebeat] Error 2
|
@ruflin I have updated and fixed a few of your concerns. Also I didn't update the json expected file, they will come in specific PR for each of the prospector. (re: this concern the event.type) |
|
@ruflin minus the rebase, anything else you need on this PR? |
ruflin
left a comment
There was a problem hiding this comment.
LGTM. I added the label in progress to make sure it does not get merged before we do the next bulk backport to 6.x.
Can you add a CHANGELOG entry and squash the commits?
filebeat/fileset/config.go
Outdated
There was a problem hiding this comment.
The part which I think unit tests here can't cover is to check if it's logged correctly. +1 on the unit test.
filebeat/prospector/prospector.go
Outdated
There was a problem hiding this comment.
Good timing that Golang 1.9 added this :-)
|
@ruflin Rebased and changelog added. |
|
@ph There seem to be some issues on CI (I looked up the commit id). |
This refactor rename the prospector type to the input type, this allow this project to be more aligned with Logstash naming convention and also remove some of the last naming legacy of the `logstash fowarder`. The input name is also more appropriate for the UDP and the Redis code. The prospectors are now moved to the `input` folder. Backward compatibility is keep by using type aliasing over the older `prospector` types. Logs statements were also changed to reflect this refactor. Currently all the code and YAML are still using the *prospector(s)* keys, but other PRs will move the usage to the inputs. If the `input(s)` are present we will use them instead of the *prospectors* key.
|
@ruflin I have fixed the keystore issue, added the |
|
Small PR for @ph, big step for Filebeat 🎉 |
This commit revert the decision done in #6078 and will use `input.type` to replace the `prospector.type`
This got renamed in Beats 6.3: elastic/beats#6078
* Rename beat prospectors to inputs This got renamed in Beats 6.3: elastic/beats#6078 * Add graylog fields to beats default templates The collector "Show messages" button links to a search for a matching `gl2_source_collector`. Thus we need to define these fields in every beats configuration. Furthermore, we need to set `fields_under_root` because the new Beats input does not strip away the "fields_" prefix for us. Only "Beats Legacy" does that. * Add filebeat and winlogbeat default template Provide users with a sensible default template to get them started. * Fix template variable name It's called sidecarVersion now.

This is the first PR to refactor the usage of the
prospectortype to theinputtype, the code uses type aliasing to allow the input and the prospector to continue to work in parallel, providing an easier update path to the community beats. We have build pragma option to make sure we cannot compile this project if you are using an older version of go.The prospector code didn't change in this PR, they were just moved into the input directory and still use the old prospector type.
Changes that will come after:
Note: for clarity I didn't merge the commits in this PR before the review.
This is a followup of #5944