Added Sentry

This commit is contained in:
Luke Hagar
2024-02-06 21:53:39 -06:00
parent 75f8b6fe72
commit 949602623c
5 changed files with 50 additions and 2 deletions

3
.gitignore vendored
View File

@@ -8,3 +8,6 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
# Sentry Config File
.sentryclirc

View File

@@ -12,6 +12,7 @@
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@floating-ui/dom": "^1.6.1",
"@skeletonlabs/skeleton": "^2.7.0",
"@skeletonlabs/tw-plugin": "^0.3.1",
"@sveltejs/adapter-auto": "^3.0.0",
@@ -32,12 +33,17 @@
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.8",
"svelte-check": "^3.6.3",
"svelte-jsoneditor": "^0.21.2",
"svelte-jsoneditor": "^0.21.5",
"tailwindcss": "^3.4.1",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vite": "^5.0.0",
"vite-plugin-tailwind-purgecss": "^0.2.0",
"yaml": "^2.3.4"
},
"type": "module"
"type": "module",
"dependencies": {
"@sentry/sveltekit": "^7.99.0",
"highlight.js": "^11.9.0"
}
}

View File

@@ -8,3 +8,7 @@ html,
body {
@apply h-full overflow-hidden;
}
.codeblock-pre {
@apply overflow-y-auto h-[83vh];
}

21
src/hooks.client.ts Normal file
View File

@@ -0,0 +1,21 @@
import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
import * as Sentry from '@sentry/sveltekit';
Sentry.init({
dsn: 'https://6c7cfa3b76b1700cb23c34ae2fcab4ad@sentry.plygrnd.org/3',
tracesSampleRate: 1.0,
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
// If you don't want to use Session Replay, just remove the line below:
integrations: [replayIntegration()],
});
// If you have a custom error handler, pass it to `handleErrorWithSentry`
export const handleError = handleErrorWithSentry();

14
src/hooks.server.ts Normal file
View File

@@ -0,0 +1,14 @@
import { sequence } from "@sveltejs/kit/hooks";
import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
import * as Sentry from '@sentry/sveltekit';
Sentry.init({
dsn: 'https://6c7cfa3b76b1700cb23c34ae2fcab4ad@sentry.plygrnd.org/3',
tracesSampleRate: 1.0,
});
// If you have custom handlers, make sure to place them after `sentryHandle()` in the `sequence` function.
export const handle = sequence(sentryHandle());
// If you have a custom error handler, pass it to `handleErrorWithSentry`
export const handleError = handleErrorWithSentry();