Skip to content

Commit

Permalink
Add sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Apr 19, 2024
1 parent 7a4cae8 commit 7d94e93
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 2 deletions.
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@edgedb/code-editor": "workspace:*",
"@edgedb/common": "workspace:*",
"@edgedb/studio": "workspace:*",
"@sentry/react": "^7.111.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
Expand Down
8 changes: 7 additions & 1 deletion web/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {observer} from "mobx-react";
import {BrowserRouter, Route, Routes} from "react-router-dom";
import {BrowserRouter, Route, Routes as _Routes} from "react-router-dom";
import * as Sentry from "@sentry/react";

import "./fonts/include.scss";
import styles from "./app.module.scss";
Expand All @@ -17,6 +18,11 @@ import Header from "src/components/header";
import Main from "src/components/main";
import LoginPage from "src/components/loginPage";

const Routes =
process.env.REACT_APP_SENTRY_DSN != null
? Sentry.withSentryReactRouterV6Routing(_Routes)
: _Routes;

function App() {
return (
<appContext.Provider value={appState}>
Expand Down
34 changes: 34 additions & 0 deletions web/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,43 @@
import React from "react";
import ReactDOM from "react-dom";
import * as Sentry from "@sentry/react";
import {
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
} from "react-router-dom";

import "./index.css";
import App from "./app";

if (process.env.REACT_APP_SENTRY_DSN != null) {
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
integrations: [
Sentry.reactRouterV6BrowserTracingIntegration({
useEffect: React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
}),
Sentry.replayIntegration(),
],

tracePropagationTargets: [],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
tracesSampleRate: 1.0,

// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
}

ReactDOM.render(
<React.StrictMode>
<App />
Expand Down
114 changes: 113 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3222,6 +3222,108 @@ __metadata:
languageName: node
linkType: hard

"@sentry-internal/feedback@npm:7.111.0":
version: 7.111.0
resolution: "@sentry-internal/feedback@npm:7.111.0"
dependencies:
"@sentry/core": 7.111.0
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
checksum: 33a1d75451e929ad358d469ea6a977f7498891c5922f4d86faebc7ec05f0ec7c8779896800f18f08ac3b25103ccf992679c7c809013d9ec62a0743c753b1a6be
languageName: node
linkType: hard

"@sentry-internal/replay-canvas@npm:7.111.0":
version: 7.111.0
resolution: "@sentry-internal/replay-canvas@npm:7.111.0"
dependencies:
"@sentry/core": 7.111.0
"@sentry/replay": 7.111.0
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
checksum: de80dd47aea9ed12cefa3b77a32151ec1eac616b91b1bacad106534b1dda04311cbe2f61d44a56b875d0c753085653b4bf84f95201f644cb53bbf40853738339
languageName: node
linkType: hard

"@sentry-internal/tracing@npm:7.111.0":
version: 7.111.0
resolution: "@sentry-internal/tracing@npm:7.111.0"
dependencies:
"@sentry/core": 7.111.0
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
checksum: 959ac8ea17b70545369ec8bab1790567e15ad256ee5edc0e27d026812d8ef769f77dd0faac2e3dd0ff5264f23dbc062be747fcd37a6525b7f2231e383cc264a7
languageName: node
linkType: hard

"@sentry/browser@npm:7.111.0":
version: 7.111.0
resolution: "@sentry/browser@npm:7.111.0"
dependencies:
"@sentry-internal/feedback": 7.111.0
"@sentry-internal/replay-canvas": 7.111.0
"@sentry-internal/tracing": 7.111.0
"@sentry/core": 7.111.0
"@sentry/replay": 7.111.0
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
checksum: 73e2d049c92a048d9af1679a5ffbf760e112c8134609925758e71da0d8212cb02b7a2d2555910a76204021556b708dcdb9a2afb71daa8451f86e455b8c7cd326
languageName: node
linkType: hard

"@sentry/core@npm:7.111.0":
version: 7.111.0
resolution: "@sentry/core@npm:7.111.0"
dependencies:
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
checksum: ff0b6179e08f447e3dba753a11559325f4bf85dadbc430b9124db576bf026c53c615bff2baf10d9d3e60910a628b6a5fa8ba6aedbe32eedb03d6bc7f70086f0d
languageName: node
linkType: hard

"@sentry/react@npm:^7.111.0":
version: 7.111.0
resolution: "@sentry/react@npm:7.111.0"
dependencies:
"@sentry/browser": 7.111.0
"@sentry/core": 7.111.0
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
hoist-non-react-statics: ^3.3.2
peerDependencies:
react: 15.x || 16.x || 17.x || 18.x
checksum: 18683394760d6a4a7fd9835e4f36d19f8184c1d6783e6760cd96619915b71ba04841c90bb64a834c5f8c0a0a811238e36e8bd9f800c535bbac5b827a6748d817
languageName: node
linkType: hard

"@sentry/replay@npm:7.111.0":
version: 7.111.0
resolution: "@sentry/replay@npm:7.111.0"
dependencies:
"@sentry-internal/tracing": 7.111.0
"@sentry/core": 7.111.0
"@sentry/types": 7.111.0
"@sentry/utils": 7.111.0
checksum: ec2a5067a83834e56b4b2b879a257829f8ef10e47b3558f08414dd39abfb2328f69d52262e48eb68991fa6b7d51ea5a9e248d96897dc69b5534a3ca503ba953c
languageName: node
linkType: hard

"@sentry/types@npm:7.111.0":
version: 7.111.0
resolution: "@sentry/types@npm:7.111.0"
checksum: 3c7427ec07093d5532ddf7e32994746206bc7fcd22f4ec38909ef84b71306ec816b375737395fd17797dd50a0bdd3366b1f07c8ef9ef14237ba67b5230e3af19
languageName: node
linkType: hard

"@sentry/utils@npm:7.111.0":
version: 7.111.0
resolution: "@sentry/utils@npm:7.111.0"
dependencies:
"@sentry/types": 7.111.0
checksum: dbff2fbd19bcfa08ac076bbffec9ae36046097c421b0aee370ac6c5bf40fb2ef1994d651f45a4a6ad97f66011de6f054a7d7d77a8351bee55d28c6366d964c34
languageName: node
linkType: hard

"@sinclair/typebox@npm:^0.25.16":
version: 0.25.21
resolution: "@sinclair/typebox@npm:0.25.21"
Expand Down Expand Up @@ -8152,6 +8254,15 @@ __metadata:
languageName: node
linkType: hard

"hoist-non-react-statics@npm:^3.3.2":
version: 3.3.2
resolution: "hoist-non-react-statics@npm:3.3.2"
dependencies:
react-is: ^16.7.0
checksum: b1538270429b13901ee586aa44f4cc3ecd8831c061d06cb8322e50ea17b3f5ce4d0e2e66394761e6c8e152cd8c34fb3b4b690116c6ce2bd45b18c746516cb9e8
languageName: node
linkType: hard

"hoopy@npm:^0.1.4":
version: 0.1.4
resolution: "hoopy@npm:0.1.4"
Expand Down Expand Up @@ -12897,7 +13008,7 @@ __metadata:
languageName: node
linkType: hard

"react-is@npm:^16.13.1":
"react-is@npm:^16.13.1, react-is@npm:^16.7.0":
version: 16.13.1
resolution: "react-is@npm:16.13.1"
checksum: f7a19ac3496de32ca9ae12aa030f00f14a3d45374f1ceca0af707c831b2a6098ef0d6bdae51bd437b0a306d7f01d4677fcc8de7c0d331eb47ad0f46130e53c5f
Expand Down Expand Up @@ -15439,6 +15550,7 @@ __metadata:
"@edgedb/code-editor": "workspace:*"
"@edgedb/common": "workspace:*"
"@edgedb/studio": "workspace:*"
"@sentry/react": ^7.111.0
"@testing-library/jest-dom": ^5.14.1
"@testing-library/react": ^12.0.0
"@testing-library/user-event": ^13.2.1
Expand Down

0 comments on commit 7d94e93

Please sign in to comment.