Feature Flags and Experiments

This product is not supported for your selected Datadog site. ().

Overview

Datadog Feature Flags is the default way to randomize a Datadog Experiment. When you link a flag to an experiment, Datadog adds an Experiment targeting rule to the flag. Evaluations of that rule assign subjects to a variant and record an exposure event that Datadog uses to analyze the experiment.

Link a flag to an experiment from either side of the workflow:

Experiment targeting rules

An experiment targeting rule works like any other targeting rule: it can include a filter, and it uses the same deterministic randomization to assign subjects to a variant. Randomization is based on the targetingKey in your evaluation context, so the same subject consistently receives the same variant for the life of the experiment.

If multiple experiments share the same flag, Datadog evaluates their targeting rules in order, top to bottom. Reorder the rules before you launch an experiment to control which one takes priority for a given subject.

Exposures

Each time the SDK evaluates a flag’s experiment targeting rule for a subject, Datadog records an exposure: the subject, the variant served, and a timestamp. Datadog joins exposures to metric events to calculate the lift between variants. Those metric events can come from Product Analytics, Real User Monitoring, or your data warehouse.

Datadog joins exposures and metrics by subject identifier. The targetingKey your SDK sets in the evaluation context must match the subject type attribute configured for the experiment, such as @usr.id, or Datadog can’t associate metric events with the correct exposure.

Bring your own randomization

If you randomize subjects with a system other than Datadog Feature Flags, this flag-to-experiment integration doesn’t apply. Datadog can still analyze the experiment: define an Exposure SQL Model that reads exposure records from your data warehouse instead.

Further reading