Skip to content
EN

Что такое Feature Flags

Коротко:

Feature Flags (feature toggles) — mechanism включения/выключения функций в runtime без deploy. Code: if (flags.isEnabled("new-checkout")) { ... }. Позволяет: gradual rollout, A/B testing, kill switch для broken features, targeted release (только beta users, RU segment). Tools: LaunchDarkly ($), GrowthBook (open-source), Unleash, ConfigCat, feature-service build own.

Ниже: подробности, пример, смежные термины, FAQ.

Проверить свой сайт →

Подробности

  • Release flags: progressive rollout %
  • Experiment flags: A/B test 50/50
  • Kill switch: emergency disable feature
  • Permission flags: user/tenant-based access
  • Ops flags: on/off for infrastructure (circuit breaker)

Пример

// LaunchDarkly example
import { LDClient } from 'launchdarkly-node-server-sdk'
const ld = LDClient.init(sdkKey)
if (await ld.variation('new-checkout', user, false)) {
  return renderNewCheckout()
}

Смежные термины

How Feature Flags Work

Feature Flags operate by using a centralised system to manage which features are enabled or disabled. Developers can define flags in their code, which are then managed externally, allowing changes to be made without redeploying the entire application. if (flags.isEnabled("new-checkout")) { ... } is an example of how you might use a Feature Flag in code.

When a flag is toggled, the application can dynamically adjust its behaviour based on the flag's state. This is particularly useful in environments where rapid changes are required, such as in continuous integration and continuous deployment (CI/CD) pipelines.

Tools for Implementing Feature Flags

Several tools can be used to implement Feature Flags, each offering different features and pricing models. Popular choices include LaunchDarkly, GrowthBook, Unleash, and ConfigCat.

  • LaunchDarkly is a paid service that provides a robust platform for managing feature flags. It offers real-time monitoring and analytics, making it easier to track the performance of features in production.
  • GrowthBook is an open-source tool that allows developers to create and manage feature flags. It's a good option for those who prefer to have control over their infrastructure.
  • Unleash is a lightweight and flexible tool that can be quickly integrated into existing applications.
  • ConfigCat is a tool that offers a simple and intuitive interface for managing feature flags, making it easy to enable or disable features as needed.

Best Practices for Using Feature Flags

When using Feature Flags, it's important to follow best practices to ensure smooth and efficient operation. Here are some key practices:

  • Plan ahead: Define your feature flag strategy before implementation to ensure it aligns with your development goals.
  • Keep flags simple: Avoid complex logic in your flags to make them easier to manage and understand.
  • Monitor usage: Regularly check the usage of your flags to identify any issues or opportunities for improvement.
  • Communicate changes: Keep stakeholders informed about changes made using feature flags to maintain transparency and alignment.
  • Test thoroughly: Before enabling a new feature flag in production, thoroughly test it in a controlled environment to avoid any unintended consequences.

By following these best practices, you can effectively use Feature Flags to enhance your development process.

Больше по теме

Часто задаваемые вопросы

Зачем нужны если есть canary?

Canary — деploy-time gradual. Feature flags — runtime toggle. Flags живут дольше (недели): progressive rollout + experiments + kill switch.

Debt feature flags — проблема?

Да. Old flags захламляют code. Лучшая practice: TTL на flag, auto-reminder в PR review через 30 дней.

Open-source tools?

GrowthBook (free + paid), Unleash (free for 1 project), Flipt. LaunchDarkly — premium SaaS.

Запустить инструмент, который описан в этой статье

Бесплатный тариф — 10 мониторов, проверки каждые 5 мин, без карты. Платные тарифы — интервал от 1 минуты и проверки из нескольких регионов.