Skip to content

Support automatic plugin loading in Data Prepper core #4838

@dlvenable

Description

@dlvenable

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.

Metadata

Metadata

Assignees

Labels

maintenanceIssues to help maintain the project, such as improving builds, testing, etc.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions