feat: Sentry error monitoring for React frontend (#98)

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

* feat: add Sentry error monitoring and tracing to FastAPI backend

- Install sentry-sdk[fastapi] with auto-enabled FastAPI + Anthropic
  integrations
- Init before app = FastAPI() with env-aware sample rates
  (100% dev, 20% prod)
- Filter /health endpoint from traces to reduce noise
- Add SENTRY_DSN to config settings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit was merged in pull request #98.
This commit is contained in:
chihlasm
2026-03-07 19:29:58 -05:00
committed by GitHub
parent 96966c3b72
commit e3a1e6fb75
10 changed files with 563 additions and 75 deletions

View File

@@ -1,11 +1,20 @@
/// <reference types="vitest/config" />
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [
react(),
sentryVitePlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
silent: !process.env.SENTRY_AUTH_TOKEN, // Don't error in local dev
}),
],
server: {
host: '0.0.0.0',
watch: {
@@ -24,6 +33,7 @@ export default defineConfig({
include: ['src/**/*.{test,spec}.{ts,tsx}'],
},
build: {
sourcemap: 'hidden', // Generate source maps but don't expose them publicly
rollupOptions: {
output: {
manualChunks: {