[FFL-1720] Evaluation Logging: Storage & Network Infrastructure#3146
[FFL-1720] Evaluation Logging: Storage & Network Infrastructure#3146typotter wants to merge 14 commits intographite-base/3146from
Conversation
fa56eda to
a83f2d5
Compare
e1704c3 to
95f4c0a
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
95f4c0a to
a0e7df9
Compare
7ceef6b to
7c8d6b7
Compare
This comment has been minimized.
This comment has been minimized.
...id-flags/src/main/kotlin/com/datadog/android/flags/internal/net/EvaluationsRequestFactory.kt
Show resolved
Hide resolved
...id-flags/src/main/kotlin/com/datadog/android/flags/internal/net/EvaluationsRequestFactory.kt
Outdated
Show resolved
Hide resolved
...id-flags/src/main/kotlin/com/datadog/android/flags/internal/net/EvaluationsRequestFactory.kt
Outdated
Show resolved
Hide resolved
968dc68 to
80c8de7
Compare
7c8d6b7 to
a195a29
Compare
2eb16ca to
0cfb30a
Compare
a195a29 to
4f4c253
Compare
0cfb30a to
141cded
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## graphite-base/3146 #3146 +/- ##
======================================================
- Coverage 70.98% 70.92% -0.06%
======================================================
Files 905 906 +1
Lines 33319 33353 +34
Branches 5619 5623 +4
======================================================
+ Hits 23650 23654 +4
- Misses 8097 8127 +30
Partials 1572 1572
🚀 New features to boost your workflow:
|
141cded to
4bfc37e
Compare
4f4c253 to
df51ceb
Compare
4bfc37e to
550f9f0
Compare
3618528 to
cce61c1
Compare
4b1cbc1 to
7e2293e
Compare
8813c89 to
56da165
Compare
512a272 to
e0d2ae7
Compare
56da165 to
5ba6fec
Compare
e84dada to
fb01eef
Compare
eb19187 to
66b62f4
Compare
fb01eef to
3a685c2
Compare
| } | ||
|
|
||
| @Test | ||
| fun `M preserve batch data order W create() { multiple batch events }`( |
There was a problem hiding this comment.
does it actually matter? should we preserve the order?
| * to the EVP intake endpoint by the SDK Core's upload mechanism. | ||
| */ | ||
| internal class EvaluationEventRecordWriter(private val sdkCore: FeatureSdkCore) : EvaluationEventWriter { | ||
| override fun writeAll(events: List<FlagEvaluation>) { |
| fun `M use write context W writeAll() { events provided }`( | ||
| @Forgery event: FlagEvaluation | ||
| ) { | ||
| // Given | ||
| whenever(mockSdkCore.getFeature(Feature.FLAGS_EVALUATIONS_FEATURE_NAME)).thenReturn(mockFeature) | ||
| whenever(mockFeature.withWriteContext(any(), any())) | ||
| .thenAnswer { invocation -> | ||
| val callback = invocation.getArgument<(DatadogContext, EventWriteScope) -> Unit>(1) | ||
| val mockContext = mock<DatadogContext>() | ||
| callback.invoke(mockContext) { writerScope -> | ||
| writerScope.invoke(mockEventBatchWriter) | ||
| } | ||
| } | ||
|
|
||
| // When | ||
| testedWriter.writeAll(listOf(event)) | ||
|
|
||
| // Then - should use withWriteContext | ||
| verify(mockFeature).withWriteContext(any(), any()) | ||
| } |
There was a problem hiding this comment.
I'm not sure this test makes sense, we already assert that events are written in the tests above
| } | ||
|
|
||
| @Test | ||
| fun `M serialize events correctly W writeAll() { events with all fields }`() { |
There was a problem hiding this comment.
I would suggest to start creating tests in the reliability/single-fit for that kind, it is a better place to verify E2E functionality.
| } | ||
|
|
||
| @Test | ||
| fun `M write event with UTF-8 encoding W writeAll() { event provided }`( |
| internal class EvaluationEventRecordWriter(private val sdkCore: FeatureSdkCore) : EvaluationEventWriter { | ||
| override fun writeAll(events: List<FlagEvaluation>) { | ||
| if (events.isEmpty()) return | ||
|
|
There was a problem hiding this comment.
one more thing: it is better to wrap a code block below synchronized(this) to avoid race condition when the same batch is accessed

🥞 Evaluation Logging Stacked Pull Requests 🥞
🔲 Integration & Configuration (PR #3147)
👉 Storage & Network Infrastructure (this PR)
☑️ Aggregation Engine & Test Utilities (PR #3145)
☑️FlagEvaluation Schema (PR #3166)
☑️ Event Schema & Data Models (PR #3144)
☑️ Evaluations Subfeature (PR #3159)
⎿
feature/flags-evaluations-logging(feature branch)Datadog Internal
🎟️ Ticket: FFL-1720 - Implement Evaluation Logging for Android SDK
What does this PR do?
Implements the infrastructure for persisting evaluation events to disk and uploading them to Datadog's intake endpoint. Connects the aggregation engine (PR #3145) to the SDK Core's storage and network layer.
Motivation
We need to implement Evaluation Logging to provide comprehensive visibility into all feature flag evaluations, including defaults, errors, and successful matches. This goes beyond exposure logging by capturing aggregated metrics about evaluation frequency, error rates, and runtime default usage across all flags.
Additional Notes
Review checklist (to be filled by reviewers)