From a193014716e1951d4952b72f034eaaaa8dcc18e1 Mon Sep 17 00:00:00 2001 From: vuttikais-asana Date: Thu, 29 Oct 2026 15:47:57 -0700 Subject: [PATCH 1/2] build: retain pprof 5.8.0 and add 5.15.1 for custom Node 22 --- Dockerfile.Packages | 51 ++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Dockerfile.Packages b/Dockerfile.Packages index a18babc06af9..3cfd0736dd17 100644 --- a/Dockerfile.Packages +++ b/Dockerfile.Packages @@ -28,29 +28,32 @@ RUN npm i --nodedir="/usr/src/node/node-install/usr/local" bcrypt@5.1.0 RUN npm i --nodedir="/usr/src/node/node-install/usr/local" cld@2.9.1 RUN npm i --nodedir="/usr/src/node/node-install/usr/local" unix-dgram@2.0.6 -# Build @datadog/pprof from source against Asana custom Node. -# The npm package ships with "install: exit 0" and no C++ source (only prebuilts), -# so we clone from GitHub to build the native binding against our pointer-compressed V8. -# The standard prebuilts are ABI-incompatible with --experimental-enable-pointer-compression. -RUN npm i @datadog/pprof@5.8.0 --ignore-scripts -RUN git clone --branch v5.8.0 --depth 1 https://github.com/DataDog/pprof-nodejs.git /usr/src/pprof-source -WORKDIR /usr/src/pprof-source -RUN npm install --unsafe-perm --build-from-source -RUN npm install --unsafe-perm node-gyp -RUN node_modules/.bin/node-gyp rebuild --jobs=max --nodedir=/usr/src/node/node-install/usr/local -# Replace the linux prebuilt with our pointer-compression-compatible binary. -# NODE_MODULE_VERSION and arch are read dynamically from the custom Node binary. -# Use find to locate the built .node file since the exact name may vary by version. -WORKDIR /usr/src/node -RUN ARCH=$(node -e "process.stdout.write(process.arch)") && \ - MODULES_VER=$(node -e "process.stdout.write(process.versions.modules)") && \ - PROFILER_NODE=$(find /usr/src/pprof-source/build/Release -name "*.node" | head -1) && \ - echo "Using profiler binary: $PROFILER_NODE" && \ - test -f "$PROFILER_NODE" && \ - cp "$PROFILER_NODE" \ - node_modules/@datadog/pprof/prebuilds/linuxglibc-${ARCH}/node-${MODULES_VER}.node - -RUN ls -RUN ls node_modules +# Keep both versions in separate package-store directories for the tracer upgrade. +# Build native bindings against the existing pointer-compressed Node binary and headers. +RUN set -eu; \ + for version in 5.8.0 5.15.1; do \ + package_root="/usr/src/pprof-packages/@datadog+pprof@${version}"; \ + install_root="/usr/src/pprof-install-${version}"; \ + npm install --prefix "$install_root" --ignore-scripts "@datadog/pprof@${version}"; \ + mkdir -p "$package_root/node_modules/@datadog"; \ + cp -a "$install_root/node_modules/@datadog/pprof" "$package_root/node_modules/@datadog/"; \ + git clone --branch "v${version}" --depth 1 https://github.com/DataDog/pprof-nodejs.git "/usr/src/pprof-source-${version}"; \ + cd "/usr/src/pprof-source-${version}"; \ + npm install --ignore-scripts; \ + npm install --ignore-scripts --no-save node-gyp@11.5.0; \ + node_modules/.bin/node-gyp rebuild --jobs=2 --nodedir=/usr/src/node/node-install/usr/local; \ + arch=$(node -p 'process.arch'); \ + modules_ver=$(node -p 'process.versions.modules'); \ + if [ "$version" = 5.8.0 ]; then \ + binding_path="prebuilds/linuxglibc-${arch}/node-${modules_ver}.node"; \ + else \ + binding_path="prebuilds/linux-${arch}/dd_pprof.node.abi${modules_ver}.node"; \ + fi; \ + test -f "$package_root/node_modules/@datadog/pprof/$binding_path"; \ + cp build/Release/dd_pprof.node "$package_root/node_modules/@datadog/pprof/$binding_path"; \ + NODE_PATH="$install_root/node_modules" node -e 'const assert = require("assert"); const pprof = require(process.argv[1]); pprof.time.profile({durationMillis: 100}).then(profile => pprof.encode(profile)).then(bytes => { assert(bytes.length > 0); console.log("pprof native smoke passed:", process.argv[1]); }).catch(error => { console.error(error); process.exitCode = 1; });' "$package_root/node_modules/@datadog/pprof"; \ + cd /usr/src/node; \ + done +WORKDIR /usr/src/node CMD ["bash"] From 3caecd05823dd48a008ec3fffb3493f8479c2650 Mon Sep 17 00:00:00 2001 From: vuttikais-asana Date: Thu, 29 Oct 2026 15:56:03 -0700 Subject: [PATCH 2/2] build: keep only pprof 5.15.1 in new Node 22 archives --- Dockerfile.Packages | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/Dockerfile.Packages b/Dockerfile.Packages index 3cfd0736dd17..8e39f6e97d91 100644 --- a/Dockerfile.Packages +++ b/Dockerfile.Packages @@ -28,32 +28,27 @@ RUN npm i --nodedir="/usr/src/node/node-install/usr/local" bcrypt@5.1.0 RUN npm i --nodedir="/usr/src/node/node-install/usr/local" cld@2.9.1 RUN npm i --nodedir="/usr/src/node/node-install/usr/local" unix-dgram@2.0.6 -# Keep both versions in separate package-store directories for the tracer upgrade. +# Build the pprof version required by dd-trace 5.116.0. # Build native bindings against the existing pointer-compressed Node binary and headers. RUN set -eu; \ - for version in 5.8.0 5.15.1; do \ - package_root="/usr/src/pprof-packages/@datadog+pprof@${version}"; \ - install_root="/usr/src/pprof-install-${version}"; \ - npm install --prefix "$install_root" --ignore-scripts "@datadog/pprof@${version}"; \ - mkdir -p "$package_root/node_modules/@datadog"; \ - cp -a "$install_root/node_modules/@datadog/pprof" "$package_root/node_modules/@datadog/"; \ - git clone --branch "v${version}" --depth 1 https://github.com/DataDog/pprof-nodejs.git "/usr/src/pprof-source-${version}"; \ - cd "/usr/src/pprof-source-${version}"; \ - npm install --ignore-scripts; \ - npm install --ignore-scripts --no-save node-gyp@11.5.0; \ - node_modules/.bin/node-gyp rebuild --jobs=2 --nodedir=/usr/src/node/node-install/usr/local; \ - arch=$(node -p 'process.arch'); \ - modules_ver=$(node -p 'process.versions.modules'); \ - if [ "$version" = 5.8.0 ]; then \ - binding_path="prebuilds/linuxglibc-${arch}/node-${modules_ver}.node"; \ - else \ - binding_path="prebuilds/linux-${arch}/dd_pprof.node.abi${modules_ver}.node"; \ - fi; \ - test -f "$package_root/node_modules/@datadog/pprof/$binding_path"; \ - cp build/Release/dd_pprof.node "$package_root/node_modules/@datadog/pprof/$binding_path"; \ - NODE_PATH="$install_root/node_modules" node -e 'const assert = require("assert"); const pprof = require(process.argv[1]); pprof.time.profile({durationMillis: 100}).then(profile => pprof.encode(profile)).then(bytes => { assert(bytes.length > 0); console.log("pprof native smoke passed:", process.argv[1]); }).catch(error => { console.error(error); process.exitCode = 1; });' "$package_root/node_modules/@datadog/pprof"; \ - cd /usr/src/node; \ - done + version=5.15.1; \ + package_root="/usr/src/pprof-packages/@datadog+pprof@${version}"; \ + install_root="/usr/src/pprof-install-${version}"; \ + npm install --prefix "$install_root" --ignore-scripts "@datadog/pprof@${version}"; \ + mkdir -p "$package_root/node_modules/@datadog"; \ + cp -a "$install_root/node_modules/@datadog/pprof" "$package_root/node_modules/@datadog/"; \ + git clone --branch "v${version}" --depth 1 https://github.com/DataDog/pprof-nodejs.git "/usr/src/pprof-source-${version}"; \ + cd "/usr/src/pprof-source-${version}"; \ + npm install --ignore-scripts; \ + npm install --ignore-scripts --no-save node-gyp@11.5.0; \ + node_modules/.bin/node-gyp rebuild --jobs=2 --nodedir=/usr/src/node/node-install/usr/local; \ + arch=$(node -p 'process.arch'); \ + modules_ver=$(node -p 'process.versions.modules'); \ + binding_path="prebuilds/linux-${arch}/dd_pprof.node.abi${modules_ver}.node"; \ + test -f "$package_root/node_modules/@datadog/pprof/$binding_path"; \ + cp build/Release/dd_pprof.node "$package_root/node_modules/@datadog/pprof/$binding_path"; \ + NODE_PATH="$install_root/node_modules" node -e 'const assert = require("assert"); const pprof = require(process.argv[1]); pprof.time.profile({durationMillis: 100}).then(profile => pprof.encode(profile)).then(bytes => { assert(bytes.length > 0); console.log("pprof native smoke passed:", process.argv[1]); }).catch(error => { console.error(error); process.exitCode = 1; });' "$package_root/node_modules/@datadog/pprof"; \ + cd /usr/src/node WORKDIR /usr/src/node CMD ["bash"]