RousselTMLEARNING

Article · Grafana Faro: front-end observability and RUM

Errors, events and sessions

1. Errors #

Automatic and manual.

Capture #

Web instrumentations automatically capture unhandled exceptions (window.onerror) and rejected promises. For a handled error, send it explicitly:

import { faro } from '@grafana/faro-web-sdk';

try {
  await payer(panier);
} catch (err) {
  faro.api.pushError(err, { context: { etape: 'paiement', montant: String(panier.total) } });
  afficherMessage('Le paiement a échoué');
}

Source maps #

In production, code is minified: a stack trace points to main.4f3a.js:1:20345. With source maps, the stack is translated back to the original file and line. Alloy can download them from your site or read them from disk:

faro.receiver "front" {
  sourcemaps {
    download = false
    location {
      path                 = "/var/www/sourcemaps"
      minified_path_prefix = "https://boutique.example.org/assets/"
    }
  }
  // ...
}
Common mistake: You do not necessarily want to publish your source maps on the public site: they reveal the source code. Place them on the receiver's disk instead.

2. Logs, events, measurements #

Instrumenting the business.

API #

// Événement métier (tunnel de conversion)
faro.api.pushEvent('ajout_panier', { produit: 'casque-x', quantite: '1' });

// Mesure personnalisée (valeurs numériques)
faro.api.pushMeasurement({ type: 'panier', values: { articles: 3, total: 129.9 } });

// Log applicatif
faro.api.pushLog(['Filtre appliqué', JSON.stringify(filtres)]);

Events let you build funnels (page views → add to cart → payment) and link a drop in conversion to an error or slowness.

➜ To go further: Conversion funnels in RUM: building, reading and comparing funnels in Faro, Dynatrace, Datadog and New Relic.

3. Sessions and users #

With care.

Sessions #

Faro creates a session identifier and adds it to all signals: you can find everything a session went through (pages, errors, slow requests).

initializeFaro({
  // ...
  sessionTracking: { enabled: true, samplingRate: 0.2 },   // 20 % des sessions
});

// Après connexion : identifiant technique, jamais l'e-mail
faro.api.setUser({ id: 'u-7f3a', attributes: { offre: 'premium' } });
Common mistake: Send no email, name or form content. The identifier must be pseudonymous and the collection covered by your privacy policy (see the lesson on operations).

📄 Faro: JavaScript errors, logs, business events and sessions →

My progress

  • ⏱ Estimated time : ≈ 7 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

Frontend Observability in Grafana Cloud

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

Using Faro data: queries, dashboards, alerts and GDPR

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

Front-end observability best practices with Faro

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

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

Conversion funnels in RUM: measuring where users drop off

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

Business observability with Dynatrace: business events, KPIs and Business Flow

Link technical and business in Dynatrace: business events (bizevents) captured by OneAgent, API o...

Grafana Faro: architecture and installation

Install Grafana Faro: the web SDK (npm or CDN), Alloy's faro.receiver, sending to Loki and Tempo,...

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

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

Sending telemetry to ClickStack: OpenTelemetry SDKs, collectors, logs, Kubernetes and browser sessions

Feeding ClickStack: ingestion key, OpenTelemetry SDK variables, forwarding through an existing co...

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!