RousselTMLEARNING

Article · Grafana Faro: front-end observability and RUM

Faro architecture and installation

1. Architecture #

One SDK, one receiver, the LGTM stack.

Components #

Available in: ✓ OSS ✓ Enterprise ✓ Cloud Self-hosted collection through Alloy; Frontend Observability in Grafana Cloud

Grafana Faro architecture
All front-end data ends up in Loki (logs, errors, measurements) and Tempo (traces).

Grafana Faro is an open source JavaScript SDK that collects front-end signals and sends them to a receiver: Grafana Alloy's faro.receiver component (self-hosted) or Grafana Cloud Frontend Observability. Data is stored in Loki and Tempo, then used in Grafana.

2. The Alloy receiver #

Receive, route, expose.

Configuration #

faro.receiver "front" {
  server {
    listen_address       = "0.0.0.0"
    listen_port          = 12347
    cors_allowed_origins = ["https://boutique.example.org"]
    api_key              = "change-moi"        // facultatif : le SDK l'envoie dans x-api-key
    max_allowed_payload_size = "5MiB"
  }
  output {
    logs   = [loki.write.default.receiver]
    traces = [otelcol.exporter.otlp.tempo.input]
  }
}

loki.write "default" {
  endpoint { url = "http://loki:3100/loki/api/v1/push" }
}

otelcol.exporter.otlp "tempo" {
  client {
    endpoint = "tempo:4317"
    tls { insecure = true }
  }
}
Common mistake: The receiver is exposed on the Internet (browsers call it): restrict cors_allowed_origins to your domains, put it behind a reverse proxy with rate limiting, and monitor its volume.

3. The SDK #

npm or CDN.

With npm #

npm install @grafana/faro-web-sdk @grafana/faro-web-tracing
import { initializeFaro, getWebInstrumentations } from '@grafana/faro-web-sdk';
import { TracingInstrumentation } from '@grafana/faro-web-tracing';

initializeFaro({
  url: 'https://faro.example.org/collect',
  apiKey: 'change-moi',
  app: { name: 'boutique', version: '2.4.1', environment: 'production' },
  instrumentations: [
    ...getWebInstrumentations(),          // erreurs, console, Web Vitals, sessions, vues
    new TracingInstrumentation(),         // traces fetch/XHR
  ],
});

Without a build tool (CDN) #

<script src="https://unpkg.com/@grafana/faro-web-sdk@^1/dist/bundle/faro-web-sdk.iife.js"></script>
<script>
  window.GrafanaFaroWebSdk.initializeFaro({
    url: 'https://faro.example.org/collect',
    app: { name: 'vitrine', version: '1.0.0', environment: 'production' },
  });
</script>
Good practice: Always set version and environment: they let you compare two deployments and filter out staging.
Good to know: For React, Angular or Vue, dedicated integrations (for example @grafana/faro-react) add route names and rendering errors.

📄 Grafana Faro: architecture and installation →

My progress

  • ⏱ Estimated time : ≈ 8 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

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

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

The LGTM stack (Loki, Grafana, Tempo, Mimir): architecture and setup

Grafana Labs' LGTM stack: Loki for logs, Grafana for visualization, Tempo for traces, Mimir for m...

Front-end observability best practices with Faro

Checklist for useful, respectful RUM: SDK configuration, versions, source maps, correlation with ...

Using Faro data: queries, dashboards, alerts and GDPR

Query Faro data in Loki (Web Vitals, errors, events), build dashboards and alerts, and comply wit...

From click to database: front-end to back-end traces with Faro

Link browser requests to back-end traces: TracingInstrumentation, traceparent header propagation,...

Frontend Observability in Grafana Cloud

Frontend Observability in Grafana Cloud: RUM built on Grafana Faro. Web Vitals, JavaScript errors...

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

Conversion funnels in RUM: measuring where users drop off

Building and reading a conversion funnel with RUM data: steps, rates, order, pitfalls, and implem...

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

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!