Sentry Integration (補強 SignOz): - Add @sentry/nextjs for frontend error tracking + session replay - Add sentry-sdk[fastapi] for backend error tracking - Create sentry.client/server/edge.config.ts - Integrate with next.config.js + instrumentation.ts - Add Sentry exception capture in FastAPI error handler - Create deployment scripts for Self-Hosted @ 192.168.0.110 CI/CD Fixes: - Fix F821 Undefined name 'Field' in incidents.py - Add NEXT_PUBLIC_API_URL env var to CI build step - Add build-arg to Docker build verification E2E Test Improvements: - Fix strict mode violations in dashboard-acceptance tests - Add timeout increase for Phase 4 demo tests - Make tests more resilient to UI variations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
648 B
TypeScript
32 lines
648 B
TypeScript
/**
|
|
* Sentry Server Configuration
|
|
* ===========================
|
|
* Next.js Server-Side 錯誤追蹤
|
|
*
|
|
* 部署: Self-Hosted @ 192.168.0.110
|
|
*/
|
|
|
|
import * as Sentry from '@sentry/nextjs'
|
|
|
|
if (process.env.SENTRY_DSN) {
|
|
Sentry.init({
|
|
dsn: process.env.SENTRY_DSN,
|
|
|
|
// 環境標識
|
|
environment: process.env.NODE_ENV,
|
|
|
|
// Server-side 效能監控
|
|
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.2 : 1.0,
|
|
|
|
// 忽略常見的非錯誤
|
|
ignoreErrors: [
|
|
'ECONNREFUSED',
|
|
'ENOTFOUND',
|
|
'ETIMEDOUT',
|
|
],
|
|
|
|
// 只在生產環境發送
|
|
enabled: process.env.NODE_ENV === 'production',
|
|
})
|
|
}
|