This article is available in French.
1. Interroger Loki #
Les signaux Faro sont des logs structurés.
Requêtes LogQL #
Chaque signal Faro arrive dans Loki sous forme de ligne au format logfmt, avec un champ kind (measurement, exception, log, event) et des métadonnées (application, version, page, navigateur, session).
# Erreurs JavaScript par message
sum by (value) (count_over_time({app_name="boutique"} | logfmt | kind="exception" [1h]))
# LCP au 75e percentile par page
quantile_over_time(0.75, {app_name="boutique"} | logfmt | kind="measurement" | lcp != "" | unwrap lcp [15m]) by (page_url)
# Événements « ajout_panier » par version
sum by (app_version) (count_over_time({app_name="boutique"} | logfmt | kind="event" | event_name="ajout_panier" [1h]))À savoir : Les noms exacts des labels et des champs dépendent de la version d'Alloy et de votre configuration : ouvrez une ligne dans Explore pour les vérifier avant d'écrire un dashboard.
2. Dashboards et alertes #
Suivre l'expérience utilisateur.
Un dashboard front-end #
| Panneau | Contenu |
|---|---|
| Web Vitals p75 | LCP, INP, CLS par page et par version |
| Erreurs | Nombre d'exceptions, top 10 des messages, navigateurs concernés |
| Volume | Sessions, pages vues |
| Requêtes lentes | Traces fetch > 1 s |
| Conversion | Entonnoir d'événements métier |
Alertes #
# Règle Loki (ruler) ou Grafana : pic d'erreurs JavaScript après un déploiement
sum(count_over_time({app_name="boutique"} | logfmt | kind="exception" [10m])) > 50Bonne Pratique : Comparez toujours par app_version : une hausse d'erreurs limitée à la dernière version pointe immédiatement le déploiement fautif.3. RGPD et confidentialité #
Mesurer sans pister.
Règles #
| Principe | Mise en œuvre |
|---|---|
| Consentement | Si la collecte n'est pas strictement nécessaire, initialiser Faro seulement après accord (bandeau de consentement) |
| Minimisation | Pas d'e-mail, de nom, de contenu de formulaire ; URL nettoyées de leurs paramètres sensibles |
| Pseudonymisation | Identifiant utilisateur technique, jamais direct |
| Échantillonnage | samplingRate pour ne collecter qu'une partie des sessions |
| Conservation | Rétention Loki courte pour ces données (30 jours par exemple) |
initializeFaro({
// ...
beforeSend: (item) => {
// retirer les paramètres d'URL des métadonnées de page
if (item.meta?.page?.url) item.meta.page.url = item.meta.page.url.split('?')[0];
return item;
},
ignoreErrors: [/ResizeObserver loop/, /Script error\./],
});My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
Understanding the concept of score
The concept of score allows Elasticsearch to rank your documents by relevance during a search.
Understanding the Elastic Common Schema (ECS)
As always in our consulting engagements, we recommend that companies harmonise and standardise: k...
License consumption types
Understand the evolution of billing in Dynatrace: the difference between the old licensing model ...
Grafana Alloy: The importance of Self-Monitoring
Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...
Grafana Alloy: Understanding and exploiting the User Interface (UI)
Discover how to enable, secure, and use Grafana Alloy's built-in web interface to visualize your ...
Grafana Alloy: Introduction and Architecture
Discover the fundamental concepts of Grafana Alloy, the transition from the static Agent to Alloy...
Grafana Alloy: Syntax and Configuration (Alloy Language: River)
As part of a Grafana training or observability training, master the declarative syntax of Grafana...
Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)
Learn how to configure Grafana Alloy to collect, transform, and forward metrics using the Prometh...
Grafana Alloy: Log Management with Loki
Discover how to configure Grafana Alloy to read log files, journald, or network streams, process ...