Bookmarks

Feature flag

A mechanism for switching application features on and off on the fly — by changing a configuration value, without a new build or deployment.

Also: feature toggle, feature flipper, toggle, feature switch

checked 18 Nov

All terms

A feature flag is a condition in code of the form “if the flag is on, the new logic runs”. The flag value comes from configuration or a separate service, so a new feature can reach users — or be withdrawn — within minutes. This is how feature release is separated from deployment: the code is deployed, but not yet visible to anyone.

Deployment separate from release

Normally, “deploying the code” and “giving users a new feature” are one and the same action. With a flag the two are separated: new code reaches the servers switched off and is then enabled gradually. This lets you:

  • roll out a new feature not to everyone at once, but by user, team or percentage of traffic
  • roll back a problematic feature with a single change, without redeploying the old version
  • test new logic in production on a portion of traffic before enabling it fully
  • keep an unfinished feature in the main branch — it is simply switched off by the flag

Types of flags

TypePurposeLifetime
Release flagenable an unfinished or risky feature for some usersweeks, until fully enabled
Ops flagswitch a feature off during an incident — a kill switchlong-lived, lives in configuration
Experimentcompare variants by metrics, an A/B testuntil the experiment ends
Permissionsshow a feature only to a plan tier or a group of usersper product rules

OpenFeature

To avoid being tied to a single flag service, the open standard OpenFeature defines a single API for working with flags: the application calls this API, while the provider — the flag service itself — is plugged in separately. The project is part of the CNCF, and SDKs are available for the major languages.

pythonA flag as an ordinary condition in code
from openfeature import api client = api.get_client()if client.get_boolean_value("new-checkout", False):    show_new_checkout()else:    show_old_checkout()

Sources

the term is written from these pages

Verified 18 Nov

Not to be confused with

what it is mixed up with and how it differs

  • canary release

    A canary release directs part of the traffic to a new version of the whole application, while a flag switches an individual feature inside the code.

In depth in the references

where the topic is covered in detail