Telemetry
API reliability SQL recipe

Compare Feature Rollout Error Rate

Compare request errors and average latency between feature-flag rollout and control cohorts for one release.

Beginnerfeature_rollout_eventsReviewed 2026-07-28Tested with Apache DataFusion 45.2.0

Reviewed by the Telemetry product team on . SQL compatibility, event contract, synthetic output, and operational caveats. Editorial ownership

Question answered

Is the feature-flag rollout less reliable than its control cohort?

A rollout decision needs a like-for-like control at the same release boundary. This query keeps requests, errors, error rate, and latency together for each feature-flag cohort so a small but important reliability regression is visible.

Event contract

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampRequest completion time in UTC.
feature_flagUtf8Controlled feature-flag name.
cohortUtf8Rollout or control assignment.
releaseUtf8Application release identifier.
statusUtf8Terminal success or failed status.
latency_msInt64End-to-end request latency in milliseconds.
environmentUtf8Deployment environment.
DataFusion SQL

Copy the query

sql
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_flagcohortreleaserequestserrorserror_rate_pctavg_latency_ms
new-checkoutrolloutapi-885120300
new-checkoutcontrolapi-88500200

Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.

Rollout error rate by cohort: static chart of synthetic error_rate_pct values from the Compare Feature Rollout Error Rate example result
Indexable SVG of the deterministic example output. Download it for an article, runbook, or design review with attribution.

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

  1. 1Feature flag, cohort, and release make the comparison reproducible at the rollout boundary.
  2. 2Request volume beside error rate exposes comparisons that are too small for a confident decision.
  3. 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 setup

Put the recipe to work

Related instrumentation and guides

Continue the analysis

Run 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.

Get an API key