What you will learn in this TP
- Instrument a page with the SDK
- Configure Alloy's Faro receiver
- Read the Web Vitals in Loki
All steps and instructions are shown. Recommended for this lab: guided
Introduction #
Context. The marketing team complains that the home page is “slow on mobile”. The server metrics look fine: you will measure what browsers actually experience.
Prerequisites: Docker Compose, a web browser · Estimated time: 40 min
Your first RUM measurements.Setup #
Guided steps, with their solutions.
1. Write the page
Why? The CDN SDK is enough for a static page; by default it collects errors, logs, Web Vitals and sessions.
Createsite/index.htmlwith the SDK and two buttons (an event and an error).2. Configure Alloy
Why? The receiver must allow the page's origin (CORS), otherwise the browser blocks the request.
Createconfig.alloy:faro.receiversending to Loki and Tempo.3. Start the stack
Why? nginx serves the page, Alloy receives, Loki and Tempo store, Grafana displays.
Writetempo.yamland the Compose file, then start everything.4. Generate data
Why? Web Vitals are sent as the user browses and when the page goes into the background.
Openhttp://localhost:8080, click both buttons, reload several times and switch tabs. In the Network tab, check the requests sent to/collect.5. Explore in Grafana
Why? Faro signals are structured logs in Loki.
Add the Loki data source (http://loki:3100) and explore the application's lines. Find a Web Vitals measurement, the event and the exception.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Course Glossary
Core Web Vitals
Set of three metrics defined by Google to measure the real experience of a web page: loading (LCP (Largest Contentful Paint)), responsiveness (INP (In...
LCP (Largest Contentful Paint)
Time until the largest visible element of the page (image, video or text block) is rendered: it shows when the main content appears. Loading metric of...
INP (Interaction to Next Paint)
Latency of interactions (click, tap, key press) observed over the whole visit: the delay between the user's action and the next paint. The reported va...
CLS (Cumulative Layout Shift)
Measure of visual stability: the sum of unexpected layout shifts (a button moving just as you click, text pushed down by an ad). Unitless, computed ov...
FCP (First Contentful Paint)
Time until the first content (text, image, SVG) is rendered: the moment the user sees the page start loading. It is not a Core Web Vital, but it helps...
TTFB (Time to First Byte)
Time between the start of navigation and the arrival of the first byte of the response: it adds up redirects, DNS, TCP/TLS connection and server proce...
FID (First Input Delay)
Former responsiveness metric of the Core Web Vitals: the delay before the browser starts handling the first interaction (good ≤ 100 ms). It ignored la...
TBT (Total Blocking Time)
Lab metric (Lighthouse): the sum, between FCP (First Contentful Paint) and the end of loading, of the blocking part of each long task (over 50 ms) on ...
CrUX (Chrome UX Report)
Google's public dataset aggregating the Core Web Vitals measured from real Chrome users (at the 75th percentile, per origin and URL, over a rolling 28...
Lighthouse
Google's free audit tool, built into Chrome DevTools and PageSpeed Insights: it loads the page in a simulated environment and scores performance, acce...
Apdex
Application Performance Index: a satisfaction score between 0 and 1 based on a time threshold T. Requests under T are “satisfied”, between T and 4T “t...
Recommended Articles
Real User Monitoring (RUM) and Core Web Vitals: measuring what users experience
Why observe the front end, what RUM measures, Core Web Vitals (LCP, INP, CLS) and their threshold...
Grafana Faro: architecture and installation
Install Grafana Faro: the web SDK (npm or CDN), Alloy's faro.receiver, sending to Loki and Tempo,...
Using Faro data: queries, dashboards, alerts and GDPR
Query Faro data in Loki (Web Vitals, errors, events), build dashboards and alerts, and comply wit...
Faro and Alloy: receiving front-end RUM with faro.receiver
Configure faro.receiver: CORS, API key, rate limiting, source maps, then send browser errors, Web...
Front-end observability best practices with Faro
Checklist for useful, respectful RUM: SDK configuration, versions, source maps, correlation with ...
Frontend Observability in Grafana Cloud
Frontend Observability in Grafana Cloud: RUM built on Grafana Faro. Web Vitals, JavaScript errors...
Case study: this site's minimal RUM, cookie-free, exposed to Prometheus
How this site measures its Core Web Vitals with about forty lines of JavaScript, an anonymous bea...
Grafana Alloy components reference
A complete reference guide to all the components available in Grafana Alloy, organized by categor...
From click to database: front-end to back-end traces with Faro
Link browser requests to back-end traces: TracingInstrumentation, traceparent header propagation,...