Skip to content

Commit

Permalink
[M2-6234] Sentry setup (#444)
Browse files Browse the repository at this point in the history
* Sentry setup

* The dsn import from the env was covered by guard

---------

Co-authored-by: Viktor Riabkov <[email protected]>
  • Loading branch information
moiskillnadne and Viktor Riabkov authored Apr 29, 2024
1 parent 94c9e8b commit 8e5b305
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ VITE_SECURE_LOCAL_STORAGE_PREFIX=ML_SECURE
VITE_IV_LENGTH=16
VITE_BUILD_VERSION=dev-build
VITE_MIXPANEL_TOKEN=env-key
VITE_LAUNCHDARKLY_CLIENT_ID=env-key
VITE_LAUNCHDARKLY_CLIENT_ID=env-key

VITE_SENTRY_DSN=env-key
VITE_SENTRY_TRACE_PROPAGATION_TARGETS="['localhost', 'any-domain.com']"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@mui/x-date-pickers": "^6.9.2",
"@react-spring/web": "^9.7.3",
"@reduxjs/toolkit": "^1.9.0",
"@sentry/react": "^7.112.2",
"@tanstack/react-query": "^4.16.1",
"@types/mixpanel-browser": "^2.47.5",
"@types/node": "^20.10.4",
Expand Down
23 changes: 23 additions & 0 deletions src/app/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
import React from 'react';

import * as Sentry from '@sentry/react';
import ReactDOM from 'react-dom/client';

import AppSuspense from './AppSuspense';

Sentry.init({
dsn: import.meta.env.VITE_SENTRY_DSN ?? '',
integrations: [
// See docs for support of different versions of variation of react router
// https://docs.sentry.io/platforms/javascript/guides/react/configuration/integrations/react-router/
Sentry.replayIntegration(),
],

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

tracePropagationTargets: import.meta.env.VITE_SENTRY_TRACE_PROPAGATION_TARGETS
? (JSON.parse(import.meta.env.VITE_SENTRY_TRACE_PROPAGATION_TARGETS) as Array<string>)
: [],

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

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<AppSuspense />
Expand Down
3 changes: 3 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ interface ImportMetaEnv {
readonly VITE_IV_LENGTH: string;
readonly VITE_MIXPANEL_TOKEN: string;
readonly VITE_LAUNCHDARKLY_CLIENT_ID: string;

readonly VITE_SENTRY_DSN: string;
readonly VITE_SENTRY_TRACE_PROPAGATION_TARGETS: string; // List of domains Array<string>
}

interface ImportMeta {
Expand Down
112 changes: 112 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,99 @@
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.1.tgz#299eee74b7d87e116083ac5b1ce8dd9434668294"
integrity sha512-wQGI+LY/Py20zdUPq+XCem7JcPOyzIJBm3dli+56DJsQOHbnXZFEwgmnC6el1TPAfC8lBT3m+z69RmLykNUbew==

"@sentry-internal/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.112.2.tgz#3945ae9e980854e1d53560ed6a28684f02625fbc"
integrity sha512-z+XP8BwB8B3pa+i8xqbrPsbtDWUFUS6wo+FJbmOYUqOusJJbVFDAhBoEdKoo5ZjOcsAZG7XR6cA9zrhJynIWBA==
dependencies:
"@sentry/core" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"

"@sentry-internal/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.112.2.tgz#a29719ffb816dec01661b81def09d24704476d86"
integrity sha512-BCCCxrZ1wJvN6La5gg1JJbKitAhJI5MATCnhtklsZbUcHkHB9iZoj19J65+P56gwssvHz5xh63AjNiITaetIRg==
dependencies:
"@sentry/core" "7.112.2"
"@sentry/replay" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"

"@sentry-internal/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.112.2.tgz#83460e51875ddb160c060bfee2e21833117f259c"
integrity sha512-fT1Y46J4lfXZkgFkb03YMNeIEs2xS6jdKMoukMFQfRfVvL9fSWEbTgZpHPd/YTT8r2i082XzjtAoQNgklm/0Hw==
dependencies:
"@sentry/core" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"

"@sentry/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.112.2.tgz#8c25b8f96257685279cf6837ba4ea6e6cba8c9e2"
integrity sha512-wULwavCch84+d0bueAdFm6CDm1u0TfOjN91VgY+sj/vxUV2vesvDgI8zRZfmbZEor3MYA90zerkZT3ehZQKbYw==
dependencies:
"@sentry-internal/feedback" "7.112.2"
"@sentry-internal/replay-canvas" "7.112.2"
"@sentry-internal/tracing" "7.112.2"
"@sentry/core" "7.112.2"
"@sentry/integrations" "7.112.2"
"@sentry/replay" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"

"@sentry/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.112.2.tgz#d2e6d2acb6947fcb384298a3bd2b0c8183533dd8"
integrity sha512-gHPCcJobbMkk0VR18J65WYQTt3ED4qC6X9lHKp27Ddt63E+MDGkG6lvYBU1LS8cV7CdyBGC1XXDCfor61GvLsA==
dependencies:
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"

"@sentry/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.112.2.tgz#2aad01719b1e4a1326f42db78f77fcf1e58d4c63"
integrity sha512-ioC2yyU6DqtLkdmWnm87oNvdn2+9oKctJeA4t+jkS6JaJ10DcezjCwiLscX4rhB9aWJV3IWF7Op0O6K3w0t2Hg==
dependencies:
"@sentry/core" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"
localforage "^1.8.1"

"@sentry/react@^7.112.2":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.112.2.tgz#72a83b52b9370578dcc6069af0199eb0e82da2d5"
integrity sha512-Xf6mc1+/ncCk6ZFIj0oT4or2o0UxqqJZk09U/21RYNvVCn7+DNyCdJZ/F5wXWgPqVE67PrjydLLYaQWiqLibiA==
dependencies:
"@sentry/browser" "7.112.2"
"@sentry/core" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"
hoist-non-react-statics "^3.3.2"

"@sentry/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.112.2.tgz#4910244b80dabd32a83cc02b9fdd566ff766df34"
integrity sha512-7Ns/8D54WPsht1nlVj93Inf6rXyve2AZoibYN0YfcM2w3lI4NO51gPPHJU0lFEfMwzwK4ZBJWzOeW9098a+uEg==
dependencies:
"@sentry-internal/tracing" "7.112.2"
"@sentry/core" "7.112.2"
"@sentry/types" "7.112.2"
"@sentry/utils" "7.112.2"

"@sentry/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.112.2.tgz#71ff27c668309ccd8d17b7793e044e46f81eca1b"
integrity sha512-kCMLt7yhY5OkWE9MeowlTNmox9pqDxcpvqguMo4BDNZM5+v9SEb1AauAdR78E1a1V8TyCzjBD7JDfXWhvpYBcQ==

"@sentry/[email protected]":
version "7.112.2"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.112.2.tgz#223f9feee5860459792a43904db4bf38fba73ed3"
integrity sha512-OjLh0hx0t1EcL4ZIjf+4svlmmP+tHUDGcr5qpFWH78tjmkPW4+cqPuZCZfHSuWcDdeiaXi8TnYoVRqDcJKK/eQ==
dependencies:
"@sentry/types" "7.112.2"

"@sinclair/typebox@^0.27.8":
version "0.27.8"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
Expand Down Expand Up @@ -3913,6 +4006,11 @@ ignore@^5.2.0, ignore@^5.2.4:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==

immediate@~3.0.5:
version "3.0.6"
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==

immer@^9.0.21:
version "9.0.21"
resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.21.tgz#1e025ea31a40f24fb064f1fef23e931496330176"
Expand Down Expand Up @@ -4849,6 +4947,13 @@ levn@^0.4.1:
prelude-ls "^1.2.1"
type-check "~0.4.0"

[email protected]:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e"
integrity sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==
dependencies:
immediate "~3.0.5"

lines-and-columns@^1.1.6:
version "1.2.4"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
Expand All @@ -4862,6 +4967,13 @@ local-pkg@^0.5.0:
mlly "^1.4.2"
pkg-types "^1.0.3"

localforage@^1.8.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4"
integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==
dependencies:
lie "3.1.1"

locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
Expand Down

0 comments on commit 8e5b305

Please sign in to comment.