Skip to content
Telemetry
Frontend reliability SQL recipe

Calculate browser long-task rate by route

Measure main-thread blocking events and their total blocked time by route and frontend release.

Intermediatebrowser_task_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

Which routes and releases spend the most time in browser long tasks?

Long tasks show where main-thread work can delay interaction even when network requests are fast. Rate and blocked time make both frequency and severity visible.

Event schema

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampTask completion time.
route_templateUtf8Stable page route.
releaseUtf8Frontend build identifier.
duration_msFloat64Observed main-thread task duration.
interaction_relatedBooleanWhether the task overlapped a measured interaction.
DataFusion SQL

Copy the query

sql
SELECT
  route_template,
  release,
  COUNT(*) AS observed_tasks,
  SUM(CASE WHEN duration_ms > 50 THEN 1 ELSE 0 END) AS long_tasks,
  SUM(CASE WHEN duration_ms > 50 THEN duration_ms - 50 ELSE 0 END)
    AS blocked_time_ms,
  100.0 * SUM(CASE WHEN duration_ms > 50 THEN 1 ELSE 0 END)
    / NULLIF(COUNT(*), 0) AS long_task_rate_pct
FROM browser_task_events
WHERE timestamp_utc >= now() - INTERVAL '7 days'
GROUP BY route_template, release
ORDER BY blocked_time_ms DESC;

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

Blocked main-thread time by route

The editor creates more than twice the blocked time despite fewer observed tasks.

route_templatereleaseobserved_taskslong_tasksblocked_time_mslong_task_rate_pct
/editorweb-1039,20064452,1807
/dashboardweb-10315,40046223,8603

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

Blocked main-thread time by route: static chart of synthetic blocked_time_ms values from the Calculate browser long-task rate by route 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, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.

How the SQL works

  1. 1The 50 ms boundary follows the browser long-task convention.
  2. 2Blocked time subtracts the allowable first 50 ms so severity is additive.
  3. 3Group by release to compare long tasks before and after a deployment.

Edge cases to check

  • Browser support and sampling rates must be documented.
  • Background-tab work can be misleading.
  • Long tasks indicate blocking but do not identify the responsible function without complementary profiling.

Recommended dashboard

  • Bars: blocked_time_ms by route
  • Trend: long_task_rate_pct by release
  • Table: interaction-related long tasks

Alert guidance

Review sustained blocked-time regressions after a release; page only when tied to a critical workflow.

Read alert setup

Set up the events this query needs

Related instrumentation and guides

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