Skip to content

Commit

Permalink
feat(sentry): conditionally init sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
iacopolea committed Dec 5, 2023
1 parent b4ec116 commit b814ad1
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,31 @@ import isStagingEnvironment from "./features/isStagingEnvironment";
const SentryRoute = Sentry.withSentryRouting(Route);
const history = createBrowserHistory();

Sentry.init({
dsn: "https://[email protected]/4506320026664960",
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.reactRouterV5Instrumentation(history),
}),
],
environment: _env_.REACT_APP_ENVIRONMENT,
// trace all staging and locale traces and 70% of production traces
tracesSampleRate: isStagingEnvironment() ? 1.0 : 0.7,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: [
"localhost",
/^https:\/\/dev\.tryber\.me\/api/,
/^https:\/\/tryber\.me\/api/,
],
if (process.env.NODE_ENV !== "test") {
Sentry.init({
dsn: "https://[email protected]/4506320026664960",
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.reactRouterV5Instrumentation(history),
}),
],
environment: _env_.REACT_APP_ENVIRONMENT,
// trace all staging and locale traces and 70% of production traces
tracesSampleRate: isStagingEnvironment() ? 1.0 : 0.7,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: [
"localhost",
/^https:\/\/dev\.tryber\.me\/api/,
/^https:\/\/tryber\.me\/api/,
],

// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
// do not capture for staging and locale
replaysSessionSampleRate: isStagingEnvironment() ? 0.0 : 0.1,
replaysOnErrorSampleRate: isStagingEnvironment() ? 0.0 : 1.0,
});
// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
// do not capture for staging and locale
replaysSessionSampleRate: isStagingEnvironment() ? 0.0 : 0.1,
replaysOnErrorSampleRate: isStagingEnvironment() ? 0.0 : 1.0,
});
}

function App() {
return (
Expand Down

0 comments on commit b814ad1

Please sign in to comment.