Skip to content
sentry.ts 1.01 KiB
Newer Older
Grant's avatar
Grant committed
import * as Sentry from "@sentry/react";

if (__SENTRY_DSN__) {
  Sentry.init({
    dsn: __SENTRY_DSN__,
    environment: import.meta.env.MODE,
    tunnel: "/api/_meta",
    integrations: [
      Sentry.browserTracingIntegration(),
      Sentry.replayIntegration(),
    ],
    // Tracing
    tracesSampleRate: 1.0, //  Capture 100% of the transactions
    // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
    tracePropagationTargets: [
      "localhost",
      new RegExp(
        "^" + window.location.protocol + "//" + window.location.host + "/api"
      ),
    ],
    // Session Replay
    replaysSessionSampleRate: 1.0, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
    replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
  });
  console.log("Sentry loaded with", __SENTRY_DSN__);
}