Skip to content

Commit

Permalink
fix: sentry api upgrade, routing
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Mar 11, 2024
1 parent 12c10da commit 0787287
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 146 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@
"@scure/bip32": "1.3.2",
"@scure/bip39": "1.2.1",
"@scure/btc-signer": "1.1.0",
"@segment/analytics-next": "1.62.1",
"@sentry/react": "7.92.0",
"@sentry/tracing": "7.92.0",
"@segment/analytics-next": "1.66.0",
"@sentry/react": "7.106.0",
"@sentry/tracing": "7.106.0",
"@stacks/auth": "6.9.0",
"@stacks/blockchain-api-client": "6.3.4",
"@stacks/common": "6.8.1",
Expand Down Expand Up @@ -252,7 +252,7 @@
"@redux-devtools/cli": "4.0.0",
"@redux-devtools/remote": "0.9.1",
"@schemastore/web-manifest": "0.0.6",
"@sentry/webpack-plugin": "2.10.2",
"@sentry/webpack-plugin": "2.14.3",
"@stacks/connect-react": "22.2.0",
"@stacks/stacks-blockchain-api-types": "6.3.4",
"@storybook/addon-docs": "7.6.17",
Expand Down
6 changes: 5 additions & 1 deletion src/app/routes/app-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
createRoutesFromElements,
} from 'react-router-dom';

import * as Sentry from '@sentry/react';

import { RouteUrls } from '@shared/route-urls';

import { LoadingSpinner } from '@app/components/loading-spinner';
Expand Down Expand Up @@ -64,6 +66,8 @@ export function AppRoutes() {
return <RouterProvider router={routes} />;
}

const sentryCreateBrowserRouter = Sentry.wrapCreateBrowserRouter(createHashRouter);

export const homePageModalRoutes = (
<>
{settingsRoutes}
Expand All @@ -77,7 +81,7 @@ export const homePageModalRoutes = (
);

function useAppRoutes() {
return createHashRouter(
return sentryCreateBrowserRouter(
createRoutesFromElements(
<Route element={<Container />}>
<Route
Expand Down
24 changes: 9 additions & 15 deletions src/shared/utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,17 @@ export function initSentry() {

Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 0.75,
integrations: [
new Sentry.BrowserTracing({
traceFetch: false,
traceXHR: false,
startTransactionOnLocationChange: false,
startTransactionOnPageLoad: false,
markBackgroundTransactions: false,
routingInstrumentation: Sentry.reactRouterV6Instrumentation(
React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes
),
Sentry.browserTracingIntegration({}),
Sentry.reactRouterV6BrowserTracingIntegration({
useEffect: React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
}),
new Sentry.Feedback({
Sentry.feedbackIntegration({
colorScheme: 'system',
isEmailRequired: false,
buttonLabel: 'Give feedback',
Expand Down Expand Up @@ -112,7 +107,6 @@ export function initSentry() {
// Failed network requests needn't be tracked
'Network request failed',
],
tracesSampleRate: 1,
environment: WALLET_ENVIRONMENT,
autoSessionTracking: false,
async beforeSend(event) {
Expand Down
Loading

0 comments on commit 0787287

Please sign in to comment.