feat: add sentry integration

This commit is contained in:
kangfenmao 2024-07-16 17:08:04 +08:00
parent 6b872f58ed
commit 2cc09a52f4
4 changed files with 1008 additions and 1 deletions

View File

@ -23,6 +23,7 @@
"dependencies": { "dependencies": {
"@electron-toolkit/preload": "^3.0.0", "@electron-toolkit/preload": "^3.0.0",
"@electron-toolkit/utils": "^3.0.0", "@electron-toolkit/utils": "^3.0.0",
"@sentry/electron": "^5.2.0",
"electron-log": "^5.1.5", "electron-log": "^5.1.5",
"electron-updater": "^6.1.7", "electron-updater": "^6.1.7",
"electron-window-state": "^5.0.3" "electron-window-state": "^5.0.3"

View File

@ -5,6 +5,7 @@ import { join } from 'path'
import icon from '../../resources/icon.png?asset' import icon from '../../resources/icon.png?asset'
import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer' import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer'
import AppUpdater from './updater' import AppUpdater from './updater'
import * as Sentry from '@sentry/electron/main'
function createWindow(): void { function createWindow(): void {
// Load the previous state with fallback to defaults // Load the previous state with fallback to defaults
@ -110,3 +111,6 @@ app.on('window-all-closed', () => {
// In this file you can include the rest of your app"s specific main process // In this file you can include the rest of your app"s specific main process
// code. You can also put them in separate files and require them here. // code. You can also put them in separate files and require them here.
Sentry.init({
dsn: 'https://f0e972deff79c2df3e887e232d8a46a3@o4507610668007424.ingest.us.sentry.io/4507610670563328'
})

View File

@ -1,5 +1,6 @@
import localforage from 'localforage' import localforage from 'localforage'
import KeyvStorage from '@kangfenmao/keyv-storage' import KeyvStorage from '@kangfenmao/keyv-storage'
import * as Sentry from '@sentry/electron/renderer'
function init() { function init() {
localforage.config({ localforage.config({
@ -11,6 +12,20 @@ function init() {
}) })
window.keyv = new KeyvStorage() window.keyv = new KeyvStorage()
window.keyv.init() window.keyv.init()
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
tracesSampleRate: 1.0,
// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0
})
} }
init() init()

989
yarn.lock

File diff suppressed because it is too large Load Diff