2021-05-03 11:28:31 +00:00
|
|
|
|
import * as Sentry from '@sentry/react'
|
|
|
|
|
import { Integrations } from '@sentry/tracing'
|
2022-03-16 09:10:03 +00:00
|
|
|
|
import { getBranch, isProduction, isStaging } from './utils'
|
2022-03-28 13:40:07 +00:00
|
|
|
|
import { CaptureConsole } from '@sentry/integrations'
|
2021-05-03 11:28:31 +00:00
|
|
|
|
|
2022-03-16 09:10:03 +00:00
|
|
|
|
const branch = getBranch()
|
2021-05-03 11:28:31 +00:00
|
|
|
|
|
2022-03-16 09:10:03 +00:00
|
|
|
|
if (branch && isStaging()) {
|
2021-12-27 10:27:57 +00:00
|
|
|
|
// eslint-disable-next-line no-console
|
2021-05-03 11:28:31 +00:00
|
|
|
|
console.info(
|
|
|
|
|
`ℹ Vous êtes sur la branche : %c${branch}`,
|
|
|
|
|
'font-weight: bold; text-decoration: underline;'
|
|
|
|
|
)
|
|
|
|
|
}
|
2021-05-12 14:05:25 +00:00
|
|
|
|
|
2022-03-16 09:10:03 +00:00
|
|
|
|
const release =
|
|
|
|
|
branch && `${branch}-` + import.meta.env.VITE_GITHUB_SHA?.substring(0, 7)
|
2021-05-12 14:05:25 +00:00
|
|
|
|
|
2022-03-16 09:10:03 +00:00
|
|
|
|
if (isProduction()) {
|
2021-05-12 14:05:25 +00:00
|
|
|
|
Sentry.init({
|
2021-09-01 13:25:33 +00:00
|
|
|
|
dsn: 'https://92bbc21937b24136a2fe1b1d922b000f@o548798.ingest.sentry.io/5745615',
|
2022-03-28 13:40:07 +00:00
|
|
|
|
integrations: [
|
|
|
|
|
new Integrations.BrowserTracing(),
|
|
|
|
|
new CaptureConsole({ levels: ['error'] }),
|
|
|
|
|
],
|
2021-05-12 14:05:25 +00:00
|
|
|
|
release,
|
|
|
|
|
// Set tracesSampleRate to 1.0 to capture 100%
|
|
|
|
|
// of transactions for performance monitoring.
|
|
|
|
|
// We recommend adjusting this value in production
|
2022-03-23 09:13:08 +00:00
|
|
|
|
tracesSampleRate: 0.05,
|
2021-05-12 14:05:25 +00:00
|
|
|
|
})
|
|
|
|
|
}
|