Telemetry
Frontend reliability SQL recipe

Compare Core Web Vitals by Route and Release

Compare LCP, INP, and CLS samples by stable route and release while keeping the percentage of passing samples visible.

Intermediatefrontend_vital_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

Which route and release has the weakest frontend performance?

Frontend averages become actionable when they preserve route and release boundaries. This query pivots typed web-vital samples into one row per route and release, then orders the result by the share of samples that passed the product's reviewed thresholds.

Event contract

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampMeasurement time in UTC.
route_templateUtf8Stable route template without user or query-string values.
releaseUtf8Frontend release identifier.
metric_nameUtf8Controlled LCP, INP, or CLS metric name.
metric_valueFloat64Metric value in its documented unit.
passedBooleanWhether the sample passed the product's versioned threshold.
environmentUtf8Deployment environment.
DataFusion SQL

Copy the query

sql
SELECT
  route_template,
  release,
  COUNT(*) AS samples,
  AVG(CASE WHEN metric_name = 'LCP' THEN metric_value ELSE NULL END) AS avg_lcp_ms,
  AVG(CASE WHEN metric_name = 'INP' THEN metric_value ELSE NULL END) AS avg_inp_ms,
  AVG(CASE WHEN metric_name = 'CLS' THEN metric_value ELSE NULL END) AS avg_cls,
  100.0 * SUM(CASE WHEN passed THEN 1 ELSE 0 END)
    / NULLIF(COUNT(*), 0) AS passing_samples_pct
FROM frontend_vital_events
WHERE timestamp_utc >= now() - INTERVAL '7 days'
  AND environment = 'production'
GROUP BY route_template, release
ORDER BY passing_samples_pct ASC, route_template, release;

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

Passing frontend samples by route

Checkout passes half of its synthetic LCP, INP, and CLS samples; search passes all samples.

route_templatereleasesamplesavg_lcp_msavg_inp_msavg_clspassing_samples_pct
/checkoutweb-10262,8002200.150
/searchweb-10261,8501200.05100

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

Passing frontend samples by route: static chart of synthetic passing_samples_pct values from the Compare Core Web Vitals by Route and Release 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. 1Route templates prevent one chart series per raw URL or customer identifier.
  2. 2The release dimension turns a performance change into a deploy-scoped investigation.
  3. 3Metric-specific averages remain beside a single passing-sample summary so reviewers can see which vital moved.

Edge cases to decide

  • Use reviewed metric-specific thresholds and record their version when definitions change.
  • Segment device class and geography only when sample volume protects the comparison from noise.
  • Prefer percentiles over averages for production experience reporting when the SQL engine and sample volume permit it.

Recommended dashboard

  • Bars: passing_samples_pct by route and release
  • Trends: LCP, INP, and CLS by complete day
  • Table: routes with sample count and release change

Alert guidance

Alert only when sample volume is sufficient and a route remains below its reviewed performance target for complete buckets.

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