Files
novalon-website/src/lib/sentry.ts
T
张翔 4ece85a9c3 feat: 添加生产环境部署和监控配置
- 新增生产环境部署脚本和文档
- 添加监控系统配置(Alertmanager, Prometheus, Grafana)
- 更新e2e测试用例以适配新环境
- 添加.env.production配置文件
- 优化Sentry初始化逻辑为动态加载
- 新增全局设置脚本以支持不同环境
2026-03-09 16:37:23 +08:00

16 lines
490 B
TypeScript

export function initSentry() {
if (process.env.NODE_ENV === 'production' && process.env.NEXT_PUBLIC_SENTRY_DSN) {
import('@sentry/nextjs').then(({ init }) => {
init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV,
tracesSampleRate: 0.1,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
}).catch((error) => {
console.error('Failed to initialize Sentry:', error);
});
}
}