Files
resolutionflow/frontend/src/instrument.ts
Michael Chihlas 7631b843a9 feat: add Sentry error monitoring, tracing, and session replay
- Install @sentry/react and @sentry/vite-plugin
- Create instrument.ts with error monitoring, browser tracing (20% prod),
  and session replay (10% sessions, 100% on errors)
- Wire React 19 reactErrorHandler() on createRoot error hooks
- Wrap router with wrapCreateBrowserRouterV7 for route-aware transactions
- Configure sentryVitePlugin for source map uploads
- Add VITE_SENTRY_DSN to .env.example

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:16:10 -05:00

26 lines
637 B
TypeScript

import * as Sentry from "@sentry/react";
Sentry.init({
dsn: import.meta.env.VITE_SENTRY_DSN,
environment: import.meta.env.MODE,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: false,
}),
],
// Tracing — capture 100% in dev, 20% in production
tracesSampleRate: import.meta.env.PROD ? 0.2 : 1.0,
tracePropagationTargets: [
"localhost",
/^https:\/\/api\.resolutionflow\.com/,
],
// Session Replay — record 10% of sessions, 100% of error sessions
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});