Repository navigation
feat(flags): add per-provider trackExposures and trackEvaluations - #1325
Draft
leoromanovsky wants to merge 2 commits into
Draft
leoromanovsky wants to merge 2 commits into
leoromanovsky wants to merge 2 commits into
Conversation
Let one DatadogProvider evaluate flags without recording them, for example to choose notification content at send time, while other providers keep exposures and evaluation telemetry. With trackExposures: false, the provider sends no exposure, leaves the exposure deduplication cache untouched, and ExposureHook reports the evaluation as not an exposure, so a later evaluation through a tracking provider still sends its exposure. With trackEvaluations: false, the provider records no evaluation telemetry and DatadogRumHook skips its evaluations. Both default to true and can only narrow the DatadogFlagsConfiguration settings.
Document that each peeking provider fetches its own assignments, and that an unregistered peeking domain falls back to the default provider. Clarify which trackExposures the ExposureHook doc means. Honor the tracking-off marker in DatadogRumHook only from the Datadog provider. Cover missing flags, type mismatches, and structures with trackEvaluations: false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why?
Some apps need a flag value before the subject sees the result. For example, they pick the copy of a push notification when they send it. Today every
DatadogProviderevaluation counts as an exposure. It also counts as evaluation telemetry and as a RUM feature-flag evaluation. So an app that evaluates at send time records an exposure that may never happen, and the later real exposure is deduplicated away.DatadogFlagsConfiguration.trackExposures: falsedoes not fix this. It stops sending, but the provider still writes the dedup cache andExposureHookstill reports the evaluation as an exposure.DatadogRumHookhas no setting at all.This PR adds "peeking", which the server SDKs (Java, Go, Ruby) and the iOS client already have as per-client options. A provider created with
trackExposures: false/trackEvaluations: falseevaluates flags without recording them. Other providers keep both, and a later evaluation through one of them records the exposure.How?
The options are named parameters of
DatadogProvider.fromConfiguration. Both default totrue:Decisions:
FlagsClient. The names match iOS's per-clienttrackExposures/trackEvaluations. A peeking provider is a second domain next to the app's normal provider, so nothing changes for existing callers.ExposureHookgetsisExposure: false. This matches Java, where the shared cache, delivery, and hooks all see "not an exposure".DatadogFlagsConfiguration.trackExposures: falsekeeps its current meaning: it does not send, but hooks still deduplicate. The README now tells the two apart.__dd_track_evaluations: false, andDatadogRumHookskips them. Metadata is used because the RUM hook lives indatadog_flags_flutterand only sees OpenFeature details. Other__dd_keys already work this way and are documented as internal.truedoes not turn it back on.DatadogFlags/DatadogFlagsPluginclients. Their removal is planned for the next major version. Peeking is available only on the OpenFeature provider.Rollout: this is additive, and both options default to the current behavior. Version skew: if
datadog_flags_flutteris used with an olderdatadog_flags, the provider has no options to set. If it is used with a newer one, the RUM hook skips the evaluations as intended.Tests cover the defaults, each option alone, both options off, and the key cross-provider case: a peeking evaluation followed by a default evaluation sends exactly one exposure, and the hook reports no cache hit. They also cover that the options cannot turn tracking back on, and that
DatadogRumHookskips marked evaluations. We broke each option on purpose and checked that its tests fail. The web and wasm runs ofdatadog_flags_flutterwere not run locally (Chrome is not available on this host). CI covers them.Review checklist