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: error message in pipeline and plugin deserialization #5459

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chenqi0805
Copy link
Collaborator

@chenqi0805 chenqi0805 commented Feb 24, 2025

Description

This PR enhances the error message in pipeline and plugin deserialization.

  • fix null value handling in DataPrepperDurationParser
    before
waf-access-log-pipeline.source.s3: caused by: Parameter "sqs.visibility_timeout" for plugin "s3" is invalid: text

after

waf-access-log-pipeline.source.s3: caused by: Parameter "sqs.visibility_timeout" for plugin "s3" is invalid: Durations must use either ISO 8601 notation or simple notations for seconds (60s) or milliseconds (100ms). Whitespace is ignored.
  • simplify pipeline and plugin deserialization error message from Jackson by adding DataPrepperDeserializationProblemHandler
    1. handleWeirdStringValue
      before:
waf-access-log-pipeline.source.s3: caused by: Parameter "sqs.visibility_duplication_protection" for plugin "s3" is invalid: Cannot deserialize value of type `java.lang.Boolean` from String "xy": only "true" or "false" recognized
 at [Source: UNKNOWN; byte offset: #UNKNOWN]

after:

waf-access-log-pipeline.source.s3: caused by: Parameter "sqs.visibility_duplication_protection" for plugin "s3" is invalid: Cannot deserialize value of type `java.lang.Boolean` from String "xy": only "true" or "false" recognized
2. handleMissingInstantiator

before:

waf-access-log-pipeline.processor.truncate: caused by: Parameter "entries.null" for plugin "truncate" is invalid: Cannot construct instance of `org.opensearch.dataprepper.plugins.processor.truncate.TruncateProcessorConfig$Entry` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('rand')

after:

waf-access-log-pipeline.processor.truncate: caused by: Parameter "entries.null" for plugin "truncate" is invalid: Cannot deserialize 'rand' into 'org.opensearch.dataprepper.plugins.processor.truncate.TruncateProcessorConfig$Entry'
3. handleUnexpectedToken

before:

waf-access-log-pipeline.source.s3: caused by: Parameter "sqs.visibility_duplication_protection" for plugin "s3" is invalid: Cannot deserialize value of type `java.lang.Boolean` from Array value (token `JsonToken.START_ARRAY`)

after:

waf-access-log-pipeline.source.s3: caused by: Parameter "sqs.visibility_duplication_protection" for plugin "s3" is invalid: Cannot deserialize value of type `java.lang.Boolean` from Array value.

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>
@graytaylor0
Copy link
Member

What are some examples of what certain errors based on the configuration will look like?

@chenqi0805
Copy link
Collaborator Author

What are some examples of what certain errors based on the configuration will look like?

@graytaylor0 I updated the description with some typical examples

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