[Feature flags] Send exposures as batches#2895
Conversation
48599ba to
50bbdd6
Compare
5f1386d to
bedf595
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feature/feature-flagging #2895 +/- ##
============================================================
+ Coverage 70.36% 70.69% +0.33%
============================================================
Files 826 830 +4
Lines 30084 30203 +119
Branches 5124 5128 +4
============================================================
+ Hits 21167 21349 +182
+ Misses 7465 7409 -56
+ Partials 1452 1445 -7
🚀 New features to boost your workflow:
|
typotter
left a comment
There was a problem hiding this comment.
Looks great!
Just a couple small name/refactor comments.
96114fc
86c1e46 to
96114fc
Compare
0xnm
left a comment
There was a problem hiding this comment.
I reviewed production files and left some comments.
| private var enableExposureLogging: Boolean = false | ||
|
|
||
| /** | ||
| * Sets whether exposures should be logged to RUM. This is disabled by default. |
There was a problem hiding this comment.
just curious: what is the impact if it is enabled? billing?
There was a problem hiding this comment.
You've got it. It's RUM ingestion and eventually, experiments ingestion events that would hit billing. The other impact is that feedback for Feature Flags won't be available in parts of the Datadog Feature Flags & Experimentation app, so the customer loses observability.
There was a problem hiding this comment.
We probably need to put more focus on explaining what it is, because it impacts billing, so it is kind of important parameter to change.
| import com.google.gson.JsonElement | ||
| import com.google.gson.JsonObject | ||
|
|
||
| internal data class ExposureEvent( |
There was a problem hiding this comment.
should we maybe simply create json schema locally and then generate event from there?
There was a problem hiding this comment.
Added a todo to do this in another pr
e8dc8d2 to
63f5129
Compare
| private data class CacheKey( | ||
| val targetingKey: String, | ||
| val flagName: String, | ||
| val allocationKey: String, | ||
| val variationKey: String | ||
| ) |
There was a problem hiding this comment.
with 4 unrelated properties making a cache key do we expect a high rate of cache miss?
There was a problem hiding this comment.
The number of misses should be low once all of the Flags in an app have been evaluated for the first time.
targetingKey is likely to remain stable as it typically references the user. The length of the cache is essentially the number of Flags that are evaluated times the churn in assignment.
The allocationKey & variationKey only change if the evaluationContext changes is reset and the resulting flag assignment changes. The flux in assignment varies depending on the kind of feature flag (i.e. a rollout vs A/B test) but would generally be pretty stable during a user's session in the app. As a result, churn on Allocation and Variation would be very low.
| private var enableExposureLogging: Boolean = false | ||
|
|
||
| /** | ||
| * Sets whether exposures should be logged to RUM. This is disabled by default. |
There was a problem hiding this comment.
You've got it. It's RUM ingestion and eventually, experiments ingestion events that would hit billing. The other impact is that feedback for Feature Flags won't be available in parts of the Datadog Feature Flags & Experimentation app, so the customer loses observability.
| private data class CacheKey( | ||
| val targetingKey: String, | ||
| val flagName: String, | ||
| val allocationKey: String, | ||
| val variationKey: String | ||
| ) |
There was a problem hiding this comment.
The number of misses should be low once all of the Flags in an app have been evaluated for the first time.
targetingKey is likely to remain stable as it typically references the user. The length of the cache is essentially the number of Flags that are evaluated times the churn in assignment.
The allocationKey & variationKey only change if the evaluationContext changes is reset and the resulting flag assignment changes. The flux in assignment varies depending on the kind of feature flag (i.e. a rollout vs A/B test) but would generally be pretty stable during a user's session in the app. As a result, churn on Allocation and Variation would be very low.
63f5129 to
16b6e3a
Compare
16b6e3a to
a1e7ee1
Compare
e53c83c to
5e27688
Compare
What does this PR do?
This is part of the feature flags project.
• Takes the Flags Feature name from the core, to match the rest of our features
• GSON added as a transitive dependency.
• Writes feature flags exposures to batches and sends them to the endpoint using the core mechanism.
• Increases test coverage past 80% for the module.
• Exposures deduplication lrucache set at 4mb max size.
• Sending exposures batches is controlled by a configuration option in
FlagsConfigurationoftrackExposuresthat is set to default true.Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)