Skip to content

Initial support for experimental features within Data Prepper plugins.#6811

Merged
dlvenable merged 3 commits intoopensearch-project:mainfrom
dlvenable:experimental-features
May 6, 2026
Merged

Initial support for experimental features within Data Prepper plugins.#6811
dlvenable merged 3 commits intoopensearch-project:mainfrom
dlvenable:experimental-features

Conversation

@dlvenable
Copy link
Copy Markdown
Member

@dlvenable dlvenable commented May 1, 2026

Description

With this change plugin authors can add an @Experimental annotation to configuration fields where the default value is null. This works well especially for nested configurations. If the @Experimental has a non-default, it will violate the validation for now.

The approach to implementing this is to expand our Hibernate Validator to be able to get custom ConstraintValidator instances from the Spring application context. This adds an ExperimentalFeatureValidator which implements ConstraintValidator for the @Experimental annotation. This allows data-prepper-api to retain the @Experimental annotation but not have any knowledge of how the constraint is implemented.

This solution builds on the work for #2695, but extends it to features within plugins. For now, I've taken the approach that you must enable_all experimental plugins and features for this to work.

I plan to use this to implement pull-based ingestion per #6796 without creating a strict change to the opensearch plugin.

Issues Resolved

N/A

Note on backward compatibility

This changes adds new annotation elements to @Experimental. These elements were flagged by japicmp as incompatible. This is probably strictly true at a byte-code level. They generate abstract methods. However, the Java runtime automatically implements these. As these elements all have default values, Java will give expected values.

I have excluded these methods from the backward compatibility checks to resolve this.

There is a related issue for japicmp: siom79/japicmp#249

Also, JUnit hit this problem and solved it in a similar way per this comment.

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

This allows plugin authors to add an @experimental annotation to configuration fields where the default value is null. This works well especially for nested configurations.

The approach to implementing this is to expand our Hibernate Validator to be able to get custom ConstraintValidator instances from the Spring application context. This adds an ExperimentalFeatureValidator which implements ConstraintValidator for the @experimental annotation. This allows data-prepper-api to retain the @experimental annotation but not have any knowledge of how the constraint is implemented.

Signed-off-by: David Venable <dlv@amazon.com>
@dlvenable dlvenable force-pushed the experimental-features branch from 8a05cf9 to 2655a78 Compare May 1, 2026 16:29
…ompatibility test.

These elements are not breaking backward compatibility. They have default values and Java handles them at runtime. However, the byte code does generate abstract methods, which are generally backward incompatible. That is why it is flagged as a breaking change.

Signed-off-by: David Venable <dlv@amazon.com>
}


tasks.named('validateCompatibility') {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the PR description for details on this change.

final ConstraintValidator<?, ?> instance = objectUnderTest.getInstance(constraintValidator.getClass());

assertThat(instance, notNullValue());
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add unit tests for releaseInstance method

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@divbok , That is good feedback.

I also refactored the code some to support dependency injection and to improve the tests for this class.

…ors the class to support dependency injection for cleaner testing.

Signed-off-by: David Venable <dlv@amazon.com>
@dlvenable dlvenable added this to the v2.16 milestone May 6, 2026
@dlvenable dlvenable merged commit e33821d into opensearch-project:main May 6, 2026
78 of 81 checks passed
@dlvenable dlvenable deleted the experimental-features branch May 6, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants