-
Notifications
You must be signed in to change notification settings - Fork 11
Chore: configure sentry #629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import * as Sentry from "@sentry/react"; | ||
| import { browserTracingIntegration, reactRouterV6BrowserTracingIntegration } from "@sentry/react"; | ||
|
||
| import { | ||
| useLocation, | ||
| useNavigationType, | ||
| createRoutesFromChildren, | ||
| matchRoutes, | ||
| } from "react-router-dom"; | ||
|
|
||
| const SENTRY_DSN = import.meta.env.VITE_SENTRY_DSN; | ||
| const ENVIRONMENT = import.meta.env.VITE_SENTRY_ENVIRONMENT || import.meta.env.MODE || "development"; | ||
| const RELEASE = import.meta.env.VITE_APP_VERSION || "unknown"; | ||
| const IS_PRODUCTION = ENVIRONMENT === "production"; | ||
| const IS_DEVELOPMENT = ENVIRONMENT === "development"; | ||
|
|
||
| const getTracesSampleRate = () => { | ||
| const customRate = import.meta.env.VITE_SENTRY_TRACES_SAMPLE_RATE; | ||
| if (customRate) { | ||
| return parseFloat(customRate); | ||
| } | ||
| return IS_PRODUCTION ? 0.1 : 1.0; | ||
| }; | ||
|
|
||
| export const initSentry = () => { | ||
| if (!SENTRY_DSN) { | ||
| if (IS_DEVELOPMENT) { | ||
| console.warn("Sentry DSN not configured. Error tracking disabled."); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| Sentry.init({ | ||
| dsn: SENTRY_DSN, | ||
| environment: ENVIRONMENT, | ||
| release: RELEASE, | ||
| integrations: [ | ||
| browserTracingIntegration({ | ||
| routingInstrumentation: reactRouterV6BrowserTracingIntegration({ | ||
| useLocation, | ||
| useNavigationType, | ||
| createRoutesFromChildren, | ||
| matchRoutes, | ||
| }), | ||
| }), | ||
|
Comment on lines
+37
to
+44
|
||
| ], | ||
| tracesSampleRate: getTracesSampleRate(), | ||
| ignoreErrors: [ | ||
| "ResizeObserver loop limit exceeded", | ||
| "ResizeObserver loop completed with undelivered notifications", | ||
| "Non-Error promise rejection captured", | ||
| ], | ||
| }); | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
browserTracingIntegrationis already imported from@sentry/reacton line 1 via the namespace import* as Sentry. This redundant import should be removed and the integration should be accessed asSentry.browserTracingIntegrationon line 37.