Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry SDK initialization #195

Merged
merged 9 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dapp/.env
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
VITE_USE_TESTNET=true

# Configuration of sentry.io
VITE_SENTRY_SUPPORT=true
VITE_SENTRY_DSN=https://4c1f78c9a9f5e2b556d94abd754ccf20@o4506637342539776.ingest.sentry.io/4506637357416448
r-czajkowski marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions dapp/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VITE_USE_TESTNET=false
kkosiorowska marked this conversation as resolved.
Show resolved Hide resolved

# Configuration of sentry.io
VITE_SENTRY_SUPPORT=false
VITE_SENTRY_DSN=""
r-czajkowski marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@emotion/styled": "^11.11.0",
"@ledgerhq/wallet-api-client": "^1.5.0",
"@ledgerhq/wallet-api-client-react": "^1.3.0",
"@sentry/react": "^7.98.0",
"@tanstack/react-table": "^8.11.3",
"formik": "^2.4.5",
"framer-motion": "^10.16.5",
Expand Down
2 changes: 2 additions & 0 deletions dapp/src/DApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import Overview from "./components/Overview"
import Sidebar from "./components/Sidebar"
import DocsDrawer from "./components/DocsDrawer"
import GlobalStyles from "./components/GlobalStyles"
import { useSentry } from "./hooks/useSentry"
kkosiorowska marked this conversation as resolved.
Show resolved Hide resolved

function DApp() {
useDetectThemeMode()
useSentry()

return (
<>
Expand Down
12 changes: 12 additions & 0 deletions dapp/src/hooks/useSentry.ts
r-czajkowski marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { initializeSentry } from "#/sdk/sentry"
import { useEffect } from "react"

export const useSentry = () => {
useEffect(() => {
const { VITE_SENTRY_SUPPORT, VITE_SENTRY_DSN } = import.meta.env

if (VITE_SENTRY_SUPPORT) {
initializeSentry(`${VITE_SENTRY_DSN}`)
kkosiorowska marked this conversation as resolved.
Show resolved Hide resolved
}
}, [])
}
16 changes: 16 additions & 0 deletions dapp/src/sdk/sentry/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as Sentry from "@sentry/react"

export const initializeSentry = (dsn: string) => {
Sentry.init({
dsn,
integrations: [
new Sentry.BrowserTracing({
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost"],
}),
nkuba marked this conversation as resolved.
Show resolved Hide resolved
],
// Performance Monitoring
// Capture 100% of the transactions
tracesSampleRate: 1.0,
})
nkuba marked this conversation as resolved.
Show resolved Hide resolved
}
196 changes: 97 additions & 99 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading