Skip to main content

Bucket longtask durations into performance ranges

Problem / Use case​

You want to monitor Real User Monitoring (RUM) longtask durations and categorize them into performance buckets (e.g., fast, moderate, slow) to track client-side performance issues by severity.

Query​

source default/rum.events
| filter longtask_context.duration > 0
| groupby case_lessthan {
longtask_context.duration:num,
100 -> 'Green (0-100)',
200 -> 'Orange (101-200)',
300 -> 'Red (201-300)',
_ -> 'Purple (301 - *)'
} as Range
agg count() as count
Note

This query targets the default/rum.events dataset, where RUM fields have no cx_rum. prefix. If your account still writes RUM data to default/logs, use source logs and write the field as cx_rum.longtask_context.duration. See Querying RUM logs.

Expected output​

Rangecount
Green (0-100)143973
Red (201-300)14961
Orange (101-200)36519
Purple (301 - *)6230

Variations​

  • Adjust bucket thresholds based on your UX performance criteria.
  • Swap count() for distinct_count(session_id) to measure impact per user session.

TL;DR​

Use case_lessthan to bucket longtask durations into performance ranges for easier trend analysis and alerting. Think of it as your RUM-grade Energon scanner.

Last updated on
Was this page helpful?