-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[WIP] Migrate to the new registry #7803
Conversation
Use a global registry and the feature bundle.
Since a go plugin only works with a specific of golang and beats we can change the return value without changing the signature.
The autodiscovery feature was defining 3 customs registry, this PR do the following: - Provider, Appender and Builder now users the feature registry. - It move the Factory type into their right package. - Config are now inside their own package. - Use the same naming for finding factories and building object. - type aliasing is in place to make the transition smoother for types. - A shim is in place that will proxy the registry of plugin to the global registry. - package.Plugin methods are now returning a feature instead of a hashmap.
// feature are grouped by namespace, a namespace is a kind of plugin like outputs, inputs, or queue. | ||
// The feature name must be unique. | ||
type registry struct { | ||
type FeatureRegistry struct { |
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.
type name will be used as feature.FeatureRegistry by other packages, and that stutters; consider calling this Registry
// feature are grouped by namespace, a namespace is a kind of plugin like outputs, inputs, or queue. | ||
// The feature name must be unique. | ||
type registry struct { | ||
type FeatureRegistry struct { |
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.
type name will be used as feature.FeatureRegistry by other packages, and that stutters; consider calling this Registry
I've made a shims over the old registry and trid to minimize the changes needed to make it work, the RegisterActive will use the new registration behind the scene.
|
||
type Registrar struct { | ||
modules map[string]entry | ||
type TaskRunner interface { |
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.
exported type TaskRunner should have comment or be unexported
on error since the majority of error is handled at the registry level.
|
||
var Registry = newRegistrar() | ||
type JobRunner func() (beat.Event, []JobRunner, error) |
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.
exported type JobRunner should have comment or be unexported
I am closing this and will reopen a new one. |
Related PR for the documentation: #7392
Migration:
Notes TBD in another PR.: