feat(sentry): Ajoute Sentry pour le suivi des erreurs

Ajoute Sentry pour le suivi des erreurs en production et améliore la
gestion des erreurs côté client et serveur.
```
This commit is contained in:
Serreau Jovann
2025-11-19 17:41:07 +01:00
parent 87e4dc6f8e
commit 7389c5f02b
5 changed files with 96 additions and 20 deletions

View File

@@ -2,6 +2,7 @@ import './app.scss'
import * as Turbo from "@hotwired/turbo"
import {PaymentForm} from './PaymentForm'
import * as Sentry from "@sentry/browser";
// --- CLÉS DE STOCKAGE ET VAPID ---
const VAPID_PUBLIC_KEY = "BKz0kdcsG6kk9KxciPpkfP8kEDAd408inZecij5kBDbQ1ZGZSNwS4KZ8FerC28LFXvgSqpDXtor3ePo0zBCdNqo";
@@ -427,6 +428,24 @@ document.addEventListener('DOMContentLoaded', ()=>{
// Gère le bandeau de cookies (bottom-right)
handleCookieBanner()
Sentry.init({
dsn: "https://129785624e32fc0d4d7d8002a03b77b7@o4509563601092608.ingest.de.sentry.io/4510392640340048",
// Setting this option to true will send default PII data to Sentry.
// For example, automatic IP address collection on events
sendDefaultPii: true,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration()
],
tunnel: "/tunnel",
// Tracing
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
const env = document.querySelector('meta[name="env"]')
if(env.getAttribute('content') == "prod") {
if (typeof navigator.serviceWorker !== 'undefined') {