Skip to content

Commit 61dc4bc

Browse files
fix: DataCollectorHook event time converted to seconds (#2750)
1 parent bafe9dc commit 61dc4bc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

openfeature/providers/kotlin-provider/gofeatureflag-kotlin-provider/src/main/java/org/gofeatureflag/openfeature/hook/DataCollectorHook.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DataCollectorHook<T>(private val collectorManager: DataCollectorManager) :
1414
) {
1515
val event = Event(
1616
contextKind = "user",
17-
creationDate = Date().time,
17+
creationDate = Date().time / 1000L,
1818
key = ctx.flagKey,
1919
kind = "feature",
2020
userKey = ctx.ctx?.getTargetingKey(),
@@ -29,7 +29,7 @@ class DataCollectorHook<T>(private val collectorManager: DataCollectorManager) :
2929
override fun error(ctx: HookContext<T>, error: Exception, hints: Map<String, Any>) {
3030
val event = Event(
3131
contextKind = "user",
32-
creationDate = Date().time,
32+
creationDate = Date().time / 1000L,
3333
key = ctx.flagKey,
3434
kind = "feature",
3535
userKey = ctx.ctx?.getTargetingKey(),
@@ -40,4 +40,4 @@ class DataCollectorHook<T>(private val collectorManager: DataCollectorManager) :
4040
)
4141
collectorManager.addEvent(event)
4242
}
43-
}
43+
}

openfeature/providers/kotlin-provider/gofeatureflag-kotlin-provider/src/test/java/org/gofeatureflag/openfeature/controller/GoFeatureFlagApiTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GoFeatureFlagApiTest {
2121
private var defaultEventList: List<Event> = listOf(
2222
Event(
2323
contextKind = "contextKind",
24-
creationDate = 1721650841108,
24+
creationDate = 1721650841,
2525
key = "flag-1",
2626
kind = "feature",
2727
userKey = "981f2662-1fb4-4732-ac6d-8399d9205aa9",
@@ -140,4 +140,4 @@ class GoFeatureFlagApiTest {
140140
val got = recordedRequest.body.readUtf8()
141141
JSONAssert.assertEquals(want, got, false)
142142
}
143-
}
143+
}

openfeature/providers/kotlin-provider/gofeatureflag-kotlin-provider/src/test/resources/org/gofeatureflag/openfeature/hook/valid_result.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"events": [
33
{
44
"contextKind": "contextKind",
5-
"creationDate": 1721650841108,
5+
"creationDate": 1721650841,
66
"key": "flag-1",
77
"kind": "feature",
88
"userKey": "981f2662-1fb4-4732-ac6d-8399d9205aa9",
@@ -11,7 +11,7 @@
1111
"variation": "enabled"
1212
}
1313
],
14-
"metadata": {
14+
"meta": {
1515
"provider": "android",
1616
"openfeature": "true"
1717
}

0 commit comments

Comments
 (0)