diff --git a/src/instrument.mjs b/src/instrument.mjs index 8e93c1d3..fcb52e02 100644 --- a/src/instrument.mjs +++ b/src/instrument.mjs @@ -1,6 +1,8 @@ import * as Sentry from '@sentry/node'; import { nodeProfilingIntegration } from "@sentry/profiling-node"; +const env = process.env.SENTRY_ENVIRONMENT; + // Ensure to call this before importing any other modules! Sentry.init({ dsn: process.env.SENTRY_DSN, @@ -8,10 +10,11 @@ Sentry.init({ nodeProfilingIntegration(), ], enabled: - process.env.SENTRY_ENVIRONMENT === "production" || - process.env.SENTRY_ENVIRONMENT === "staging", + env === "production" || + env === "staging", // Add Performance Monitoring by setting tracesSampleRate - // We recommend adjusting this value in production - tracesSampleRate: 1.0, + tracesSampleRate: env === "production" ? 0.1 : 1.0, + + profilesSampleRate: env === "production" ? 0.1 : 1.0, });