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
11 changes: 3 additions & 8 deletions docs/supporting-a-new-node-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,10 @@ Reference: [#20710](https://github.com/getsentry/sentry-javascript/pull/20710)
- [ ] `@sentry-internal/node-native-stacktrace` in `packages/node-native/package.json`
- [ ] Run `yarn install` to update `yarn.lock`

3. Register the new ABI in the profiling pruner. In
`packages/profiling-node/scripts/prune-profiler-binaries.js`:
- [ ] Add the Node major to ABI mapping to the `NODE_TO_ABI` object (e.g. `26: '147'`).
- [ ] Add the corresponding `else if (NODE.startsWith('26'))` branch.

4. Allow the new major in the profiling integration, in `packages/profiling-node/src/integration.ts`:
3. Allow the new major in the profiling integration, in `packages/profiling-node/src/integration.ts`:
- [ ] Add the version number to the `if (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR))` guard
- [ ] Add the version to the supported-versions list in the `console.warn` message below the guard (the string that reads `...prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22, 24.`)

5. Handle deprecation warnings. Each new Node version tends to deprecate APIs the SDK (or its dependencies) still use, which can break tests that assert on clean stderr or console output.
4. Handle deprecation warnings. Each new Node version tends to deprecate APIs the SDK (or its dependencies) still use, which can break tests that assert on clean stderr or console output.

6. Fix version-specific test failures, some integrations or test dependencies may not yet work on the new version.
5. Fix version-specific test failures, some integrations or test dependencies may not yet work on the new version.
42 changes: 2 additions & 40 deletions packages/profiling-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,46 +234,8 @@ require('esbuild').build({

Once you run `node esbuild.serverless.js` esbuild wil bundle and output the files to ./dist folder, but note that all of
the binaries will be copied. This is wasteful as you will likely only need one of these libraries to be available during
runtime.

> **Deprecation notice:** This script will be removed in the next major version. If you depend on it, please comment on
> [this issue](https://github.com/getsentry/sentry-javascript/issues/20567).

To prune the other libraries, profiling-node ships with a small utility script that helps you prune unused binaries:

```bash
npx --package=@sentry/profiling-node sentry-prune-profiler-binaries
```

Use `--help` to see a list of available options or `--dry-run` if you want it to log the binaries that would have been
deleted.

Example of only preserving a binary to run node16 on linux x64 musl.

```bash
npx --package=@sentry/profiling-node sentry-prune-profiler-binaries --target_dir_path=./dist --target_platform=linux --target_node=16 --target_stdlib=musl --target_arch=x64
```

Which will output something like

```
Sentry: pruned ./dist/sentry_cpu_profiler-darwin-x64-108-IFGH3SUR.node (90.41 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-darwin-x64-93-Q7KBVHSP.node (74.16 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-arm64-glibc-108-NXSISRTB.node (52.17 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-arm64-glibc-83-OEQT5HUK.node (52.08 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-arm64-glibc-93-IIXXW2PN.node (52.06 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-arm64-musl-108-DSILNYHA.node (48.46 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-arm64-musl-83-4CNOBNC3.node (48.37 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-arm64-musl-93-JA5PKNWQ.node (48.38 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-x64-glibc-108-NXSISRTB.node (52.17 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-x64-glibc-83-OEQT5HUK.node (52.08 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-x64-glibc-93-IIXXW2PN.node (52.06 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-x64-musl-108-CX7SL27U.node (51.50 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-linux-x64-musl-83-YD7ZQK2E.node (51.53 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-win32-x64-108-P7V3URQV.node (181.50 KiB)
Sentry: pruned ./dist/sentry_cpu_profiler-win32-x64-93-3PKQDSGE.node (181.50 KiB)
✅ Sentry: pruned 15 binaries, saved 1.06 MiB in total.
```
runtime. Since the binaries follow the `sentry_cpu_profiler-<platform>-<arch>-<stdlib>-<abi>.node` naming scheme, you can

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The documentation incorrectly describes the binary naming scheme, stating all platforms include a <stdlib> segment, which is only true for Linux.
Severity: LOW

Suggested Fix

Update the documentation to accurately reflect the different naming schemes for each platform (Linux, Darwin, Windows). Specifically, clarify that the <stdlib> segment is Linux-specific. Also, include the <hash> suffix in the example patterns to match the real filenames. For example, provide separate patterns for Linux (...-<stdlib>-...), Darwin (...-<arch>-<abi>...), and Windows.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/profiling-node/README.md#L237

Potential issue: The documentation at `packages/profiling-node/README.md:237` introduces
an inaccurate description for the profiler's binary naming scheme. It presents the
pattern `sentry_cpu_profiler-<platform>-<arch>-<stdlib>-<abi>.node` as universal.
However, the `<stdlib>` segment is only present for Linux platforms (e.g., `glibc`,
`musl`). For macOS (Darwin) and Windows, this segment is absent. This inaccuracy will
cause confusion for developers following the new manual instructions for pruning
binaries, as they will be unable to find files matching the documented pattern on
non-Linux systems. The documentation also omits the `<hash>` suffix present in actual
filenames.

Did we get this right? 👍 / 👎 to inform future reviews.

delete the ones that do not match your target runtime as part of your build step to reduce the deployment size.

### Environment flags

Expand Down
6 changes: 1 addition & 5 deletions packages/profiling-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
}
}
},
"bin": {
"sentry-prune-profiler-binaries": "scripts/prune-profiler-binaries.js"
},
"engines": {
"node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0"
},
Expand All @@ -33,8 +30,7 @@
},
"files": [
"/build",
"package.json",
"/scripts/prune-profiler-binaries.js"
"package.json"
],
"scripts": {
"clean": "rm -rf build",
Expand Down
204 changes: 0 additions & 204 deletions packages/profiling-node/scripts/prune-profiler-binaries.js

This file was deleted.

24 changes: 0 additions & 24 deletions packages/profiling-node/test/prune-profiler-binaries.test.ts

This file was deleted.

Loading