Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/instrument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/instrumentation-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong Sentry sampling option

High Severity

The change intended to sample Sentry error events at 10% outside development. Instead, tracesSampleRate was modified, leaving error capture at 100%. This samples web traces and associated profiling at 10% (instead of 100%) and newly enables backend performance tracing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit af8c811. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev sampling env mismatch

Medium Severity

The tracesSampleRate condition expects NEXT_PUBLIC_SENTRY_ENVIRONMENT to be 'development' for full sampling. The .env.development example uses 'dev', which means development environments will get a reduced sampling rate (0.1) instead of 1.0.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit af8c811. Configure here.

// 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.
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading