Chapter 03

Roll out gradually

A rollout lets people in a few at a time, so a bug reaches 5% of your users instead of all of them. Rollouts answer three questions: who is eligible, what signal are you watching, and what would make you raise the percentage or roll back.

The rollout ladder

A typical ladder for new-checkout:

StepWho's eligibleWatchRaise whenRoll back when
Teamemail ends with @yourcompany.comYour own use in productionThe team used it for real work and found no blockersAnything a customer would notice
5%A small share of everyone elseErrors, replays, latency, and checkout conversion for people with the flagEvery check in the list below passes over a day of normal trafficAny check in the list fails
25%A bigger shareThe same, plus load on the services checkout callsThe sameThe same, or latency climbs
100%EveryoneThe sameNothing left to watch: schedule the cleanupThe same

Who is eligible

Each flag has one or more release conditions Fig. 1. A condition set matches when every property filter passes and the person falls inside its rollout percentage, and a person who matches any set gets the flag.

Release conditions

Specify users for flag release. Condition sets are evaluated top to bottom - the first matching set is used. A condition matches when all property filters pass AND the target falls within the rollout percentage.

Set 1
email
ends with
@yourcompany.com
Roll out to
100%
of users in this set.
OR
Set 2Condition set will match all users
Roll out to
5%
of users in this set.
Add condition set
Fig. 1 – Two condition sets on new-checkout: the team at 100%, then 5% of everyone else.

At PostHog, a flag often starts with only the engineer who made the change. Next comes the team, by email domain: email ends with @yourcompany.com. Use ends with, not contains, because contains also matches lookalike domains.

Then add a set for everyone at a small percentage, as low as 0.01%. Raising the percentage moves the cut-off and changes nobody's hash, so everyone who had the flag keeps it while new people join.

To narrow who's eligible, target a cohort (your beta testers), a person property (their plan), a country if GeoIP is on, or a whole company with group analytics. Target the data where it lives. If your server knows the plan, evaluate on the server and pass the plan in. If the plan lives in Stripe, sync it in as a warehouse property and target it like any other property.

What to watch

You should have clear rules on when to increase or decrease rollout. Watch the signals the change could break: new errors, replays of people who have the flag, and the one metric the change is meant to move. Compare people with the flag to people without it, so a bad day for everyone doesn't read as a bad rollout.

When to raise or roll back

Before you raise a percentage step, and before you see the numbers, write down your rules. Raise a percentage step only when all of these are true for people with the flag, compared to people without it, over at least a day of normal traffic:

  • The error rate is not higher.
  • Error tracking shows no new issue that only people with the flag hit.
  • The metric the change should move, like checkout conversion, is flat or up.
  • Latency on the services the change calls is flat.
  • Support has no new tickets about the change.

If one of them fails, roll back by lowering the percentage or switching the flag off. Then report the blast radius: how many people had the flag while it was broken, and what they hit. The $feature_flag_called events show who got the flag.

If you already know the next step and its date, schedule the flag change and let PostHog make it.

Prompt for PostHog AI
Roll out <my flag key> to everyone whose email ends with @<my company domain> at 100%, and to 5% of all other users.
Ask PostHog AINeeds a feature flag in your project. Swap in its key and your email domain first.