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

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 contract

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

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
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. 1Host and type preserve ownership without storing full resource URLs.
  2. 2Tail duration reveals intermittent third-party slowness.
  3. 3Transferred bytes helps distinguish latency from payload growth.

Edge cases to decide

  • 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

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