Skip to main content
This topic describes how to use metric measurement windows to prevent bias in experiment and guarded rollout results. A metric measurement window defines a fixed, required period of time during which LaunchDarkly collects metrics for a context. A window begins after a context first receives a flag variation in an experiment or guarded rollout, and ends after a configured duration. LaunchDarkly measures the window in elapsed time from the moment of that first flag variation, not in calendar days. The window includes metric events that occur at its exact end time. For example, if a window ends after eight days and a context first receives a flag variation at 9:00 AM on November 1, the window includes that context’s events up to and including 9:00 AM on November 9. Events the context generates later on November 9 are outside the window. Attached experiments only consider those metric events that occur within the configured measurement window, and the window must fully complete before the experiment includes any measurements for a context. When you stop an experiment, any metrics for contexts that have not reached the end of their measurement window do not contribute to experiment results.
Available for LaunchDarkly hosted metrics and Snowflake data sourcesYou can configure metric measurement windows on metrics created from LaunchDarkly hosted events, for use with guarded rollouts, and on metrics created from Snowflake data sources for use with warehouse native Experimentation. You cannot configure windows on metrics created from other warehouse data sources. To learn more, read Metric event sources.

Avoiding measurement bias in experiments

Metric measurement windows ensure that all contexts included in an experiment have the same amount of time available to generate metric measurements. You define the period of time required to produce a conversion event or to produce the volume of metric values you want to measure. LaunchDarkly ensures that only measurements from completed windows are considered in experiment results. In this way, metric windows help you prevent late or incomplete user activities from biasing experiment results. When no measurement window is configured (the default behavior), all contexts that participate in an experiment contribute equally to the experiment result. Contexts added near the end of the experiment have less time to generate metrics, so they can negatively impact the experiment results. For example, consider a conversion event that typically requires three days to complete. Most contexts that join the experiment in the last two days of the experiment will negatively impact the conversion metric, even if some of those contexts eventually generate a conversion. By configuring a metric window of three days, you ensure that the experiment only considers units that have the full three days in which to produce the conversion event.

Prerequisites and limitations

You can configure metric measurement windows for these metrics: You cannot configure windows on metrics created from other warehouse data sources. For a warehouse native metric, the data source you use for creating the metric must map the Timestamp value to a column that uses timestamp or datetime format and encodes timezone information. To learn more, read Metric data sources. By default, new metrics do not include a metric measurement window. When you configure no measurement window, all metric measurements collected during an experiment contribute equally to the experiment result. This matches the LaunchDarkly experiment and guarded release behavior prior to the introduction of metric windows.

Configuring a metric window

When you choose the duration of a metric measurement window, keep in mind:
  • The duration you choose should be long enough to capture all relevant measurements. LaunchDarkly stops measuring events for a context after the window completes.
  • If your conversion events require a lengthy period of user activity to generate, ensure that experiments run long enough to capture the needed volume of completed metric windows.
  • If you are measuring an activity that requires a lengthy setup process, you can optionally configure an offset value to delay measurements until some point after a context first receives a flag evaluation. Offset values enable you to exclude early metric events that might be considered as “noise” in the overall measurement. For example, if you want to measure input validation errors that occur when customers complete a purchase, you could use an offset value to exclude input validation errors that occur earlier in the purchase process.
You configure optional metric window properties after you specify the analysis method for a metric.
Configuring a metric measurement window.

Configuring a metric measurement window.

To configure a measurement window:
  1. Open the Data section and navigate to the Metrics list.
  2. Click Create metric. The “Create metric” dialog appears.
  3. Choose an event source:
    • To use LaunchDarkly hosted events, select LaunchDarkly hosted, then select an event kind.
    • To use a Snowflake data source, select Warehouse native, then select an available Snowflake data source from the “Metric data source” menu. To learn more, read Metric data sources.
  4. Search for or enter an Event key to use for the metric.
  5. Choose options in the “Metric definition” section to configure the metric aggregation type and analysis method. To learn more, read Components of a metric.
  6. Select the Enable custom measurement window checkbox.
  7. Use the “Window measured in” menu to choose whether to define the window in days, hours, or minutes.
  8. (Optional) Change the value in the “Start” field to delay metric measurements for a period of time after a context receives a flag variation. A value of zero specifies no offset, meaning the measurement window begins immediately after a context receives a flag variation.
  9. Enter a value in the “End” field to configure the length of the measurement window.
    The end value must be greater than the start valueLaunchDarkly calculates both the “End” and “Start” values relative to when a context first receives a flag variation in an experiment or guarded rollout. The “End” value must be greater than the “Start” value to configure a measurement window.
  10. Enter a Metric name and an optional Description.
  11. Click Create.

Measurement windows in guarded rollouts

A guarded rollout applies the window of each LaunchDarkly hosted metric it monitors. The rollout considers only those metric events that a context generates within the window, measured from when the context first receives a flag variation. The rollout includes a context in its results only after the context’s window completes. This means that a guarded rollout cannot measure a context until the window’s “End” value has passed. Choose an “End” value that is shorter than the duration of each rollout step. This gives contexts time to complete their windows while the rollout is still running. A context that has not completed its window does not count toward the rollout’s minimum sample size. If the sample size is below the minimum when the rollout ends, LaunchDarkly extends the rollout. If the sample size reaches the minimum during the extension, LaunchDarkly does not roll back the change. If it is still below the minimum after the extension, LaunchDarkly rolls back the change. To learn more, read Rollout duration.

Interpreting metrics excluded from experiments

Metrics with measurement windows introduce additional conditions for excluding their measurements from experiment results. For any connected experiment, a context’s metric measurements are excluded if:
  • Measurements occur outside of a configured metric window. Any metric events that occur before the window offset, and any events that occur after the window completes, are excluded from the experiment.
  • A configured measurement window does not complete. If the experiment ends before a context’s measurement window completes, all measurements for that context are excluded.
  • A configured measurement window completes, but the context generated no events. For numeric metrics, if you select the Exclude units that generate no events option, then contexts that complete their measurement window are excluded if they generate no event. To learn more, read Units without events.
LaunchDarkly experiments show the full accounting of units that are excluded from experiment results, both during the experiment and at experiment completion. To view a breakdown of why units are excluded from an experiment, click a value in the “Sample size” column of the experiment results.
Metrics excluded from experiment results.

Metrics excluded from experiment results.

To learn more, read Experiment results data.