6 / 67 · 06 Observability-Driven Testing · Testing in Production Using Feature Flags← prev⊞ allnext →☰ Read as one page
1.6Monitoring Feature Flag Impact
Every feature flag should have associated metrics that answer:
- Is the new code path working? (Error rate per flag state)
- Is it performant? (Latency per flag state)
- Is it better for users? (Business metrics per flag state)
- Is it stable? (No degradation trend over time)
# Prometheus metrics for feature flag monitoring
from prometheus_client import Counter, Histogram
flag_requests = Counter(
'feature_flag_requests_total',
'Total requests per feature flag state',
['flag_name', 'flag_state', 'outcome']
)
flag_latency = Histogram(
'feature_flag_latency_seconds',
'Latency by feature flag state',
['flag_name', 'flag_state'],
buckets=[0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0]
)
Feature flags are the foundation of production testing. They transform deployment from a risky event into a controlled experiment with measurable quality outcomes.