fix(sentry): update Sentry configuration and initialization logic

- Changed the organization in the Sentry Vite plugin configuration.
- Modified Sentry initialization in the main process to always check data collection settings.
- Simplified Sentry initialization in the renderer process by removing the packaged check.
This commit is contained in:
kangfenmao 2025-04-23 10:59:17 +08:00
parent 314be9b198
commit 6c6b2f0b9e
3 changed files with 13 additions and 15 deletions

View File

@ -69,7 +69,7 @@ export default defineConfig({
}), }),
sentryVitePlugin({ sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN, authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'cherry-ai-d6', org: 'cherry-ai',
project: 'cherry-studio' project: 'cherry-studio'
}), }),
...visualizerPlugin('renderer') ...visualizerPlugin('renderer')

View File

@ -3,9 +3,10 @@ import * as Sentry from '@sentry/electron/main'
import { app } from 'electron' import { app } from 'electron'
export function initSentry() { export function initSentry() {
if (app.isPackaged && configManager.getEnableDataCollection()) { if (configManager.getEnableDataCollection()) {
Sentry.init({ Sentry.init({
dsn: 'https://194ceab3bd44e686bd3ebda9de3c20fd@o4509184559218688.ingest.us.sentry.io/4509184569442304' dsn: 'https://194ceab3bd44e686bd3ebda9de3c20fd@o4509184559218688.ingest.us.sentry.io/4509184569442304',
environment: app.isPackaged ? 'production' : 'development'
}) })
} }
} }

View File

@ -31,18 +31,15 @@ function initAutoSync() {
}, 2000) }, 2000)
} }
export async function initSentry() { export function initSentry() {
const appInfo = await window.api.getAppInfo() Sentry.init(
if (appInfo.isPackaged) { {
Sentry.init( sendDefaultPii: true,
{ tracesSampleRate: 1.0,
sendDefaultPii: true, integrations: [Sentry.browserTracingIntegration()]
tracesSampleRate: 1.0, },
integrations: [Sentry.browserTracingIntegration()] reactInit as any
}, )
reactInit as any
)
}
} }
initSpinner() initSpinner()