Cherry-pick #16715 to 7.x: Center more functionality around RunnerFactory#18085
Merged
urso merged 1 commit intoelastic:7.xfrom Apr 29, 2020
Merged
Cherry-pick #16715 to 7.x: Center more functionality around RunnerFactory#18085urso merged 1 commit intoelastic:7.xfrom
urso merged 1 commit intoelastic:7.xfrom
Conversation
* Center more functionality around RunnerFactory Remove CheckableRunnerFactory and require RunnerFactory to implement CheckConfig. CheckableRunnerFactory more and more superseded RunnerFactory. As we want more config validation support in the future as well I combined the two into RunnerFactory Remove autodiscover.Adapter. The adapter did inherit from CheckableRunnerFactory, giving us some inheritance chain between RunnerFactory, CheckableRunnerFactory, and Adapter for autodiscovery. By removig the Adapter and CheckableRunnerFactory we have one common type (RunnerFactory) to integrate with config file reloading, static input/module setup, and autodiscovery. Add selectors for autodiscovery event selection that are used as additional parameters when creating a new Autodiscover instance. This gives us some more composability, yet I wonder if we can even remove those, as every instance of NewAutodiscover did look for events with a 'config' field of type []*common.Config. (cherry picked from commit 7a1b524)
Contributor
|
Pinging @elastic/integrations-services (Team:Services) |
Contributor
💔 Build FailedExpand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Cherry-pick of PR #16715 to 7.x branch. Original message:
What does this PR do?
Remove CheckableRunnerFactory and require RunnerFactory to implement
CheckConfig. CheckableRunnerFactory more and more superseded
RunnerFactory. As we want more config validation support in the future
as well I combined the two into RunnerFactory
Remove autodiscover.Adapter. The adapter did inherit from
CheckableRunnerFactory, giving us some inheritance chain between
RunnerFactory, CheckableRunnerFactory, and Adapter for autodiscovery.
By removig the Adapter and CheckableRunnerFactory we have one common
type (RunnerFactory) to integrate with config file reloading, static
input/module setup, and autodiscovery.
Add selectors for autodiscovery event selection that are used as
additional parameters when creating a new Autodiscover instance. This
gives us some more composability, yet I wonder if we can even remove those,
as every instance of NewAutodiscover did look for events with a 'config'
field of type []*common.Config. @exekias WDYT?
Why is it important?
The new input API will have a compatiblity layer creating a RunnerFactory. By having only one interface to integrate with, the integration will be more straight forward.
The change also makes it more clear how to integrate with autodiscovery and config file reloading, as it standardizes the two based on RunnerFactory only.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesDeveloper Docs
The types
autodiscovery.Adapterandcfgfile.CheckableRunnerFactoryhave been removed. Helpers for creatingautodiscovery.Adapterhave been removed as well. Insteadcfgfile.RunnerFactoryrequiresCheckConfigto be implemented now.cfgfile.CheckableRunnerFactoryandcfgfile.Runnerfactory have been combined, whereas theAdapteris split intocfgfile.RunnerFactoryandautodiscover.EventConfigurer. Theautodiscover.NewAutodiscovercall now needs both, theRunnerFactoryandEventConfigurerparameters.The
(cfgfile.RunnerFactory).Createmethod now accepts abeat.PipelineConnectorinstead of abeat.Pipelineas first parameter.For example:
has become:
It is assumed that CheckConfig returns an error if the configuration does not apply. In case the factory did not support CheckConfig before, the functionality needs to be implemented like this: