Skip to content

Commit

Permalink
fix: DataCollectorHook event time converted to seconds (#2750)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustinasrce authored Dec 4, 2024
1 parent bafe9dc commit 61dc4bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DataCollectorHook<T>(private val collectorManager: DataCollectorManager) :
) {
val event = Event(
contextKind = "user",
creationDate = Date().time,
creationDate = Date().time / 1000L,
key = ctx.flagKey,
kind = "feature",
userKey = ctx.ctx?.getTargetingKey(),
Expand All @@ -29,7 +29,7 @@ class DataCollectorHook<T>(private val collectorManager: DataCollectorManager) :
override fun error(ctx: HookContext<T>, error: Exception, hints: Map<String, Any>) {
val event = Event(
contextKind = "user",
creationDate = Date().time,
creationDate = Date().time / 1000L,
key = ctx.flagKey,
kind = "feature",
userKey = ctx.ctx?.getTargetingKey(),
Expand All @@ -40,4 +40,4 @@ class DataCollectorHook<T>(private val collectorManager: DataCollectorManager) :
)
collectorManager.addEvent(event)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GoFeatureFlagApiTest {
private var defaultEventList: List<Event> = listOf(
Event(
contextKind = "contextKind",
creationDate = 1721650841108,
creationDate = 1721650841,
key = "flag-1",
kind = "feature",
userKey = "981f2662-1fb4-4732-ac6d-8399d9205aa9",
Expand Down Expand Up @@ -140,4 +140,4 @@ class GoFeatureFlagApiTest {
val got = recordedRequest.body.readUtf8()
JSONAssert.assertEquals(want, got, false)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"events": [
{
"contextKind": "contextKind",
"creationDate": 1721650841108,
"creationDate": 1721650841,
"key": "flag-1",
"kind": "feature",
"userKey": "981f2662-1fb4-4732-ac6d-8399d9205aa9",
Expand All @@ -11,7 +11,7 @@
"variation": "enabled"
}
],
"metadata": {
"meta": {
"provider": "android",
"openfeature": "true"
}
Expand Down

0 comments on commit 61dc4bc

Please sign in to comment.