Structuring an Observability Suite
I'm guiding the development of an observability suite focused on feature flags. Key components include schema design, correlation, and playbooks. I’m documenting practical artifacts like event schemas, spans, metrics, and logs. I’ll emphasize using OpenTelemetry with attributes like flag key, variant, and user ID hash, while considering privacy. I plan to address trace correlation and provide guidelines to avoid cardinality explosions.
There will be metrics for exposure and error rates alongside guardrails, incident playbooks, and runbooks to streamline incident management.Creating Self-Service Dashboards
I'm focusing on building self-service dashboards that provide a per-flag overview, including rollout status, health metrics, segment details, and targeted populations. I want to include an audit log feature. For postmortems, there should be a template summarizing the impact, timeline, detection, resolution, contributing factors, and action items along with lessons learned for rollout improvements.
Additionally, I’ll discuss the ingest pipeline for flag service and SDK events, storage, and governance. I plan to outline a step-by-step approach including foundations, instrumentation, analysis, automation, and operations.
0) Target outcomes and operating model
A “feature-flag observability suite” should let you answer, quickly and reliably:
- What did users experience? (flag evaluated? which variant? why?)
- Did it hurt health or performance? (errors/latency/saturation/cost)
- Can we correlate incidents to a flag change? (trace/log correlation + audit trail)
- Can we safely roll out and auto-stop? (guardrails + rollback)
- Can non-experts self-serve? (dashboards + playbooks + postmortems)
The core data streams you’ll standardize:
- Flag evaluation telemetry (from SDKs/services)
- Flag configuration/audit events (from the flag control plane)
- System telemetry (traces/metrics/logs)
- Business/product events (optional but powerful for “impact”)
1) Telemetry schema design (events, metrics, logs)
1.1 Principles (avoid common traps)
- Every evaluation must be attributable to:
- flag (key + version), variant, reason, context (anonymized), environment, service
- Protect privacy & control cardinality
- Never emit raw user identifiers; hash/salt them, or use stable pseudonymous IDs
- Avoid high-cardinality dimensions in metrics; keep rich detail in traces/logs/events
- Make config changes first-class telemetry
- You need an immutable audit log of “who changed what, when” and “what rules were active”
1.2 Canonical “Flag Evaluation” event schema
Emit as structured logs or as an OpenTelemetry log/event (and/or a dedicated event stream).
Event name: feature_flag.evaluation
Required fields
timestamp
flag.key (string; stable identifier)
flag.version (string/int; monotonic config revision)
flag.provider (e.g., launchdarkly, homegrown)
flag.variant (string; e.g., control, treatmentA, off)
flag.enabled (bool)
evaluation.reason (enum: TARGETING_MATCH, FALLTHROUGH, DEFAULT, ERROR, PREREQ_FAILED, KILLSWITCH, STALE_CACHE)
evaluation.rule_id (string; stable id for the matched rule, if any)
evaluation.bucket (optional; for percentage rollouts, the bucket or seed id)
app.env (prod, staging)
service.name
service.version (build SHA)
sdk.name / sdk.version
host.id / pod.name (optional)
Correlation fields
trace_id / span_id (when evaluation happens within a request)
request.id (if you have one)
session.id (hashed/pseudonymous)
user.id_hash (hashed; optional)
tenant.id_hash (if B2B; optional)
Performance fields
evaluation.latency_ms (client-side SDK evaluation time)
provider.latency_ms (if it called a remote service)
cache.hit (bool)
Safety/debug fields (optional)
context.kind (e.g., user/tenant/device)
context.attributes_present (list of keys only, not values; helps debugging)
error.type / error.message (if evaluation.reason=ERROR)
1.3 Canonical “Flag Change / Audit” schema
Event name: feature_flag.change
timestamp
flag.key
flag.version (new)
actor.type (user, service)
actor.id (internal id)
change.type (enum: CREATE, DELETE, ARCHIVE, RULE_ADD, RULE_EDIT, RULE_DELETE, TARGETING_CHANGE, ROLLOUT_CHANGE, KILL_SWITCH_ON, KILL_SWITCH_OFF)
change.summary (short text)
old_config_hash / new_config_hash
diff (optional; structured diff if you can store it)
ticket.id / change_request.id (strongly recommended)
app.env
This audit stream is what you join to incident timelines.
1.4 Metrics (low-cardinality, guardrail-friendly)
Emit metrics designed for alerting and dashboards:
Counters
feature_flag.evaluations_total{flag_key, env, service, variant}
Consider limiting variant if it explodes; keep variant in logs/traces.
feature_flag.evaluation_errors_total{flag_key, env, service, error_type}
feature_flag.provider_fetch_errors_total{provider, env, service}
Histograms
feature_flag.evaluation_latency_ms{flag_key, env, service}
feature_flag.provider_latency_ms{provider, env, service}
Gauges
feature_flag.config_staleness_seconds{env, service}
feature_flag.sdk_out_of_date{env, service} (0/1 or version distance)
Guardrail rule of thumb: if a label could be “userId”, it does not belong in metrics.
1.5 Logs and traces conventions
- Logs: include
flag.key, flag.variant, flag.version, evaluation.reason on important business/decision logs.
- Traces: add a standard attribute set on the request root span for any flag that influenced behavior.
2) Trace correlation (how to make flags show up in traces)
2.1 The goal
Given a slow/erroring trace, you should see:
- which flags were evaluated
- which variants were applied
- which config version/rule caused it
And given a flag rollout, you should be able to pull:
- a set of traces where
flag.key=X AND variant=Y to compare health.
2.2 Recommended OpenTelemetry approach
Option A (common): annotate the active span
- When a flag is evaluated, attach:
feature_flag.<key>.variant = "treatmentA"
feature_flag.<key>.version = "123"
feature_flag.<key>.reason = "TARGETING_MATCH"
- Pros: easy correlation; shows up in trace search
- Cons: too many attributes if many flags per request
Option B (preferred at scale): add “flag evaluation” span events
- Add an event to the current span:
- event name:
feature_flag.evaluation
- event attributes:
flag.key, variant, version, reason, rule_id, latency_ms
- Pros: avoids attribute explosion on root span; retains detail
- Cons: querying by event attributes depends on your backend
Option C: dedicated child span
- Create a span
FeatureFlag.evaluate for remote provider calls
- Pros: clear latency breakdown
- Cons: more spans; sampling considerations
2.3 Sampling strategy
- Always keep error traces.
- For flag-heavy endpoints, consider:
- keep detailed evaluation events only for a sampled subset
- but always emit aggregate metrics (evaluations, errors, latency)
2.4 Correlating to config changes
Join on:
flag.key + flag.version + env
- and align with
feature_flag.change timestamps
This is what enables “the spike started immediately after version N”.
3) Rollout guardrails (progressive delivery + auto-stop)
3.1 Define guardrail metrics per flag (template)
For every production flag, record:
- Owner (team + oncall)
- Blast radius (which services/endpoints/users)
- Guardrails:
- Technical:
5xx rate, p95 latency, CPU, OOM, queue depth, dependency error rate
- Product: conversion, checkout completion, churn, etc. (if applicable)
- Decision thresholds:
- e.g., “rollback if error rate increases by >0.3% absolute for 10 minutes”
- Observation windows:
- immediate (0–15 min), short (1–4h), long (1–7d)
3.2 Progressive rollout stages (example)
- Stage 0: internal only / staff cohort
- Stage 1: 1% for 30–60 min
- Stage 2: 5% for 1–2h
- Stage 3: 25% for 4–24h
- Stage 4: 50%
- Stage 5: 100%
Each stage has:
- automated checks (below)
- explicit approval or auto-advance if stable
3.3 Automated analysis (practical options)
- Simple thresholding (fast to ship):
- Compare current vs baseline for guardrails
- Canary comparison:
- If you can isolate traffic: compare canary vs control cluster
- Experiment-style comparison:
- Compare
variant=treatment vs variant=control for the same time window
Requires reliable exposure tracking (evaluations/exposures).
3.4 Auto-rollback / “kill switch” design
- Implement a server-side override path that can force:
flag.enabled=false or variant=control
- Overrides should be:
- immediate (<1 minute propagation)
- audited (
feature_flag.change)
- scoped (env, tenant, segment, global)
3.5 Guardrail alert examples
- “Flag evaluation errors”:
feature_flag.evaluation_errors_total rising or ratio > X%
- “Provider degraded”:
- provider fetch latency p95 > threshold
- config staleness increasing
- “Flag-associated service regression”:
- error/latency increase correlated with
flag.key=X AND variant=Y
4) Incident playbooks (runbooks you can execute under stress)
Create a playbook per “failure mode,” not per flag. Minimum set:
4.1 Playbook: suspected flag-induced outage
Signals
- Service error rate/latency spikes
- Recent
feature_flag.change in last 0–60 minutes
Triage checklist
- Identify recent flag changes (last hour) affecting the service
- For top candidate flags: compare traces/metrics split by
variant
- Verify evaluation consistency:
- sudden increase in
evaluation.reason=ERROR?
- config staleness?
- SDK version mismatch?
Mitigation
- Activate kill switch / force control
- If provider outage: enable local fallback mode or cached configs
- Roll back config to previous
flag.version
Verification
- Confirm regression metrics return to baseline
- Confirm evaluations show expected
reason and variant
Follow-ups
- Create incident ticket with
flag.key, versions involved, and links to dashboards
4.2 Playbook: flag provider/control-plane outage
Signals
- provider latency/errors up
- config staleness up
- SDK fetch failures
Actions
- Switch SDKs to offline/cached mode
- Reduce polling frequency if thundering herd
- Fail-safe behavior: decide “fail open” vs “fail closed” per flag class
- Communicate status; freeze rollouts
4.3 Playbook: targeting/rule bug (wrong audience)
Signals
- unexpected tenant/user reports
- exposure counts don’t match expected rollout %
Actions
- Validate rule logic against known test contexts
- Check
rule_id distribution and reason fields
- Temporarily scope down (turn off for the suspected segment)
- Add regression tests for targeting logic
4.4 Playbook: data/telemetry gap (can’t correlate)
Signals
- changes happened but traces don’t show flags; metrics missing labels
Actions
- Confirm SDK instrumentation enabled
- Confirm trace context propagation
- Confirm sampling not dropping required events
- Mitigate via config rollback if impact is severe; fix instrumentation afterward
5) Self-service dashboards (what to build so teams don’t ask you)
Design dashboards around the questions users ask.
5.1 “Flag Overview” dashboard (per flag key)
Sections:
- Current config snapshot: enabled, rollout %, rules, version, last change (who/when)
- Exposure / evaluation volume:
- evaluations over time
- variant split
- reason split (fallthrough, targeted, default, error)
- Health guardrails (overall + split by variant):
- error rate, p95 latency, saturation
- Dependencies:
- provider fetch latency/errors
- config staleness
- Top correlated traces/logs:
- links to trace search:
flag.key=X AND variant=Y
5.2 “Rollout Control” dashboard (for oncall + release managers)
- active rollouts and their stage
- auto-check status and next gate
- alerts firing for guardrails
- quick action links: kill switch / pause rollout
5.3 “Provider Health” dashboard
- control-plane API health
- streaming/polling health
- SDK fetch errors by service/version
- stale config gauge distribution
5.4 “Flag Hygiene” dashboard (governance)
- flags older than N days
- flags with no owner
- flags with no recent evaluations (dead)
- flags enabled at 100% for >N days (candidate to remove)
- flags with high evaluation error rates
- SDK versions in the fleet and “out of date” counts
6) Postmortem templates (flag-specific and repeatable)
6.1 One-page postmortem (template)
Title: Incident: regression due to feature flag <flag.key> (version <x→y>)
Date/Duration:
Severity:
Owners: Incident commander, flag owner, supporting teams
Customer impact
- Who was affected (segments/tenants/regions)?
- What was the symptom (errors, timeouts, wrong behavior)?
- Quantified impact (requests, revenue, conversions, etc.)
Detection
- How detected (alert, customer report)?
- Time to detect (TTD)
Timeline (UTC)
- T0: change deployed / flag changed (
feature_flag.change link)
- T1: first symptom
- T2: alert fired
- T3: mitigations (kill switch, rollback)
- T4: recovery confirmed
Root cause
- Technical mechanism (what exactly broke)
- Why it only affected variant/segment X
- Why guardrails didn’t prevent it (or did, but not fast enough)
Contributing factors
- Missing test coverage? targeting complexity? provider degradation?
- Telemetry gaps? sampling? lack of correlation fields?
What went well
- Fast rollback? good dashboards? clear ownership?
What didn’t go well
- Confusing rule behavior? missing runbook? slow approvals?
Action items
- Prevent recurrence (code/test)
- Improve rollout safety (guardrails, staged rollout defaults)
- Improve observability (schema fields, dashboards, alerts)
- Flag lifecycle cleanup (remove flag, consolidate)
Appendix
- Links to dashboards, traces, logs, diff of flag config, PRs
6.2 Add two flag-specific fields
- Fail mode expectation: should this flag fail open or fail closed?
- Safe rollback path: what is the known-good variant/config version?
7) Implementation plan (phased so it actually ships)
Phase 1: Foundations (1–2 weeks)
- Standardize schemas (
feature_flag.evaluation, feature_flag.change)
- Decide privacy rules + hashing strategy
- Add flag change audit export
Phase 2: Instrumentation (2–6 weeks)
- SDK/server instrumentation emitting evaluation telemetry
- Trace correlation (span events or attributes)
- Base metrics (eval count/errors/latency, staleness)
Phase 3: Dashboards + alerts (2–4 weeks)
- Flag Overview dashboard template + Provider Health dashboard
- Guardrail alert templates + runbooks
Phase 4: Progressive delivery guardrails (4–8 weeks)
- Rollout stages + automated checks
- Kill switch/override hardening
- Auto-rollback integration (optional initially; start with “auto-pause + page”)
Phase 5: Governance + hygiene (ongoing)
- Ownership enforcement, flag TTLs, cleanup SLAs
- “flag hygiene” dashboards and periodic reviews
8) A few design decisions to settle early (so you don’t rebuild later)
-
Exposure definition: is “evaluation” the same as “exposure”?
- Many teams treat exposure as “user actually saw/was affected,” not merely evaluated. If you need experiment-quality analysis, define and instrument exposure separately.
-
Fail-open vs fail-closed per flag class
- Safety flags (e.g., auth checks) often fail closed; UI tweaks fail open.
-
Variant cardinality limits
- Keep variants small and stable; don’t use dynamic strings.
-
Config versioning
- Ensure every config publish increments
flag.version and is queryable.
If you share (a) which flag system you use (LaunchDarkly/Unleash/homegrown), (b) your telemetry stack (OpenTelemetry + Prometheus/Grafana/Datadog/New Relic/etc.), and (c) whether you need experiment-grade analysis, I can tailor the concrete schemas to your backend (exact attribute names, dashboard widgets, and alert queries).