diff --git a/CHANGELOG.md b/CHANGELOG.md index ce01f93fa..e9a6091ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Reduced Sentry span sampling to 10% outside development. [#1475](https://github.com/sourcebot-dev/sourcebot/pull/1475) + ## [5.1.3] - 2026-07-20 ### Added diff --git a/packages/backend/src/instrument.ts b/packages/backend/src/instrument.ts index 87866b378..8b0beccac 100644 --- a/packages/backend/src/instrument.ts +++ b/packages/backend/src/instrument.ts @@ -12,6 +12,7 @@ if (!!env.NEXT_PUBLIC_SENTRY_BACKEND_DSN && !!env.NEXT_PUBLIC_SENTRY_ENVIRONMENT // to the version for builds that don't pass a commit SHA. release: env.NEXT_PUBLIC_BUILD_COMMIT_SHA ?? SOURCEBOT_VERSION, environment: env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, + tracesSampleRate: env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1, }); } else { logger.debug("Sentry was not initialized"); diff --git a/packages/web/src/instrumentation-client.ts b/packages/web/src/instrumentation-client.ts index fb0ff0171..7bcbc385f 100644 --- a/packages/web/src/instrumentation-client.ts +++ b/packages/web/src/instrumentation-client.ts @@ -15,7 +15,7 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN && !!process.env.NEXT_PUBLIC_SEN integrations: [ Sentry.browserProfilingIntegration(), ], - tracesSampleRate: 1.0, + tracesSampleRate: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1, // Evaluated once per `Sentry.init()`, i.e. once per page load. profileSessionSampleRate: 1.0, // Profile only while a sampled root span is active, rather than continuously. diff --git a/packages/web/src/sentry.edge.config.ts b/packages/web/src/sentry.edge.config.ts index 77866181f..05c897ac1 100644 --- a/packages/web/src/sentry.edge.config.ts +++ b/packages/web/src/sentry.edge.config.ts @@ -10,7 +10,7 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN && !!process.env.NEXT_PUBLIC_SEN dsn: process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN, environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, - tracesSampleRate: 1.0, + tracesSampleRate: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1, // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, diff --git a/packages/web/src/sentry.server.config.ts b/packages/web/src/sentry.server.config.ts index cd7d6b98d..6ba395674 100644 --- a/packages/web/src/sentry.server.config.ts +++ b/packages/web/src/sentry.server.config.ts @@ -15,7 +15,7 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN && !!process.env.NEXT_PUBLIC_SEN integrations: [ nodeProfilingIntegration(), ], - tracesSampleRate: 1.0, + tracesSampleRate: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1, // Evaluated once per `Sentry.init()`, i.e. once per server process. profileSessionSampleRate: 1.0, // Profile only while a sampled root span is active, rather than continuously.