fix: remove sentry (#520)

This commit is contained in:
Adam Uhlíř
2022-08-08 18:19:38 +02:00
committed by GitHub
parent e986d7ca22
commit 0260df61de
10 changed files with 9 additions and 394 deletions
-46
View File
@@ -1,46 +0,0 @@
import { config } from '../config'
import * as Sentry from '@sentry/react'
import packageJson from '../../package.json'
import { BrowserTracing } from '@sentry/tracing'
import { getBeeDesktopLogs, getBeeLogs } from './desktop'
export async function initSentry(): Promise<void> {
let tunnelAvailable
try {
const result = await fetch(`${config.BEE_DESKTOP_URL}/sentry`, { method: 'OPTIONS' })
if (result.status === 204) {
tunnelAvailable = true
}
} catch (e) {
// There was an error, so tunnel is not available
tunnelAvailable = false
}
Sentry.init({
dsn: config.SENTRY_KEY,
release: packageJson.version,
environment: config.SENTRY_ENVIRONMENT,
tunnel: tunnelAvailable ? `${config.BEE_DESKTOP_URL}/sentry` : undefined,
integrations: [new BrowserTracing({ tracingOrigins: [config.BEE_DESKTOP_URL] })],
tracesSampleRate: 0.4,
beforeSend: async (event, hint) => {
hint.attachments = []
try {
// This will fail if we are not running in Bee Desktop, but that is alright
hint.attachments.push({ filename: 'bee-desktop.log', data: await getBeeDesktopLogs() })
// eslint-disable-next-line no-empty
} catch (e) {}
try {
// This will fail if we are not running in Bee Desktop, but that is alright
hint.attachments.push({ filename: 'bee.log', data: await getBeeLogs() })
// eslint-disable-next-line no-empty
} catch (e) {}
return event
},
})
}