Skip to 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 logs
| filter cx_rum.longtask_context.duration > 0
| groupby case_lessthan {
   cx_rum.longtask_context.duration:num,
   100 -> 'Green (0-100)',
   200 -> 'Orange (101-200)',
   300 -> 'Red (201-300)',
   _   -> 'Purple (301 - *)'
 } as Range
 agg count() as count

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.