[FFL-1720] Evaluation Logging: Integration#3147
[FFL-1720] Evaluation Logging: Integration#3147typotter merged 14 commits intotypo/FFL-1720-pr3-storage-networkfrom
Conversation
10e6149 to
5a11e3d
Compare
fa56eda to
a83f2d5
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. |
5a11e3d to
1c2b043
Compare
7ceef6b to
7c8d6b7
Compare
1c2b043 to
cc350e3
Compare
3618528 to
cce61c1
Compare
8813c89 to
56da165
Compare
cc350e3 to
8c8b89d
Compare
e84dada to
fb01eef
Compare
8c8b89d to
14f24f6
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## typo/FFL-1720-pr3-storage-network #3147 +/- ##
=====================================================================
- Coverage 71.00% 70.92% -0.08%
=====================================================================
Files 906 906
Lines 33354 33428 +74
Branches 5624 5641 +17
=====================================================================
+ Hits 23681 23706 +25
- Misses 8106 8148 +42
- Partials 1567 1574 +7
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
46d2cd4 to
5b0da2a
Compare
4fd1954 to
2d61320
Compare
| val service = currentContext?.service | ||
| ?: (sdkCore as? InternalSdkCore)?.getDatadogContext()?.service |
There was a problem hiding this comment.
This operation is blocking and may be expensive (and block upstream). Since service doesn't change over SDK lifetime, it is better to read it once during the feature initialization.
There was a problem hiding this comment.
🤔 You have suggested removing it from feature initialization before. Do you suggest reverting that or do something differently? wdyt about lazy init?
There was a problem hiding this comment.
I was suggesting reading it at the event write stage, this is not implemented. In this case it wouldn't be a blocking call, but an argument received at the withWriteContext callback.
And choosing between making such blocking call multiple times (at the onContextUpdate) vs once (at the feature initialization), the latter is a lighter approach.
There was a problem hiding this comment.
Oh, I see, that makes sense. I guess one caveat is rum view name which is dynamic, so on write is too late as it might have changed. We need up-to-date context in processEvaluation() step
There was a problem hiding this comment.
so on write is too late as it might have changed
SDK handles this case. When withWriteContext is called, it is processed on a single thread for the whole SDK, which guarantees sequential processing and also DatadogContext is captured at the moment of the call (it is immutable data class).
This means that if evaluation flow opens withWriteContext as early as possible, and even if there is a time-arranged sequence of client calls (may be done from different threads, so actions may happen in parallel) like startView(A) -> evaluation -> startView(B), evaluation is guaranteed to receive a context at the time once startView(A) finished its processing and it won't be affected by the startView(B) context change.
But I guess since for the evaluation there is an aggregation, and write happens not the moment event is captured, the flow can be different. If write isn't not necessary there is a withContext callback (but there is no callback which would provide only WriteScope though, although it is not a big deal).
There was a problem hiding this comment.
Cool. It looks like withContext is what we need here
There was a problem hiding this comment.
We are only getting the ddContext once as we are using the currentContext.service and falling through to sdkCore.getDatadogContext() only when the value is null. Also, this first call to onContextUpdate will happen when the Feature is registered so it's not part of a regular queue of onContextUpdate calls (when the context actually is updated). It is, for all intents and purposes, tied into the initialization lifecycle already.
Integrates the evaluation logging feature end-to-end, enabling it in the SDK. Configuration (FlagsConfiguration): - Add trackEvaluations(enabled: Boolean) - default true (EVALLOG.12) - Add useCustomEvaluationEndpoint(endpoint: String) - for testing/proxies - Add evaluationFlushInterval(intervalMs: Long) - configurable 1-60s, default 10s - Validation: interval coerced to valid range Lifecycle (FlagsFeature): - Initialize evaluation processor on onInitialize() when trackEvaluations enabled - Creates scheduled executor for periodic flushing - Creates evaluation writer (EvaluationEventRecordWriter) - Schedules periodic flush task - Clean up on onStop(): - Flush remaining evaluations via processor.stop() - Clean up processor and writer references - Renamed processor → exposureProcessor for clarity - Renamed dataWriter → exposureWriter for clarity Integration (DatadogFlagsClient): - Accept both exposureProcessor and evaluationProcessor (optional) - Add writeEvaluationEvent() method to log evaluations - Track ALL evaluations when trackEvaluations enabled: - Success evaluations in trackResolution() - Error evaluations via new trackErrorResolution() method - Error evaluations create synthetic PrecomputedFlag with ERROR reason Factory (FlagsClient): - Pass both processors to DatadogFlagsClient constructor Test Updates: - DatadogFlagsClientTest: Update all instantiations to pass both processors - FlagsFeatureTest: Update to test dual processor initialization - Add mock for createScheduledExecutorService() EVALLOG compliance: Enables evaluation logging (2, 3, 4, 5, 8, 10, 11, 12, 13) Zero user-facing breaking changes - all new options have defaults.
8ade2db to
c095d0d
Compare
0025368 to
102267f
Compare
0b4df16
into
typo/FFL-1720-pr3-storage-network

🥞 Evaluation Logging Stacked Pull Requests 🥞
👉 Integration & Configuration (this PR)
☑️ Storage & Network Infrastructure (PR #3146)
☑️ 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?
Wires the evaluation logging feature end-to-end by connecting the
EvaluationsFeatureto the flag evaluation flow. This is the final PR that enables evaluation logging in the Flags SDK.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)