mirror of
https://github.com/versia-pub/versia-go.git
synced 2026-03-13 04:29:15 +01:00
28 lines
769 B
TypeScript
28 lines
769 B
TypeScript
import * as Sentry from "@sentry/react";
|
|
import {ENVIRONMENT, SENTRY_DSN} from "./env.ts";
|
|
import {router} from "./routing.ts";
|
|
|
|
const sampleRate =
|
|
ENVIRONMENT === "development" ? 1 : ENVIRONMENT === "staging" ? 0.5 : 0.2;
|
|
|
|
Sentry.init({
|
|
dsn: SENTRY_DSN,
|
|
environment: ENVIRONMENT,
|
|
sampleRate,
|
|
tracesSampleRate: 1.0,
|
|
// TODO: Add more targets
|
|
tracePropagationTargets: [/^\//, /^http(s)?:\/\/localhost\//],
|
|
profilesSampleRate: 1.0,
|
|
integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router)],
|
|
});
|
|
|
|
if (SENTRY_DSN) {
|
|
console.log(
|
|
"Sentry initialized with DSN",
|
|
SENTRY_DSN,
|
|
"and environment",
|
|
ENVIRONMENT,
|
|
);
|
|
} else {
|
|
console.warn("Sentry not initialized because no DSN is set");
|
|
}
|