diff --git a/src/backend/electron/main.ts b/src/backend/electron/main.ts index 391f2833..eadf32bf 100644 --- a/src/backend/electron/main.ts +++ b/src/backend/electron/main.ts @@ -30,6 +30,7 @@ import { registerIpcMainHandle, ipcMainSendProxy, IpcMainHandle } from "./ipc"; import { getConfigManager } from "./electronConfig"; import { getEngineAndVvppController } from "./engineAndVvppController"; import { writeFileSafely } from "./fileHelper"; +import { isProduction } from "@/helpers/platform"; import { failure, success } from "@/type/result"; import { AssetTextFileNames } from "@/type/staticResources"; import { @@ -89,14 +90,16 @@ if (!isDevelopment) { configMigration014({ fixedUserDataDir, beforeUserDataDir }); // 以前のファイルがあれば持ってくる } -// Sentry によるエラートラッキングを開始 +// Sentry によるエラートラッキングを開始 (production 環境のみ有効) // app.setPath("userData") を設定した後に呼ぶ必要がある // ref: https://docs.sentry.io/platforms/javascript/guides/electron/ -Sentry.init({ - dsn: "https://ab3b3a5b0e9d1c90dae483f740dbc78b@o4508551725383680.ingest.us.sentry.io/4508555292901376", - release: `AivisSpeech@${app.getVersion() === "999.999.999" ? "latest" : app.getVersion()}`, - environment: import.meta.env.MODE, -}); +if (isProduction) { + Sentry.init({ + dsn: "https://ab3b3a5b0e9d1c90dae483f740dbc78b@o4508551725383680.ingest.us.sentry.io/4508555292901376", + release: `AivisSpeech@${app.getVersion() === "999.999.999" ? "latest" : app.getVersion()}`, + environment: "production", + }); +} log.initialize({ preload: false }); // silly 以上のログをコンソールに出力 diff --git a/src/main.ts b/src/main.ts index 999ac454..86aaca33 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,6 +9,7 @@ import { ipcMessageReceiver } from "./plugins/ipcMessageReceiverPlugin"; import { hotkeyPlugin } from "./plugins/hotkeyPlugin"; import App from "@/components/App.vue"; import { markdownItPlugin } from "@/plugins/markdownItPlugin"; +import { isProduction } from "@/helpers/platform"; import "@quasar/extras/material-symbols-rounded/material-symbols-rounded.css"; import "quasar/dist/quasar.sass"; @@ -18,31 +19,33 @@ import "./styles/_index.scss"; // ため、それを防止するため自前でdataLayerをあらかじめ用意する // window.dataLayer = []; -// Sentry によるエラートラッキングを開始 +// Sentry によるエラートラッキングを開始 (production 環境のみ有効) // ref: https://docs.sentry.io/platforms/javascript/guides/electron/ -Sentry.init( - { - integrations: [ - Sentry.browserTracingIntegration(), - Sentry.replayIntegration(), - ], +if (isProduction) { + Sentry.init( + { + integrations: [ + Sentry.browserTracingIntegration(), + Sentry.replayIntegration(), + ], - // Set tracesSampleRate to 1.0 to capture 100% - // of transactions for performance monitoring. - // We recommend adjusting this value in production - // Learn more at - // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate - tracesSampleRate: 1.0, + // Set tracesSampleRate to 1.0 to capture 100% + // of transactions for performance monitoring. + // We recommend adjusting this value in production + // Learn more at + // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate + tracesSampleRate: 1.0, - // Capture Replay for 10% of all sessions, - // plus for 100% of sessions with an error - // Learn more at - // https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration - replaysSessionSampleRate: 0.1, - replaysOnErrorSampleRate: 1.0, - }, - SentryVue.init, -); + // Capture Replay for 10% of all sessions, + // plus for 100% of sessions with an error + // Learn more at + // https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration + replaysSessionSampleRate: 0.1, + replaysOnErrorSampleRate: 1.0, + }, + SentryVue.init, + ); +} createApp(App) .use(store, storeKey)