Skip to content

Support automatic plugin loading in Data Prepper core #4838

Closed

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.

Activity

  1. added
    maintenanceIssues to help maintain the project, such as improving builds, testing, etc.
    on Aug 15, 2024
  2. self-assigned this
    on Sep 3, 2024
  3. chenqi0805 commented on Sep 17, 2024

    @chenqi0805
    Collaborator

    @dlvenable I have a slightly different proposal which makes implementation easier without intrusive change in data-prepper-core:

    We will keep the original

    @JsonProperty("action")
    @NotNull
    @UsesDataPrepperPlugin(pluginType = AggregateAction.class)
    private PluginModel aggregateAction; 
    

    Then we will register a custom deserializer and schema generator for PluginModel.class.

    • The schema generator will identify the PluginModel type, retrieves its pluginType in the annotation and then pull the schemas of each option (implementation on AggregateAction) model configuration.
    • The custom deserializer will validate PluginModel::name against the allowed pluginName in the pluginType of the annotation (allowed plugin names can be retrieved through reflection since they are implementations of the AggregateAction interface)
  4. dlvenable commented on May 20, 2026

    @dlvenable
    MemberAuthor

    @chenqi0805 , The problem with that alternative is that the top-level plugin still doesn't have the interface it needs. Ultimately it needs to call getAggregateAction() and get a AggregateAction interface - not a PluginModel.

    Consider the aggregate processor. It has this line:

    It really should be:

    this.aggregateAction = config.getAggregateAction();
    

    To support this, the configs need to have:

    private AggregateAction aggregateAction;
    
    public AggregateAction getAggregateAction() {
      return aggregateAction;
    }
    
  5. added a commit that references this issue on May 22, 2026
    163d99c
  6. added this to the v2.16 milestone on May 28, 2026
  7. added a commit that references this issue on May 29, 2026
    a18b56c
  8. added a commit that references this issue on Jul 1, 2026
    0b7fd0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions