Skip to content
Prompt Words
History Member

Feature flag

Also called: feature toggle.

A switch the running app reads to turn one feature on or off, for everyone or for a share of users, without a new deploy: both code paths ship in the same version and the flag picks one per user. A release flag rolls a feature out, ideally by a sticky percentage so the same user always lands on the same side; turning it off is a kill switch, and long-lived ops flags are kept for just that. Each flag adds a code path to test and must be removed once the feature is fully on, or old paths pile up as flag debt.

Turn the flag on for 10% of users, turn it off in one step, or raise it to 100%. App v1.8 is deployed once; only the flag changes.

Deploys: 1 · Flag changes: 0 · New checkout: 0 of 10 users

App v1.8 is live with both checkouts in its code. The flag new_checkout is off, so everyone gets the old one.

    Flag off

    Say it in a prompt

    Put the new checkout behind a feature flag called new_checkout, using the OpenFeature SDK with flagd as the provider. Evaluate it on every request with the user id as the targeting key, so a percentage rollout is sticky per user. Start at 10% of users, watch the checkout error rate and conversion for a day, then go to 50% and 100%. Turning the flag off must send everyone back to the old checkout within 30 s with no deploy, and the old checkout is the default if the flag service can't be reached. Test both paths in CI, and open a ticket to delete the flag and the old checkout two weeks after it reaches 100%.

    Vague vs precise prompt

    Vague prompt

    add the new checkout but let us turn it off if it breaks

    Typical resultAdds an environment variable NEW_CHECKOUT that is read once at startup. Turning it off means changing the config and restarting or redeploying every pod, it is all users or none, and the old checkout code is never deleted.

    Precise prompt

    Put the new checkout behind an OpenFeature flag new_checkout, evaluated on every request with the user id as the targeting key; start at 10% of users, fall back to the old checkout if the flag service is down, test both paths in CI, and delete the flag two weeks after it reaches 100%.

    Typical resultThe new checkout reaches 10% of users, the same users on every visit, and grows to 100% with no deploy. Turning the flag off sends everyone back to the old checkout within seconds, and a ticket makes sure the flag and the old code are removed instead of piling up.

    Seen on

    • martinfowler.com, Feature Toggles (Pete Hodgson): Feature toggles change what a system does at runtime without changing code: one deploy carries both code paths. It covers short-lived release toggles, long-lived ops toggles used as kill switches, and experiment toggles that consistently send each user down the same code path, and calls toggles inventory with a carrying cost that should be removed.
    • OpenFeature docs, Evaluation context: The targeting key identifies the subject of a flag evaluation, such as a user, and is needed to run fractional or percentage-based rollouts deterministically.
    • LaunchDarkly docs, Percentage rollouts: A percentage rollout hashes each context key into a bucket, so the same user keeps getting the same variation, and the percentage can be raised over time without a redeploy.

    You might describe it as

    • ship the code switched off and turn it on later
    • a kill switch for the new feature
    • turn one feature on for some users without a deploy

    Not to be confused with

    • Canary deploy

      A feature flag turns one feature on or off inside the same running version, with no deploy; a canary deploy sends a share of traffic to a new version of the whole app.

    • Change freeze

      A feature flag lets code be deployed switched off and turned on later, so teams can keep shipping right up to a freeze; a change freeze stops deploys, and often flag changes too, for a set window.