Prevented profiling from being enabled if tracing is not enabled

This commit is contained in:
Chris Raible 2023-12-12 17:58:26 -08:00
parent 8c33a99c46
commit e0a50fc9b3
1 changed files with 5 additions and 4 deletions

View File

@ -75,10 +75,11 @@ if (sentryConfig && !sentryConfig.disabled) {
sentryInitConfig.integrations.push(new Sentry.Integrations.Http({tracing: true}));
sentryInitConfig.integrations.push(new Sentry.Integrations.Express());
sentryInitConfig.tracesSampleRate = parseFloat(sentryConfig.tracing.sampleRate) || 0.0;
}
if (sentryConfig.profiling?.enabled === true) {
sentryInitConfig.integrations.push(new ProfilingIntegration());
sentryInitConfig.profilesSampleRate = parseFloat(sentryConfig.profiling.sampleRate) || 0.0;
// Enable profiling, if configured, only if tracing is also configured
if (sentryConfig.profiling?.enabled === true) {
sentryInitConfig.integrations.push(new ProfilingIntegration());
sentryInitConfig.profilesSampleRate = parseFloat(sentryConfig.profiling.sampleRate) || 0.0;
}
}
Sentry.init(sentryInitConfig);