Skip to content
Telemetry
Frontend reliability SQL recipe

Find slow frontend resources by host

Rank scripts, stylesheets, images, and API resources by tail duration, failures, and transferred bytes.

Beginnerfrontend_resource_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 resource hosts and types are slowing or failing page loads?

Resource timing connects a slow page to the host and resource class that consumed the time. Host-level grouping avoids collecting sensitive full URLs.

Event schema

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampResource completion time.
resource_hostUtf8Approved hostname without path or query values.
resource_typeUtf8script, stylesheet, image, fetch, or another bounded class.
duration_msFloat64Resource duration.
transfer_bytesInt64Transferred response bytes when available.
statusUtf8success, failed, or blocked.
DataFusion SQL

Copy the query

sql
SELECT
  resource_host,
  resource_type,
  COUNT(*) AS resources,
  approx_percentile_cont(duration_ms, 0.95) AS p95_duration_ms,
  SUM(transfer_bytes) AS transfer_bytes,
  SUM(CASE WHEN status <> 'success' THEN 1 ELSE 0 END) AS failures
FROM frontend_resource_events
WHERE timestamp_utc >= now() - INTERVAL '24 hours'
GROUP BY resource_host, resource_type
HAVING COUNT(*) >= 20
ORDER BY p95_duration_ms DESC, failures 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

p95 resource duration by host

The analytics script is slower and fails more often than the first-party fetch group.

resource_hostresource_typeresourcesp95_duration_mstransfer_bytesfailures
analytics.examplescript2,1401,82068,480,00042
api.examplefetch8,210910124,200,00018

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

p95 resource duration by host: static chart of synthetic p95_duration_ms values from the Find slow frontend resources by host 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. 1Host and type preserve ownership without storing full resource URLs.
  2. 2High p95 duration shows that some third-party requests are slow even when most finish sooner.
  3. 3Compare transferred bytes with duration to check whether larger responses explain the slowdown.

Edge cases to check

  • Cross-origin timing detail depends on browser policy.
  • Cached resources require separate interpretation.
  • Never store signed URLs, query strings, or user-specific paths.

Recommended dashboard

  • Bars: p95_duration_ms by host
  • Trend: failures by resource type
  • Table: transfer_bytes by approved host

Alert guidance

Alert when a critical first-party host fails or a reviewed third-party p95 crosses its budget.

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