Measure how long the main thread makes users wait
lag is a set of monitors for browser apps, for real user monitoring of the main thread. Each monitor measures one signal of main-thread responsiveness, for example blocked time, long tasks or input latency (INP), and records it as an OpenTelemetry metric. The monitors calibrate their probes and discard the samples that are not valid. A Web Worker also measures the main thread from outside.
What the monitors measure
- Main-thread lag
- DriftLag measures how much of each 100 ms window other tasks block the main thread, with a timer baseline that it calibrates. DriftLag
- Long tasks and Long Animation Frames
- The monitor records each frame of 50 ms or more, its blocking duration and, in Chromium, the scripts that caused it. Long Animation Frames
- INP and the Web Vitals
- The page-view vitals give INP, CLS, LCP, FCP and TTFB for each page view, with the rules of web-vitals. Page-view vitals
- Hangs, seen from a Web Worker
- A worker measures main-thread blocks while they occur, and reports the hangs that a page did not survive. Worker lag
- Event loop lag
- Blocked time, queueing delay, frame delay and input latency are four different meanings of lag. Each has its monitor. The event loop
- OpenTelemetry browser metrics
- The monitors record counters and histograms that aggregate correctly over many browsers, for example in Grafana Mimir. Metrics model
What this site holds
Docs
How to install and use the monitors, what each monitor measures, and how the parts fit together.
40 pages. Start with:
Thesis
The argument of the project: the problem, the claims, the method and the evidence.
Research
Notes on browser support, clocks and timers, OpenTelemetry in the browser and related tools.
9 pages. Start with:
Results
The results of the test program: tests in each browser, coverage, mutation scores, measurements and budgets.