Sub topic 11
Launching, ramping and monitoring safely
This chapter assumes you have read the earlier chapters on the experiment brief, metrics and sample size, and that you know what a feature flag is. The brief is written and the events are instrumented. This chapter covers what happens between "the code is merged" and "the data is ready to analyze".
Why launch is its own phase
A launch is the first time real users meet the change. Bugs, logging gaps and bad assignment logic that tests did not catch show up here. If you start at 50/50 on all eligible traffic, a payment bug reaches half your users before anyone notices.
A safe launch has three parts:
- Pre-launch checks confirm that the plan, the flag and the logging work.
- A ramp raises exposure in steps, with a check at each step.
- Monitoring watches health and guardrails during the full-allocation run.
Product owns the go/no-go call. Engineering owns the flag and the kill switch. Data owns the health checks and dashboards.
Pre-launch checklist
Run through these before any real user is exposed.
- The brief is frozen. The hypothesis, primary metric, guardrails, minimum detectable effect and decision rule are written down and agreed.
- Assignment is deterministic. The same user gets the same variant on every visit, and the experiment key is part of the hash, as in the assignment example from the earlier chapter.
- Exposure is logged. An exposure event is recorded when the user actually sees the changed experience, not when they are merely assigned.
- Metric events fire in both variants, and with the same definition in each.
- The kill switch works. Someone has turned the flag off in a staging environment and confirmed that users return to the control experience.
- Ownership is clear. You know who is on call during the ramp and who can approve a rollback without a meeting.
A short internal test is worth the time. Have team members force themselves into each variant, complete the flow, and confirm the events appear in the data warehouse with the right user ID, variant and timestamp.
Ramping in stages
A ramp is a sequence of increasing treatment shares, each held long enough to catch problems that stage can reveal. Early stages test safety, not effect size. At 1% exposure you cannot detect a one-point lift, but you can detect a crash or a broken payment call.
| Stage | Treatment share | Purpose | Typical hold |
|---|---|---|---|
| Internal | Staff only | Verify the flow and the events | Hours |
| Canary | 1% | Catch crashes, errors and logging gaps | 1 day |
| Early ramp | 5-10% | Check guardrails and the sample ratio | 1-2 days |
| Full allocation | 50% (per brief) | Collect the planned sample | Planned duration |
Write the ramp into the plan so nobody improvises under pressure. A YAML ramp plan that sits next to the brief looks like this:
experiment: checkout_address_autofill
ramp:
- stage: canary
treatment_share: 0.01
min_hold_hours: 24
advance_if:
- no_guardrail_breach
- srm_p_value_above: 0.001
- exposure_events_logged
- stage: early
treatment_share: 0.10
min_hold_hours: 24
advance_if:
- no_guardrail_breach
- srm_p_value_above: 0.001
- stage: full
treatment_share: 0.50
min_hold_hours: 336
advance_if: []
rollback:
owner: eng-checkout
trigger: any_guardrail_breach_or_sev1_incidentRamp data and the analysis window
Treat ramp data carefully. During the canary, 1% of users are in treatment and 99% in control. If you pool that period with the full 50/50 period, the pooled sample mixes different allocation ratios. Traffic mix also changes by day and weekday, so the ramp days may differ from the rest in ways unrelated to the treatment. This can bias a pooled comparison and even reverse its direction (Simpson's paradox).
The usual rule is to analyze only the full-allocation period, starting from the moment the share reaches its final value. Write this into the brief so nobody is tempted to add the ramp days later to reach the sample size sooner.
With hash-based bucketing, raising the treatment share keeps users who were already in treatment in treatment, because the threshold only moves upward. That is a useful property, since users do not flip variants mid-experiment. Do not change the experiment key during the ramp, because that would reshuffle everyone.
What to monitor
Monitoring during an experiment is about health, not about whether the treatment is winning. Keep those two apart.
Health checks
- Sample ratio. Compare observed variant counts with the planned split using a chi-square test. A p-value below about 0.001 means assignment or logging is broken, so pause and investigate. The data quality chapter covers causes.
- Exposure volume. Daily exposures should be close to what the eligible traffic predicts. A sudden drop often means the flag service or an event pipeline failed.
- Event completeness. Each variant should log every metric event. A variant with zero payment events is a logging bug, not a result.
- Latency and errors. Page load time (p95), API errors and crash rates are typically guardrails for the whole product.
Guardrail checks
A guardrail check asks whether treatment is clearly harming something you promised to protect. Because a harmful change should be stopped quickly, these checks use a stricter threshold than the final analysis, and they are one-sided because you only care about harm.
import math
from statistics import NormalDist
def guardrail_breached(x_c, n_c, x_t, n_t, tolerance=0.0, alpha=0.01):
"""Return (breached, lower_bound) for an increase in a bad-event rate.
A breach means the one-sided lower confidence bound on
(treatment rate - control rate) is above the allowed tolerance.
"""
p_c, p_t = x_c / n_c, x_t / n_t
se = math.sqrt(p_c * (1 - p_c) / n_c + p_t * (1 - p_t) / n_t)
z = NormalDist().inv_cdf(1 - alpha)
lower = (p_t - p_c) - z * se
return lower > tolerance, lower
# Canary data: payment errors, 40/2000 in control, 90/2000 in treatment.
breached, lower = guardrail_breached(40, 2000, 90, 2000)
print(f"breached={breached}, lower_bound={lower:.4f}")In this example the error rate rises from 2.0% to 4.5%. The lower bound is about 0.012, above zero, so the check fires and the ramp stops.
This is a safety net, not a ship test. Running it every hour means many looks at the data, so false alarms will occur. That cost is acceptable for a stop rule, because a false alarm costs a pause and a missed harm costs real users. It is not acceptable for a ship rule, which the analysis chapter covers.
Deciding to pause, roll back or continue
Agree on the response before launch, so the decision during an incident is quick and not a debate.
| Signal | Action | Who decides |
|---|---|---|
| Sample ratio mismatch | Pause, find the cause, usually restart | Data, with engineering |
| Guardrail breach with a clear mechanism | Roll back, then diagnose | Engineering on call, product informed |
| Severity 1 incident, any cause | Turn off the flag immediately | Anyone on call |
| Logging gap in one variant | Pause and fix. Exclude the affected period from analysis | Data and engineering |
| Primary metric looks good or bad | Continue. Do not act | Nobody |
If you fix a bug in the treatment during the run, the experiment now tests a different change. Treat it as a new experiment, or at least restart the analysis window from the fix, and record this in the brief's change log.
Interference from other launches also matters. If another team ships a pricing change to the same users halfway through, both results may be confounded. Keep a shared calendar of experiments and releases on the same surface.
Common mistakes
- Starting at full allocation because the change "is small".
- Advancing the ramp on a schedule without reading the checks.
- Pooling canary days into the final analysis.
- Stopping early because the lift looks significant.
- Extending the run because the lift is not yet significant. Decide duration from the sample size in the brief.
- Having no named person who can turn off the flag.
Exercise
Your ramp plan has a canary at 1% for a day, then 10%, then 50%. At the 10% stage, the sample ratio test gives p = 0.0002 for a planned 90/10 split. The primary metric looks up 3%. What do you do, and why?
Show answer
Pause the ramp and do not advance. A p-value of 0.0002 is below the 0.001 threshold, so assignment or logging is probably broken, and the 3% lift cannot be trusted because the groups may not be comparable. Engineering and data should find the cause, such as a flag evaluated late for some clients or events dropped in one variant. Fix it, then restart the stage and analyze only data collected after the fix.
Exercise
Why should the final analysis cover only the full-allocation period and not the canary and early ramp days?
Show answer
Allocation ratios and traffic mix differ across ramp stages. Pooling them mixes groups of different sizes and different days, which can bias the comparison, even reverse its sign. Using only the period with the final share keeps the groups comparable and matches the sample size calculation in the brief.