Skip to content

Commit 5e54203

Browse files
authored
Merge pull request #114 from danielemery/113-add-sentry-error-tracking
Add basic sentry error tracking
2 parents 1c79859 + 6070ae0 commit 5e54203

File tree

6 files changed

+145
-0
lines changed

6 files changed

+145
-0
lines changed

env.schema.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ module.exports = Joi.object()
77
VITE_AUTH0_CLIENT_ID: Joi.string().required(),
88
VITE_AUTH0_AUDIENCE: Joi.string().uri().required(),
99
VITE_QUIZLORD_VERSION: Joi.string().default('development'),
10+
VITE_ENVIRONMENT_NAME: Joi.string().default('local'),
11+
VITE_SENTRY_DSN: Joi.string().uri().optional(),
1012
})
1113
.required();

package-lock.json

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@fortawesome/free-regular-svg-icons": "^6.4.2",
2121
"@fortawesome/free-solid-svg-icons": "^6.4.2",
2222
"@fortawesome/react-fontawesome": "^0.2.0",
23+
"@sentry/browser": "^9.6.0",
2324
"classnames": "^2.3.1",
2425
"date-fns": "^4.1.0",
2526
"docker-react": "^0.0.3",

src/main.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import AuthorizedApolloProvider from './AuthorizedApolloProvider';
77
import QuizlordProvider from './QuizlordProvider';
88
import { App } from './app';
99
import './index.css';
10+
import './tools/sentry';
1011

1112
render(
1213
<Auth0Provider

src/tools/sentry.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
Sentry.init({
4+
environment: window.env.VITE_ENVIRONMENT_NAME,
5+
dsn: window.env.VITE_SENTRY_DSN,
6+
release: `quizlord-client@${window.env.VITE_QUIZLORD_VERSION}`,
7+
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
8+
tracesSampleRate: 1.0,
9+
tracePropagationTargets: [window.env.VITE_GRAPH_API_URI],
10+
replaysSessionSampleRate: 0.1,
11+
replaysOnErrorSampleRate: 1.0,
12+
});

src/window.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export interface IEnvValues {
44
VITE_AUTH0_CLIENT_ID: string;
55
VITE_AUTH0_AUDIENCE: string;
66
VITE_QUIZLORD_VERSION: string;
7+
VITE_ENVIRONMENT_NAME: string;
8+
VITE_SENTRY_DSN?: string;
79
}
810

911
declare global {

0 commit comments

Comments
 (0)