Feature Flag
Subject: Computer and Technology noun /ˈfiː.tʃər flæɡ/ 1 definition
- software-engineering
- software-deployment
- configuration-management
- continuous-delivery
-
Definition (noun)
Entry #357 · UpdatedA Feature Flag (also known as a feature toggle or feature switch) is a software engineering mechanism that wraps conditional code paths behind a configurable parameter evaluated at runtime. During execution, an application SDK or evaluation engine resolves the flag's value from local configuration files, distributed key-value stores, or a centralized management service—often applying targeting rules, contextual attributes, or deterministic hashing to decide which branch executes. By decoupling code deployment from feature activation, feature flags allow teams to integrate unfinished work safely on a shared main branch, conduct A/B experiments, execute progressive rollouts, and disable faulty behavior instantly without redeploying code. Unlike compile-time preprocessor directives or static startup settings that remain fixed for a process's lifetime, runtime feature flags support dynamic updates without restarts, though unretired flags accumulate branching complexity and technical debt over time.
Common Types
Release Flags: Short-lived toggles used in trunk-based development to deploy incomplete or unverified code paths safely to production while keeping them hidden until ready for gradual rollout.
Experiment Flags: Dynamic multivariate or weighted flags that deterministically assign users into control and treatment cohorts—typically via consistent hashing on user or session IDs—to evaluate product changes in A/B tests.
Operational Flags: Runtime circuit breakers and kill switches that let operators quickly disable non-essential subsystems, shed load, or bypass failing integrations during production incidents without a rollback deployment.
Permissioning Flags: Long-lived targeting flags evaluated against account tiers, tenant IDs, or allowlists to unlock gated capabilities for beta cohorts, paid plans, or internal testing groups.
Example
A checkout microservice uses an OpenFeature SDK synced over Server-Sent Events (SSE) with a flag-management service to evaluate the
checkout.one_click_payflag, applying deterministic hashing onuser_idto expose a redesigned payment flow to 10% ofus-east-1traffic. When Prometheus alerts show HTTP502errors climbing on the new gateway, an on-call engineer setscheckout.one_click_paytofalsevia the management service's REST API, pushing the updated JSON rule to all running pods within seconds and restoring the legacy checkout path without a code rollback.