Is your feature request related to a problem? Please describe.
Data Prepper plugins can depend on other Data Prepper plugins. They load these plugins manually using the PluginModel.
This results in duplicated logic such as the following:
|
private AggregateAction loadAggregateAction(final PluginFactory pluginFactory) { |
|
final PluginModel actionConfiguration = aggregateProcessorConfig.getAggregateAction(); |
|
final PluginSetting actionPluginSetting = new PluginSetting(actionConfiguration.getPluginName(), actionConfiguration.getPluginSettings()); |
|
return pluginFactory.loadPlugin(AggregateAction.class, actionPluginSetting); |
|
} |
More importantly, it is also not compatible with our new support for schema and documentation generation.
Describe the solution you'd like
Provide a feature in Data Prepper core for loading plugins on behalf of other plugins. Data Prepper can have a new @UsesDataPrepperPlugin annotation which states that the type is a Data Prepper plugin.
In plugin configurations, use the desired plugin interface type. For example, replace
|
@JsonPropertyDescription("The action to be performed on each group. One of the available aggregate actions must be provided, or you can create custom aggregate actions. remove_duplicates and put_all are the available actions. For more information, see Creating New Aggregate Actions.") |
|
@JsonProperty("action") |
|
@NotNull |
|
private PluginModel aggregateAction; |
with:
@JsonProperty("action")
@NotNull
@UsesDataPrepperPlugin
private AggregateAction aggregateAction;
When loading plugins in Data Prepper core, detect this annotation and load the plugin.
Is your feature request related to a problem? Please describe.
Data Prepper plugins can depend on other Data Prepper plugins. They load these plugins manually using the
PluginModel.This results in duplicated logic such as the following:
data-prepper/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessor.java
Lines 83 to 87 in 91b6666
More importantly, it is also not compatible with our new support for schema and documentation generation.
Describe the solution you'd like
Provide a feature in Data Prepper core for loading plugins on behalf of other plugins. Data Prepper can have a new
@UsesDataPrepperPluginannotation which states that the type is a Data Prepper plugin.In plugin configurations, use the desired plugin interface type. For example, replace
data-prepper/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorConfig.java
Lines 31 to 34 in 91b6666
with:
When loading plugins in Data Prepper core, detect this annotation and load the plugin.