Skip to content

Commit e1ce46b

Browse files
chore: reduce Sentry span sampling outside development (#1475)
* chore: reduce Sentry event sampling outside development * chore: update changelog for PR 1475 * fix: sample Sentry spans instead of errors
1 parent fbfea1a commit e1ce46b

5 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- Reduced Sentry span sampling to 10% outside development. [#1475](https://github.com/sourcebot-dev/sourcebot/pull/1475)
12+
1013
## [5.1.3] - 2026-07-20
1114

1215
### Added

packages/backend/src/instrument.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if (!!env.NEXT_PUBLIC_SENTRY_BACKEND_DSN && !!env.NEXT_PUBLIC_SENTRY_ENVIRONMENT
1212
// to the version for builds that don't pass a commit SHA.
1313
release: env.NEXT_PUBLIC_BUILD_COMMIT_SHA ?? SOURCEBOT_VERSION,
1414
environment: env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
15+
tracesSampleRate: env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1,
1516
});
1617
} else {
1718
logger.debug("Sentry was not initialized");

packages/web/src/instrumentation-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN && !!process.env.NEXT_PUBLIC_SEN
1515
integrations: [
1616
Sentry.browserProfilingIntegration(),
1717
],
18-
tracesSampleRate: 1.0,
18+
tracesSampleRate: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1,
1919
// Evaluated once per `Sentry.init()`, i.e. once per page load.
2020
profileSessionSampleRate: 1.0,
2121
// Profile only while a sampled root span is active, rather than continuously.

packages/web/src/sentry.edge.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN && !!process.env.NEXT_PUBLIC_SEN
1010
dsn: process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN,
1111
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
1212

13-
tracesSampleRate: 1.0,
13+
tracesSampleRate: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1,
1414

1515
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1616
debug: false,

packages/web/src/sentry.server.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_WEBAPP_DSN && !!process.env.NEXT_PUBLIC_SEN
1515
integrations: [
1616
nodeProfilingIntegration(),
1717
],
18-
tracesSampleRate: 1.0,
18+
tracesSampleRate: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === 'development' ? 1.0 : 0.1,
1919
// Evaluated once per `Sentry.init()`, i.e. once per server process.
2020
profileSessionSampleRate: 1.0,
2121
// Profile only while a sampled root span is active, rather than continuously.

0 commit comments

Comments
 (0)