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

Switch bad row type from EnrichmentFailures to SchemaViolations for s… #883

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

benjben
Copy link
Contributor

@benjben benjben commented Feb 29, 2024

There are 3 places that currently produce an EnrichmentFailures bad row whereas the more appropriate type is SchemaViolations:

  1. When the input fields of the HTTP requests are mapped to the atomic event.
  2. When the enrichments contexts get validated.
  3. When the atomic fields lengths get validated.

For 1 and 3, the error should be mapped into an Iglu ValidationError with the atomic schema referenced.

Before this change, if there was any error in the mapping of the atomic fields, a bad row would get emitted right away and we would not try to validate the entities and unstruct event. Now all these errors are wrapped inside a same SchemaViolations bad row.

Likewise, before this change when an enrichment context was invalid, we were emitting a bad row right away and not checking the lengths of the atomic fields. Now all these errors are wrapped inside a same SchemaViolations bad row.

Copy link
Contributor

@istreeter istreeter left a comment

Choose a reason for hiding this comment

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

Looks good @benjben!

Regarding my suggested improvement... I have not assessed this needs changing in more places than just the place I highlighted. If you assess that it stretches far beyond just the bits of code that you changed here, then maybe it needs to be its own separate commit.

(Or, of course, reject my idea outright)

@benjben benjben requested a review from istreeter March 5, 2024 09:35
…ome errors

There are 3 places that currently produce an EnrichmentFailures bad row
whereas the more appropriate type is SchemaViolations:

1. When the input fields of the HTTP requests are mapped to the atomic event.
2. When the enrichments contexts get validated.
3. When the atomic fields lengths get validated.

For 1 and 3, the error should be mapped into an Iglu ValidationError
with the atomic schema referenced.

Before this change, if there was any error in the mapping of the atomic fields,
a bad row would get emitted right away and we would not try to validate
the entities and unstruct event. Now all these errors are wrapped inside
a same SchemaViolations bad row.

Likewise, before this change when an enrichment context was invalid,
we were emitting a bad row right away and not checking the lengths of
the atomic fields. Now all these errors are wrapped inside a same
SchemaViolations bad row.
@benjben benjben force-pushed the switch_to_schema_violations branch from 378fe6c to 9846a2f Compare March 7, 2024 16:20
@benjben benjben requested a review from istreeter March 7, 2024 16:23
@benjben
Copy link
Contributor Author

benjben commented Mar 7, 2024

Hey @istreeter , I addressed all your feedback, please have a look

@benjben benjben merged commit 70fd56d into develop Mar 8, 2024
1 check passed
@benjben benjben deleted the switch_to_schema_violations branch March 8, 2024 08:51
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