Skip to content

Commit 5ba6fec

Browse files
committed
use updated schema
1 parent 9a08dd7 commit 5ba6fec

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/aggregation/AggregationStats.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ internal class AggregationStats(
106106

107107
return FlagEvaluation(
108108
timestamp = snapshotFirst,
109-
flag = FlagEvaluation.Flag(aggregationKey.flagKey),
110-
variant = aggregationKey.variantKey?.let { FlagEvaluation.Flag(it) },
111-
allocation = aggregationKey.allocationKey?.let { FlagEvaluation.Flag(it) },
112-
targetingRule = null, // Not applicable
109+
flag = FlagEvaluation.Identifier(aggregationKey.flagKey),
110+
variant = aggregationKey.variantKey?.let { FlagEvaluation.Identifier(it) },
111+
allocation = aggregationKey.allocationKey?.let { FlagEvaluation.Identifier(it) },
112+
targetingRule = null,
113113
targetingKey = aggregationKey.targetingKey,
114114
context = eventContext,
115115
error = snapshotMessage?.let { FlagEvaluation.Error(message = it) },

features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/storage/EvaluationEventRecordWriter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import com.datadog.android.api.feature.FeatureSdkCore
1111
import com.datadog.android.api.storage.EventType
1212
import com.datadog.android.api.storage.RawBatchEvent
1313
import com.datadog.android.flags.internal.EvaluationEventWriter
14-
import com.datadog.android.flags.model.BatchedFlagEvaluations
14+
import com.datadog.android.flags.model.FlagEvaluation
1515

1616
/**
1717
* Persists serialized flag evaluation events to SDK Core storage.
@@ -20,7 +20,7 @@ import com.datadog.android.flags.model.BatchedFlagEvaluations
2020
* to the EVP intake endpoint by the SDK Core's upload mechanism.
2121
*/
2222
internal class EvaluationEventRecordWriter(private val sdkCore: FeatureSdkCore) : EvaluationEventWriter {
23-
override fun writeAll(events: List<BatchedFlagEvaluations.FlagEvaluation>) {
23+
override fun writeAll(events: List<FlagEvaluation>) {
2424
if (events.isEmpty()) return
2525

2626
sdkCore.getFeature(Feature.FLAGS_EVALUATIONS_FEATURE_NAME)

features/dd-sdk-android-flags/src/test/kotlin/com/datadog/android/flags/internal/storage/EvaluationEventRecordWriterTest.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import com.datadog.android.api.feature.FeatureSdkCore
1414
import com.datadog.android.api.storage.EventBatchWriter
1515
import com.datadog.android.api.storage.EventType
1616
import com.datadog.android.api.storage.RawBatchEvent
17-
import com.datadog.android.flags.model.BatchedFlagEvaluations
17+
import com.datadog.android.flags.model.FlagEvaluation
1818
import com.datadog.android.flags.utils.forge.ForgeConfigurator
1919
import fr.xgouchet.elmyr.annotation.Forgery
2020
import fr.xgouchet.elmyr.junit5.ForgeConfiguration
@@ -59,9 +59,9 @@ internal class EvaluationEventRecordWriterTest {
5959

6060
@Test
6161
fun `M write all events to storage W writeAll() { multiple events }`(
62-
@Forgery event1: BatchedFlagEvaluations.FlagEvaluation,
63-
@Forgery event2: BatchedFlagEvaluations.FlagEvaluation,
64-
@Forgery event3: BatchedFlagEvaluations.FlagEvaluation
62+
@Forgery event1: FlagEvaluation,
63+
@Forgery event2: FlagEvaluation,
64+
@Forgery event3: FlagEvaluation
6565
) {
6666
// Given
6767
val events = listOf(event1, event2, event3)
@@ -102,7 +102,7 @@ internal class EvaluationEventRecordWriterTest {
102102

103103
@Test
104104
fun `M use write context W writeAll() { events provided }`(
105-
@Forgery event: BatchedFlagEvaluations.FlagEvaluation
105+
@Forgery event: FlagEvaluation
106106
) {
107107
// Given
108108
whenever(mockSdkCore.getFeature(Feature.FLAGS_EVALUATIONS_FEATURE_NAME)).thenReturn(mockFeature)
@@ -134,8 +134,8 @@ internal class EvaluationEventRecordWriterTest {
134134

135135
@Test
136136
fun `M do nothing W writeAll() { feature not available }`(
137-
@Forgery event1: BatchedFlagEvaluations.FlagEvaluation,
138-
@Forgery event2: BatchedFlagEvaluations.FlagEvaluation
137+
@Forgery event1: FlagEvaluation,
138+
@Forgery event2: FlagEvaluation
139139
) {
140140
// Given
141141
val events = listOf(event1, event2)
@@ -152,12 +152,12 @@ internal class EvaluationEventRecordWriterTest {
152152
@Test
153153
fun `M serialize events correctly W writeAll() { events with all fields }`() {
154154
// Given - event with all fields populated
155-
val event = BatchedFlagEvaluations.FlagEvaluation(
155+
val event = FlagEvaluation(
156156
timestamp = 1234567890L,
157-
flag = BatchedFlagEvaluations.Identifier("test-flag"),
158-
variant = BatchedFlagEvaluations.Identifier("variant-a"),
159-
allocation = BatchedFlagEvaluations.Identifier("allocation-1"),
160-
targetingRule = BatchedFlagEvaluations.Identifier("rule-1"),
157+
flag = FlagEvaluation.Identifier("test-flag"),
158+
variant = FlagEvaluation.Identifier("variant-a"),
159+
allocation = FlagEvaluation.Identifier("allocation-1"),
160+
targetingRule = FlagEvaluation.Identifier("rule-1"),
161161
targetingKey = "user-123",
162162
context = null,
163163
error = null,
@@ -195,7 +195,7 @@ internal class EvaluationEventRecordWriterTest {
195195

196196
@Test
197197
fun `M write event with UTF-8 encoding W writeAll() { event provided }`(
198-
@Forgery event: BatchedFlagEvaluations.FlagEvaluation
198+
@Forgery event: FlagEvaluation
199199
) {
200200
// Given
201201
whenever(mockSdkCore.getFeature(Feature.FLAGS_EVALUATIONS_FEATURE_NAME)).thenReturn(mockFeature)

features/dd-sdk-android-flags/src/test/kotlin/com/datadog/android/flags/utils/forge/FlagEvaluationForgeryFactory.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ internal class FlagEvaluationForgeryFactory : ForgeryFactory<FlagEvaluation> {
2121

2222
return FlagEvaluation(
2323
timestamp = firstEvalTimestamp,
24-
flag = FlagEvaluation.Flag(forge.anAlphabeticalString()),
24+
flag = FlagEvaluation.Identifier(forge.anAlphabeticalString()),
2525
variant = if (!isDefaultOrError) {
26-
FlagEvaluation.Flag(forge.anAlphabeticalString())
26+
FlagEvaluation.Identifier(forge.anAlphabeticalString())
2727
} else {
2828
null
2929
},
3030
allocation = if (!isDefaultOrError) {
31-
FlagEvaluation.Flag(forge.anAlphabeticalString())
31+
FlagEvaluation.Identifier(forge.anAlphabeticalString())
3232
} else {
3333
null
3434
},
35-
targetingRule = null, // Not currently tracked
35+
targetingRule = null,
3636
targetingKey = forge.aNullable { forge.anAlphabeticalString() },
3737
context = null,
3838
error = if (hasError) {

0 commit comments

Comments
 (0)