Files
nexus/wiki/concepts/Feature-Flag.md
2026-04-16 17:30:41 +08:00

36 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Feature Flag"
type: concept
tags: [持续交付, 特性管理, 发布工程]
sources: ["https://launchdarkly.com/blog/rto-vs-rpo/"]
last_updated: 2025-07-26
---
## Definition
Feature Flag特性开关是一种将代码部署与功能发布分离的技术允许在不重新部署的情况下通过配置切换代码执行路径。
## Key Concepts
- Deploy != Release部署代码但不立即向用户开放
- Kill Switch紧急关闭机制用于快速禁用问题功能
- 渐进式 Rollout分阶段向用户群发布1% → 5% → 25% → 100%
## Benefits for RTO/RPO
- RTO从小时级降至秒级只需关闭开关
- RPORollback 时不丢失数据,只需切换代码路径
## Code Example
```javascript
if (featureFlag.enabled('new-checkout-flow')) {
return newCheckoutProcess();
} else {
return oldCheckoutProcess();
}
```
## Connections
- [[Kill Switch]] ← 紧急机制 → [[Feature Flag]]
- [[渐进式发布]] ← 发布策略 → [[Feature Flag]]
- [[RTO (Recovery Time Objective)]] ← 降低工具 → [[Feature Flag]]
- [[RPO (Recovery Point Objective)]] ← 保护工具 → [[Feature Flag]]
- [[LaunchDarkly]] ← 平台 → [[Feature Flag]]