Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions packages/profiling-node/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { IntegrationFn, Span } from '@sentry/types';
import { logger } from '@sentry/utils';

import { DEBUG_BUILD } from './debug-build';
import { NODE_MAJOR, NODE_VERSION } from './nodeVersion';
import { MAX_PROFILE_DURATION_MS, maybeProfileSpan, stopSpanProfile } from './spanProfileUtils';
import type { Profile, RawThreadCpuProfile } from './types';

Expand All @@ -25,6 +26,15 @@ function addToProfileQueue(profile: RawThreadCpuProfile): void {

/** Exported only for tests. */
export const _nodeProfilingIntegration = (() => {
if (DEBUG_BUILD && ![16, 18, 20, 22].includes(NODE_MAJOR)) {
logger.warn(
`[Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`,
'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.',
'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',
'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',
);
}

return {
name: 'ProfilingIntegration',
setup(client: NodeClient) {
Expand Down
4 changes: 4 additions & 0 deletions packages/profiling-node/src/nodeVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { parseSemver } from '@sentry/utils';

export const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number };
export const NODE_MAJOR = NODE_VERSION.major;