-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add failure entity for incomplete events #886
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the current design could be simplified.
We have:
BadRow
FailureEntity
BadRowWithFailureEntities
that contains bothSchemaViolationWithExtraContext
that contains part of aBadRow
and part of aFailureEntity
This is due to the fact the information contained in a BadRow
isn't always enough to build a FailureEntity
.
But the information from the FailureEntity
s is enough to reconstruct a bad row. So it's possible to do the other way around: to use FailureEntity
s as a basis and to build a BadRow
when we need it. This removes the need for other classes/wrappers.
What do you think of this alternative approach @spenes ?
...n/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/AtomicFields.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala
Outdated
Show resolved
Hide resolved
Thanks for the review @benjben! I see a few problems with the approach you suggested. First, I think it is hard to reconstruct I agree wrappers doesn't look pretty but this is kinda necessary workaround for this feature.
I agree with your comment about |
There are 3 steps that can produce a bad row:
Each of these steps would now return a With this approach it is all about the mapping function from
No, we'd leave |
38e0a96
to
36fc8fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great @spenes ! And great work on the testing 👍
I think that we can still simplify the design a bit by getting rid of IntermediateBadRow
and by using IorT.fold
.
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/FailureEntity.scala
Outdated
Show resolved
Hide resolved
.../test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/FailureEntitySpec.scala
Outdated
Show resolved
Hide resolved
.../test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/FailureEntitySpec.scala
Outdated
Show resolved
Hide resolved
...common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala
Outdated
Show resolved
Hide resolved
...common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala
Show resolved
Hide resolved
...common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala
Outdated
Show resolved
Hide resolved
f229016
to
247542f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great @spenes ! There is one last important change needed and we're good ! 🥳
.../main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala
Outdated
Show resolved
Hide resolved
.../main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @spenes !
val derivedContexts = enrichmentResult.leftMap { ll => | ||
ll.flatten.toList | ||
.map(_.toSDJ(timestamp, processor)) | ||
}.merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice !
Remove this after failure entity schema is merged
With this commit, failure entities are started to be attached to incomplete events as derived contexts. There are some cases that we need more information than in the bad rows to create failure entities therefore it isn't possible to create failure entities from bad rows directly. For this purpose, we created wrapper classes to attach extra information about failure entities.
23b1237
to
c4ab89b
Compare
Failure entities are started to be attached to incomplete events as derived contexts.
There are some cases that we need more information than in the bad rows to create failure entities therefore it isn't possible to create failure entities from bad rows directly. For this purpose, we created wrapper classes to attach extra information about failure entities.