server/utils/sentry.ts
2025-03-30 23:06:34 +02:00

24 lines
864 B
TypeScript

import * as Sentry from "@sentry/bun";
import { env } from "bun";
import { config } from "~/config.ts";
import pkg from "~/package.json";
const sentryInstance =
config.logging.sentry &&
Sentry.init({
dsn: config.logging.sentry.dsn.origin,
debug: config.logging.sentry.debug,
sampleRate: config.logging.sentry.sample_rate,
maxBreadcrumbs: config.logging.sentry.max_breadcrumbs,
tracesSampleRate: config.logging.sentry.traces_sample_rate,
environment: config.logging.sentry.environment,
tracePropagationTargets:
config.logging.sentry.trace_propagation_targets,
release: env.GIT_COMMIT
? `${pkg.version}-${env.GIT_COMMIT}`
: pkg.version,
integrations: [Sentry.extraErrorDataIntegration()],
});
export const sentry = sentryInstance || undefined;