replace bugsnag with glitchtip

This commit is contained in:
Jon Staab
2024-10-25 16:44:06 -07:00
parent 20ad95db00
commit 9912191d6c
4 changed files with 123 additions and 129 deletions
+10 -29
View File
@@ -1,32 +1,13 @@
import Bugsnag from "@bugsnag/js"
import * as Sentry from "@sentry/browser"
export const setupTracking = () => {
if (!import.meta.env.VITE_BUGSNAG_API_KEY) return
// Initialize
Bugsnag.start({
apiKey: import.meta.env.VITE_BUGSNAG_API_KEY,
collectUserIp: false,
})
// Redact long strings, especially hex and bech32 keys which are 64 and 63
// characters long, respectively. Put the threshold a little lower in case
// someone accidentally enters a key with the last few digits missing
const redactErrorInfo = (info: any) =>
JSON.parse(
JSON.stringify(info || null)
.replace(/\d+:{60}\w+:\w+/g, "[REDACTED]")
.replace(/\w{60}\w+/g, "[REDACTED]"),
)
Bugsnag.addOnError((event: any) => {
// Redact individual properties since the event needs to be
// mutated, and we don't want to lose the prototype
event.context = redactErrorInfo(event.context)
event.request = redactErrorInfo(event.request)
event.exceptions = redactErrorInfo(event.exceptions)
event.breadcrumbs = redactErrorInfo(event.breadcrumbs)
return true
})
if (import.meta.env.VITE_SENTRY_DSN) {
Sentry.init({
dsn: import.meta.env.VITE_SENTRY_DSN,
tracesSampleRate: 0.01,
integrations(integrations) {
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
},
})
}
}