Skip to main content
Definition Website Computer and Technology

Feature Flag

Subject: Computer and Technology noun /ˈfiː.tʃər flæɡ/ 1 definition

  1. Definition (noun)

    Entry #357 · Updated

    A 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_pay flag, applying deterministic hashing on user_id to expose a redesigned payment flow to 10% of us-east-1 traffic. When Prometheus alerts show HTTP 502 errors climbing on the new gateway, an on-call engineer sets checkout.one_click_pay to false via 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.