Skip to content
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

ENH: collect plugin config and loading errors during data prepper launch #4816

Conversation

chenqi0805
Copy link
Collaborator

@chenqi0805 chenqi0805 commented Aug 8, 2024

Description

This PR collects all plugin validation and loading errors when launching data prepper. With this change, user can peek a more complete list of plugin errors due to plugin misconfigurations during data prepper launch.

Issues Resolved

Resolves #[Issue number to be closed when this PR is merged]

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.

Signed-off-by: George Chen <qchea@amazon.com>
Signed-off-by: George Chen <qchea@amazon.com>
Signed-off-by: George Chen <qchea@amazon.com>
Signed-off-by: George Chen <qchea@amazon.com>
kkondaka
kkondaka previously approved these changes Aug 19, 2024
final StringBuilder message = new StringBuilder();
if (pipelineName != null) {
message.append(pipelineName);
message.append(PIPELINE_DELIMITER);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: ERROR_MESSAGE_DELIMITER?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is between pipeline and plugin so that is why it is called pipeline DELIMITER.

return pluginFactory.loadPlugin(Source.class, sourceSetting);
} catch (Exception e) {
final PluginError pluginError = PluginError.builder()
.pipelineName(pipelineName)
Copy link
Member

Choose a reason for hiding this comment

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

Should we include the "componentType?" That is, source, processor, sink, buffer`?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the catch! Will add that

final StringBuilder message = new StringBuilder();
Throwable throwable = exception;

while (throwable != null) {
Copy link
Member

Choose a reason for hiding this comment

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

We should revisit this in the future. I think ideally, the failure gives a single clear message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. Right now some runtime exception does need going down a few layers to get the useful root cause

.stream().filter(pluginError -> pipelineName.equals(pluginError.getPipelineName()))
.collect(Collectors.toList());
if (!subPipelinePluginErrors.isEmpty()) {
throw new InvalidPluginConfigurationException(
Copy link
Member

Choose a reason for hiding this comment

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

Where is this caught and handled?

It may make sense to have a single class to take all the errors and consolidate them. Also, multiple pipelines may fail.

And is this the way we want to log it? This will likely create a single long, multi-line log. But, would it be clearer to have multiple log lines?

I'd probably throw an exception that includes a list of PluginError and then have a single class for handling errors which can then decide how to format and log these.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is actually caught and handled in L197

I'd probably throw an exception that includes a list of PluginError and then have a single class for handling errors which can then decide how to format and log these.

Agree this part can be further refactored

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

opened a separate issue to track: #4854

Signed-off-by: George Chen <qchea@amazon.com>
Signed-off-by: George Chen <qchea@amazon.com>
Copy link
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

Let's try to get #4854 resolved before we release this in 2.10.

@chenqi0805 chenqi0805 merged commit 0387808 into opensearch-project:main Aug 21, 2024
45 of 47 checks passed
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.

4 participants