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 . SQL compatibility, event contract, synthetic output, and operational caveats. Editorial ownership

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 contract

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

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
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, 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. 3Release grouping supports before-and-after review.

Edge cases to decide

  • 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

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