mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Lazyloaded @sentry/profiling-node
dependency
- we don't need to load this if we haven't configured Node profiling to occur - this might help fix random segfaults we've been seeing in CI, which only started occurring after this dependency was added
This commit is contained in:
parent
3508cd12fe
commit
d21ab1aa4e
1 changed files with 14 additions and 12 deletions
|
@ -4,15 +4,6 @@ const SentryKnexTracingIntegration = require('./SentryKnexTracingIntegration');
|
||||||
const sentryConfig = config.get('sentry');
|
const sentryConfig = config.get('sentry');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
|
||||||
// Import Sentry's profiling integration if available
|
|
||||||
let ProfilingIntegration;
|
|
||||||
try {
|
|
||||||
({ProfilingIntegration} = require('@sentry/profiling-node'));
|
|
||||||
} catch (err) {
|
|
||||||
logging.warn('Sentry Profiling Integration not available');
|
|
||||||
ProfilingIntegration = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const beforeSend = function (event, hint) {
|
const beforeSend = function (event, hint) {
|
||||||
try {
|
try {
|
||||||
const exception = hint.originalException;
|
const exception = hint.originalException;
|
||||||
|
@ -85,9 +76,20 @@ if (sentryConfig && !sentryConfig.disabled) {
|
||||||
sentryInitConfig.integrations.push(new Sentry.Integrations.Express());
|
sentryInitConfig.integrations.push(new Sentry.Integrations.Express());
|
||||||
sentryInitConfig.tracesSampleRate = parseFloat(sentryConfig.tracing.sampleRate) || 0.0;
|
sentryInitConfig.tracesSampleRate = parseFloat(sentryConfig.tracing.sampleRate) || 0.0;
|
||||||
// Enable profiling, if configured, only if tracing is also configured
|
// Enable profiling, if configured, only if tracing is also configured
|
||||||
if (ProfilingIntegration && sentryConfig.profiling?.enabled === true) {
|
if (sentryConfig.profiling?.enabled === true) {
|
||||||
sentryInitConfig.integrations.push(new ProfilingIntegration());
|
// Import Sentry's profiling integration if available
|
||||||
sentryInitConfig.profilesSampleRate = parseFloat(sentryConfig.profiling.sampleRate) || 0.0;
|
let ProfilingIntegration;
|
||||||
|
try {
|
||||||
|
({ProfilingIntegration} = require('@sentry/profiling-node'));
|
||||||
|
} catch (err) {
|
||||||
|
logging.warn('Sentry Profiling Integration not available');
|
||||||
|
ProfilingIntegration = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProfilingIntegration) {
|
||||||
|
sentryInitConfig.integrations.push(new ProfilingIntegration());
|
||||||
|
sentryInitConfig.profilesSampleRate = parseFloat(sentryConfig.profiling.sampleRate) || 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Sentry.init(sentryInitConfig);
|
Sentry.init(sentryInitConfig);
|
||||||
|
|
Loading…
Reference in a new issue