15 lines
617 B
TypeScript
15 lines
617 B
TypeScript
import * as Sentry from "@sentry/node";
|
|
import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
|
|
|
export const setupSentry = () => {
|
|
if (process.env.SENTRY_DSN) {
|
|
Sentry.init({
|
|
dsn: process.env.SENTRY_DSN,
|
|
integrations: [Sentry.httpIntegration(), Sentry.expressIntegration(), nodeProfilingIntegration()],
|
|
tracesSampleRate: process.env.SENTRY_TRACES_SAMPLE_RATE ? parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE) : 0.5,
|
|
environment: process.env.SENTRY_ENVIRONMENT || "development",
|
|
release: process.env.APP_VERSION || "v1.0.0",
|
|
sendDefaultPii: true,
|
|
});
|
|
}
|
|
};
|