Skip to content

Commit f2693bd

Browse files
authored
Merge pull request #387 from hack-a-chain-software/main
refactor: sentry is not mandatory to start the indexer (Develop Merge)
2 parents e67c392 + 3aece9a commit f2693bd

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

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

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,29 @@ import { nodeProfilingIntegration } from '@sentry/profiling-node';
55
/**
66
* Sentry configuration
77
*/
8-
const SENTRY_DSN = getRequiredEnvString('SENTRY_DSN');
8+
const SENTRY_DSN = process.env['SENTRY_DSN'];
99
const SENTRY_ENVIRONMENT = 'production';
1010
const SENTRY_RELEASE = 'v1.0.0';
1111

12-
// Initialize Sentry
13-
console.info('[INFO][SENTRY][INIT] Initializing Sentry error reporting');
14-
Sentry.init({
15-
dsn: SENTRY_DSN,
16-
environment: SENTRY_ENVIRONMENT,
17-
release: SENTRY_RELEASE,
18-
sendDefaultPii: true,
19-
tracesSampleRate: 1.0,
20-
profileSessionSampleRate: 1.0,
21-
profileLifecycle: 'trace',
22-
integrations: [
23-
nodeProfilingIntegration(),
24-
Sentry.graphqlIntegration({ useOperationNameForRootSpan: true }),
25-
],
26-
debug: false,
27-
});
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+
});
33+
}

0 commit comments

Comments
 (0)