Skip to content

Commit

Permalink
fix(node): Fix check for performance integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed May 15, 2024
1 parent 733ae1d commit dd1365c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/node/src/sdk/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,23 @@ export function getDefaultIntegrationsWithoutPerformance(): Integration[] {
export function getDefaultIntegrations(options: Options): Integration[] {
return [
...getDefaultIntegrationsWithoutPerformance(),
...(hasTracingEnabled(options) ? getAutoPerformanceIntegrations() : []),
// We only add performance integrations if tracing is enabled
// Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added
// This means that generally request isolation will work (because that is done by httpIntegration)
// But `transactionName` will not be set automatically
...(shouldAddPerformanceIntegrations(options) ? getAutoPerformanceIntegrations() : []),
];
}

function shouldAddPerformanceIntegrations(options: Options): boolean {
if (!hasTracingEnabled(options)) {
return false;
}

// We want to ensure `tracesSampleRate` is not just undefined/null here
return options.enableTracing || options.tracesSampleRate != null || 'tracesSampler' in options;
}

declare const __IMPORT_META_URL_REPLACEMENT__: string;

/**
Expand Down

0 comments on commit dd1365c

Please sign in to comment.