Skip to content

Commit e4ec417

Browse files
committed
chore(sentry): lower polling rates
As we're getting high loads on Sentry spans, we reduce the sampling rate from 1.0 to 0.1 for production and 1.0 on staging. The reason for this is to primarily lower the amount of traces sent. However, we keep it 100% on staging to detect bugs and as traffic is lower there
1 parent 3ffbb0d commit e4ec417

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/instrument.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import * as Sentry from '@sentry/node';
22
import { nodeProfilingIntegration } from "@sentry/profiling-node";
33

4+
const env = process.env.SENTRY_ENVIRONMENT;
5+
46
// Ensure to call this before importing any other modules!
57
Sentry.init({
68
dsn: process.env.SENTRY_DSN,
79
integrations: [
810
nodeProfilingIntegration(),
911
],
1012
enabled:
11-
process.env.SENTRY_ENVIRONMENT === "production" ||
12-
process.env.SENTRY_ENVIRONMENT === "staging",
13+
env === "production" ||
14+
env === "staging",
1315

1416
// Add Performance Monitoring by setting tracesSampleRate
15-
// We recommend adjusting this value in production
16-
tracesSampleRate: 1.0,
17+
tracesSampleRate: env === "production" ? 0.1 : 1.0,
18+
19+
profilesSampleRate: env === "production" ? 0.1 : 1.0,
1720
});

0 commit comments

Comments
 (0)