Event contract
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Request completion time in UTC. |
| feature_flag | Utf8 | Controlled feature-flag name. |
| cohort | Utf8 | Rollout or control assignment. |
| release | Utf8 | Application release identifier. |
| status | Utf8 | Terminal success or failed status. |
| latency_ms | Int64 | End-to-end request latency in milliseconds. |
| environment | Utf8 | Deployment environment. |
Copy the query
SELECT
feature_flag,
cohort,
release,
COUNT(*) AS requests,
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS errors,
100.0 * SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END)
/ NULLIF(COUNT(*), 0) AS error_rate_pct,
AVG(latency_ms) AS avg_latency_ms
FROM feature_rollout_events
WHERE timestamp_utc >= now() - INTERVAL '24 hours'
AND environment = 'production'
GROUP BY feature_flag, cohort, release
ORDER BY error_rate_pct DESC, cohort;This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. The deterministic sample output is synthetic and reviewed separately; validate field types, thresholds, and business definitions against your own data. Read the testing methodology.
Query result
Rollout error rate by cohort
The synthetic rollout cohort has a 20% failure rate while the control has none.
| feature_flag | cohort | release | requests | errors | error_rate_pct | avg_latency_ms |
|---|---|---|---|---|---|---|
| new-checkout | rollout | api-88 | 5 | 1 | 20 | 300 |
| new-checkout | control | api-88 | 5 | 0 | 0 | 200 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
Reproduce the example
Download the public fixture
The JSON bundle includes the typed event contract, reproducible input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.
How the SQL works
- 1Feature flag, cohort, and release make the comparison reproducible at the rollout boundary.
- 2Request volume beside error rate exposes comparisons that are too small for a confident decision.
- 3Latency remains in the same result because a rollout can regress experience without increasing errors.
Edge cases to decide
- Assignment must be stable enough that the same account does not switch cohorts inside the comparison window.
- Compare equivalent traffic and customer mixes or segment the result by a reviewed bounded dimension.
- Use confidence intervals and a longer window for irreversible product conclusions.
Recommended dashboard
- Bars: error_rate_pct by cohort
- Trend: requests, errors, and latency by rollout percentage
- Table: feature flags by release and minimum sample status
Alert guidance
Pause or roll back only after the rollout meets a reviewed minimum volume and exceeds its approved error or latency guardrail.
Read alert setupPut the recipe to work
Related instrumentation and guides
Continue the analysis
Calculate API Error Rate by Route
Use SQL to rank API routes by 5xx error rate while protecting the result from low-volume noise.
Open recipeCalculate p50, p95, and p99 API Latency
Compare median and tail latency by endpoint with DataFusion-compatible percentile SQL.
Open recipeCalculate API Error-Budget Burn Rate
Turn hourly request failures into an SLO burn-rate series that shows how quickly the allowed error budget is being consumed.
Open recipeRun it on real events
Create a table, adapt the fields, and save the result
Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.