Skip to content
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 . We checked the SQL syntax, required event fields, sample results, and limits on using the query. Who reviews this page

Question answered

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

Compare rollout and control groups on the same release. This query shows requests, errors, error rate, and latency for each feature-flag cohort so you can spot regressions.

Event schema

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. We review the synthetic sample output separately. Check field types, thresholds, and counting rules 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
Download this SVG chart of the sample results for an article, runbook, or design review. Please credit Telemetry.

Reproduce the example

Download the sample data

The JSON bundle includes the event schema with field types, reproducible input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.

How the SQL works

  1. 1Record the feature flag, cohort, and release so someone else can repeat the rollout comparison.
  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 check

  • Assignment must be stable enough that the same account does not switch cohorts inside the comparison window.
  • Compare groups with similar traffic and customer mixes. If they differ, split the results by an approved field such as plan or region.
  • 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

Set up the events this query needs

Related instrumentation and guides

Define the source data

Event schemas for this analysis

Continue the analysis

Run it on your 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