use rollbar
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import Rollbar from 'rollbar/dist/rollbar.umd'
|
||||
|
||||
const token = document.querySelector('meta[name="rollbar-token"]')?.getAttribute('content')
|
||||
|
||||
if (token) {
|
||||
window.Rollbar ||= new Rollbar({
|
||||
accessToken: token,
|
||||
captureUncaught: true,
|
||||
captureUnhandledRejections: true,
|
||||
captureIp: false,
|
||||
autoInstrument: false,
|
||||
ignoredMessages: [
|
||||
/Failed to fetch/i,
|
||||
/NetworkError/i,
|
||||
/Load failed/i,
|
||||
/Clipboard write is not allowed/i
|
||||
],
|
||||
transform (payload) {
|
||||
payload.body.telemetry = []
|
||||
|
||||
const string = JSON.stringify(payload)
|
||||
|
||||
return JSON.parse(string.replace(/(\/[des]\/)\w{6}/g, (_, m) => m))
|
||||
},
|
||||
payload: {
|
||||
client: {
|
||||
javascript: {
|
||||
source_map_enabled: true
|
||||
}
|
||||
},
|
||||
environment: 'production'
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import * as Sentry from '@sentry/browser'
|
||||
|
||||
const sentryDsn = document.querySelector('meta[name="sentry-dsn"]')?.getAttribute('content')
|
||||
|
||||
if (sentryDsn) {
|
||||
Sentry.init({
|
||||
dsn: sentryDsn,
|
||||
beforeSend (event) {
|
||||
if (event.request.url.match(/\/[ds]\//)) {
|
||||
event.request.url = event.request.url.slice(0, -6)
|
||||
}
|
||||
|
||||
return event
|
||||
},
|
||||
beforeBreadcrumb () {
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user