-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bridge-ui): sentry integration (#13943)
- Loading branch information
1 parent
32e80fe
commit ffa4253
Showing
18 changed files
with
1,643 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as Sentry from '@sentry/svelte'; | ||
|
||
const hostname = globalThis?.location?.hostname ?? 'localhost'; | ||
const environment = | ||
hostname === 'localhost' | ||
? 'local' | ||
: hostname.match(/\.vercel\.app$|\.internal.taiko.xyz$/) | ||
? 'development' | ||
: hostname.match(/\.test\.taiko\.xyz$/) | ||
? 'production' | ||
: 'unknown'; | ||
|
||
const isProd = environment === 'production'; | ||
|
||
export function setupSentry(dsn: string) { | ||
Sentry.init({ | ||
dsn, | ||
environment, | ||
|
||
integrations: [new Sentry.BrowserTracing()], | ||
|
||
sampleRate: isProd ? 0.6 : 1.0, | ||
tracesSampleRate: isProd ? 0.6 : 1.0, | ||
maxBreadcrumbs: 50, | ||
|
||
beforeSend(event, hint) { | ||
const processedEvent = { ...event }; | ||
const { cause } = hint?.originalException as Error; | ||
|
||
// If we have "cause", we want to know about it as additional data | ||
if (cause) { | ||
processedEvent.extra = { | ||
...processedEvent.extra, | ||
cause, | ||
}; | ||
} | ||
|
||
return processedEvent; | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
const { withSentryConfig } = require('@sentry/svelte'); | ||
const sveltePreprocess = require('svelte-preprocess'); | ||
|
||
module.exports = { | ||
// Consult https://github.com/sveltejs/svelte-preprocess | ||
// for more information about preprocessors | ||
preprocess: sveltePreprocess(), | ||
const svelteConfig = { | ||
compilerOptions: { | ||
enableSourcemap: true, | ||
}, | ||
|
||
preprocess: sveltePreprocess({ | ||
sourceMap: true, | ||
}), | ||
}; | ||
|
||
const sentryOptions = { | ||
componentTracking: { | ||
trackComponents: ['BridgeForm', 'Transactions', 'Transaction', 'Faucet'], | ||
}, | ||
}; | ||
|
||
module.exports = withSentryConfig(svelteConfig, sentryOptions); |
Oops, something went wrong.