|
| 1 | +import React from "react"; |
| 2 | +import * as Sentry from "@sentry/react"; |
| 3 | +import { Routes, createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router-dom"; |
| 4 | +import { GIT_DIRTY, GIT_HASH, RELEASE_VERSION } from "../consts"; |
| 5 | + |
| 6 | +Sentry.init({ |
| 7 | + dsn: process.env.REACT_APP_SENTRY_ENDPOINT, |
| 8 | + environment: process.env.REACT_APP_CONTEXT, |
| 9 | + release: `court-v2@${RELEASE_VERSION}-${GIT_HASH}${GIT_DIRTY}`, |
| 10 | + integrations: [ |
| 11 | + new Sentry.BrowserProfilingIntegration(), |
| 12 | + new Sentry.BrowserTracing({ |
| 13 | + routingInstrumentation: Sentry.reactRouterV6Instrumentation( |
| 14 | + React.useEffect, |
| 15 | + useLocation, |
| 16 | + useNavigationType, |
| 17 | + createRoutesFromChildren, |
| 18 | + matchRoutes |
| 19 | + ), |
| 20 | + }), |
| 21 | + ], |
| 22 | + |
| 23 | + // Set tracesSampleRate to 1.0 to capture 100% |
| 24 | + // of transactions for performance monitoring. |
| 25 | + // We recommend adjusting this value in production |
| 26 | + tracesSampleRate: 1.0, |
| 27 | + |
| 28 | + // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled |
| 29 | + tracePropagationTargets: ["localhost", /^https:\/\/.*--kleros-v2\.netlify\.app/], |
| 30 | + |
| 31 | + // Set profilesSampleRate to 1.0 to profile every transaction. |
| 32 | + // Since profilesSampleRate is relative to tracesSampleRate, |
| 33 | + // the final profiling rate can be computed as tracesSampleRate * profilesSampleRate |
| 34 | + // For example, a tracesSampleRate of 0.5 and profilesSampleRate of 0.5 would |
| 35 | + // results in 25% of transactions being profiled (0.5*0.5=0.25) |
| 36 | + profilesSampleRate: 1.0, |
| 37 | +}); |
| 38 | + |
| 39 | +export const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes); |
0 commit comments