feat: connect sentry to dash and api

This commit is contained in:
Rotimi Best
2026-05-21 17:18:08 +01:00
parent 25a4b1fd19
commit 0657c32c97
14 changed files with 1134 additions and 131 deletions
+20
View File
@@ -0,0 +1,20 @@
import * as Sentry from '@sentry/sveltekit';
import { dev } from '$app/environment';
import { env } from '$env/dynamic/public';
import { handleErrorWithSentry } from '@sentry/sveltekit';
const dsn = env.PUBLIC_SENTRY_DSN?.trim();
const isSelfHosted = env.PUBLIC_IS_SELFHOSTED === 'true';
if (dsn && !dev && !isSelfHosted) {
Sentry.init({
dsn,
environment: env.PUBLIC_SENTRY_ENVIRONMENT?.trim() || 'production',
tracesSampleRate: Number(env.PUBLIC_SENTRY_TRACES_SAMPLE_RATE ?? 0),
replaysSessionSampleRate: Number(env.PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE ?? 0),
replaysOnErrorSampleRate: Number(env.PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE ?? 1),
integrations: [Sentry.replayIntegration()]
});
}
export const handleError = handleErrorWithSentry();