Skip to content

fix(node): Fix check for performance integrations #12043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading