feat:集成Sentry

This commit is contained in:
leilei
2025-10-21 15:23:39 +08:00
parent 2b8e7349e6
commit f19ab86ada
4 changed files with 119 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import * as Sentry from '@sentry/vue';
import {
deepClone
@@ -20,6 +20,31 @@ import router from './router'
const pinia = createPinia()
const app = createApp(App)
Sentry.init({
app,
dsn: 'https://34a0d76174a64db09d31d13a8042560b@sentry.cnsdt.com/2', // 替换为你的 DSN
integrations: [
// 浏览器性能追踪集成
Sentry.browserTracingIntegration({
router,
}),
// 会话回放集成
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: false,
}),
],
// 性能监控采样率
tracesSampleRate: 1.0, // 生产环境建议设置为 0.1-0.2
// 会话回放采样率
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
// 环境配置
environment: import.meta.env.MODE,
// 开发环境下可禁用 Sentry
enabled: import.meta.env.PROD,
});
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}