Skip to content

Commit 1ae4d6e

Browse files
committed
fix: not using sentry if var is not provided
1 parent 03b4f9c commit 1ae4d6e

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

indexer/src/kadena-server/plugins/instrument.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,25 @@ const SENTRY_DSN = process.env['SENTRY_DSN'];
99
const SENTRY_ENVIRONMENT = 'production';
1010
const SENTRY_RELEASE = 'v1.0.0';
1111

12-
if (SENTRY_DSN === undefined || SENTRY_DSN === 0) {
13-
console.info('[INFO][SENTRY][LOG] Not using Sentry as it is disabled by not setting SENTRY_DSN env var');
14-
return;
12+
if (!SENTRY_DSN || SENTRY_DSN.trim() === '') {
13+
console.info(
14+
'[INFO][SENTRY][LOG] Not using Sentry as it is disabled by not setting SENTRY_DSN env var',
15+
);
16+
} else {
17+
// Initialize Sentry
18+
console.info('[INFO][SENTRY][INIT] Initializing Sentry error reporting');
19+
Sentry.init({
20+
dsn: SENTRY_DSN,
21+
environment: SENTRY_ENVIRONMENT,
22+
release: SENTRY_RELEASE,
23+
sendDefaultPii: true,
24+
tracesSampleRate: 1.0,
25+
profileSessionSampleRate: 1.0,
26+
profileLifecycle: 'trace',
27+
integrations: [
28+
nodeProfilingIntegration(),
29+
Sentry.graphqlIntegration({ useOperationNameForRootSpan: true }),
30+
],
31+
debug: false,
32+
});
1533
}
16-
17-
// Initialize Sentry
18-
console.info('[INFO][SENTRY][INIT] Initializing Sentry error reporting');
19-
Sentry.init({
20-
dsn: SENTRY_DSN,
21-
environment: SENTRY_ENVIRONMENT,
22-
release: SENTRY_RELEASE,
23-
sendDefaultPii: true,
24-
tracesSampleRate: 1.0,
25-
profileSessionSampleRate: 1.0,
26-
profileLifecycle: 'trace',
27-
integrations: [
28-
nodeProfilingIntegration(),
29-
Sentry.graphqlIntegration({ useOperationNameForRootSpan: true }),
30-
],
31-
debug: false,
32-
});

0 commit comments

Comments
 (0)