Skip to content

Commit

Permalink
derived_tstamp and etl_tstamp should always be defined
Browse files Browse the repository at this point in the history
  • Loading branch information
istreeter committed Apr 18, 2024
1 parent ea86ba0 commit 3fbddea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ object SdkEvent {
case _ => None
}

val defaultEnrichment = enrichments.flatMap(_.defaultEnrichment)
val defaultEnrichment = enrichments.map(_.defaultEnrichment)
val ipEnrichment = enrichments.flatMap(_.ipEnrichment)
val urlEnrichment = enrichments.flatMap(_.urlEnrichment)
val refererEnrichment = enrichments.flatMap(_.refererEnrichment)
Expand Down Expand Up @@ -225,14 +225,14 @@ object SdkEvent {
refr_dvce_tstamp = crossDomainEnrichment.flatMap(_.refr_dvce_tstamp),
derived_contexts = el.derivedContexts.forSdkEvent,
domain_sessionid = el.u.flatMap(_.sid.map(_.toString)),
derived_tstamp = defaultEnrichment.flatMap(_.derived_tstamp),
derived_tstamp = defaultEnrichment.map(_.derived_tstamp),
event_vendor = ueVendor,
event_name = eName,
event_format = ueFormat,
event_version = ueVersion,
event_fingerprint = eventFingerprintEnrichment.flatMap(_.event_fingerprint),
true_tstamp = el.dt.flatMap(_.ttm),
etl_tstamp = defaultEnrichment.flatMap(_.etl_tstamp)
etl_tstamp = defaultEnrichment.map(_.etl_tstamp)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import org.scalacheck.Gen
import org.scalacheck.cats.implicits._

case class DefaultEnrichment(
derived_tstamp: Option[Instant],
etl_tstamp: Option[Instant]
derived_tstamp: Instant,
etl_tstamp: Instant
)

object DefaultEnrichment {
def gen: Gen[DefaultEnrichment] =
(
genInstantOpt(Instant.now),
genInstantOpt(Instant.now)
genInstant(Instant.now),
genInstant(Instant.now)
).mapN(DefaultEnrichment.apply)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.scalacheck.Gen
import org.scalacheck.cats.implicits._

final case class Enrichments(
defaultEnrichment: Option[DefaultEnrichment],
defaultEnrichment: DefaultEnrichment,
ipEnrichment: Option[IpEnrichment],
urlEnrichment: Option[UrlEnrichment],
refererEnrichment: Option[RefererEnrichment],
Expand All @@ -32,7 +32,7 @@ object Enrichments {

def gen: Gen[Enrichments] =
(
Gen.option(DefaultEnrichment.gen),
DefaultEnrichment.gen,
Gen.option(IpEnrichment.gen),
Gen.option(UrlEnrichment.gen),
Gen.option(RefererEnrichment.gen),
Expand Down

0 comments on commit 3fbddea

Please sign in to comment.