@datadog/pprof 5.18.0 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/out/src/async-context-frame.d.ts +48 -0
  2. package/out/src/async-context-frame.js +106 -0
  3. package/out/src/async-context-frame.js.map +1 -0
  4. package/out/src/heap-profiler-bindings.d.ts +1 -1
  5. package/out/src/heap-profiler-bindings.js +2 -2
  6. package/out/src/heap-profiler-bindings.js.map +1 -1
  7. package/out/src/heap-profiler.d.ts +25 -12
  8. package/out/src/heap-profiler.js +16 -12
  9. package/out/src/heap-profiler.js.map +1 -1
  10. package/out/src/index.d.ts +1 -0
  11. package/out/src/index.js.map +1 -1
  12. package/out/src/otel-thread-ctx.d.ts +18 -6
  13. package/out/src/otel-thread-ctx.js +13 -24
  14. package/out/src/otel-thread-ctx.js.map +1 -1
  15. package/package.json +5 -5
  16. package/prebuilds/darwin-arm64/dd_pprof.node.abi108.node +0 -0
  17. package/prebuilds/darwin-arm64/dd_pprof.node.abi111.node +0 -0
  18. package/prebuilds/darwin-arm64/dd_pprof.node.abi115.node +0 -0
  19. package/prebuilds/darwin-arm64/dd_pprof.node.abi120.node +0 -0
  20. package/prebuilds/darwin-arm64/dd_pprof.node.abi127.node +0 -0
  21. package/prebuilds/darwin-arm64/dd_pprof.node.abi131.node +0 -0
  22. package/prebuilds/darwin-arm64/dd_pprof.node.abi137.node +0 -0
  23. package/prebuilds/darwin-arm64/dd_pprof.node.abi141.node +0 -0
  24. package/prebuilds/darwin-arm64/dd_pprof.node.abi147.node +0 -0
  25. package/prebuilds/darwin-x64/dd_pprof.node.abi108.node +0 -0
  26. package/prebuilds/darwin-x64/dd_pprof.node.abi111.node +0 -0
  27. package/prebuilds/darwin-x64/dd_pprof.node.abi115.node +0 -0
  28. package/prebuilds/darwin-x64/dd_pprof.node.abi120.node +0 -0
  29. package/prebuilds/darwin-x64/dd_pprof.node.abi127.node +0 -0
  30. package/prebuilds/darwin-x64/dd_pprof.node.abi131.node +0 -0
  31. package/prebuilds/darwin-x64/dd_pprof.node.abi137.node +0 -0
  32. package/prebuilds/darwin-x64/dd_pprof.node.abi141.node +0 -0
  33. package/prebuilds/darwin-x64/dd_pprof.node.abi147.node +0 -0
  34. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi108.node +0 -0
  35. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi111.node +0 -0
  36. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi115.node +0 -0
  37. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi120.node +0 -0
  38. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi127.node +0 -0
  39. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi131.node +0 -0
  40. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi137.node +0 -0
  41. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi141.node +0 -0
  42. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi147.node +0 -0
  43. package/prebuilds/linux-arm64/dd_pprof.node.abi108.node +0 -0
  44. package/prebuilds/linux-arm64/dd_pprof.node.abi111.node +0 -0
  45. package/prebuilds/linux-arm64/dd_pprof.node.abi115.node +0 -0
  46. package/prebuilds/linux-arm64/dd_pprof.node.abi120.node +0 -0
  47. package/prebuilds/linux-arm64/dd_pprof.node.abi127.node +0 -0
  48. package/prebuilds/linux-arm64/dd_pprof.node.abi131.node +0 -0
  49. package/prebuilds/linux-arm64/dd_pprof.node.abi137.node +0 -0
  50. package/prebuilds/linux-arm64/dd_pprof.node.abi141.node +0 -0
  51. package/prebuilds/linux-arm64/dd_pprof.node.abi147.node +0 -0
  52. package/prebuilds/linux-x64/dd_pprof.musl.node.abi108.node +0 -0
  53. package/prebuilds/linux-x64/dd_pprof.musl.node.abi111.node +0 -0
  54. package/prebuilds/linux-x64/dd_pprof.musl.node.abi115.node +0 -0
  55. package/prebuilds/linux-x64/dd_pprof.musl.node.abi120.node +0 -0
  56. package/prebuilds/linux-x64/dd_pprof.musl.node.abi127.node +0 -0
  57. package/prebuilds/linux-x64/dd_pprof.musl.node.abi131.node +0 -0
  58. package/prebuilds/linux-x64/dd_pprof.musl.node.abi137.node +0 -0
  59. package/prebuilds/linux-x64/dd_pprof.musl.node.abi141.node +0 -0
  60. package/prebuilds/linux-x64/dd_pprof.musl.node.abi147.node +0 -0
  61. package/prebuilds/linux-x64/dd_pprof.node.abi108.node +0 -0
  62. package/prebuilds/linux-x64/dd_pprof.node.abi111.node +0 -0
  63. package/prebuilds/linux-x64/dd_pprof.node.abi115.node +0 -0
  64. package/prebuilds/linux-x64/dd_pprof.node.abi120.node +0 -0
  65. package/prebuilds/linux-x64/dd_pprof.node.abi127.node +0 -0
  66. package/prebuilds/linux-x64/dd_pprof.node.abi131.node +0 -0
  67. package/prebuilds/linux-x64/dd_pprof.node.abi137.node +0 -0
  68. package/prebuilds/linux-x64/dd_pprof.node.abi141.node +0 -0
  69. package/prebuilds/linux-x64/dd_pprof.node.abi147.node +0 -0
  70. package/prebuilds/win32-x64/dd_pprof.node.abi108.node +0 -0
  71. package/prebuilds/win32-x64/dd_pprof.node.abi111.node +0 -0
  72. package/prebuilds/win32-x64/dd_pprof.node.abi115.node +0 -0
  73. package/prebuilds/win32-x64/dd_pprof.node.abi120.node +0 -0
  74. package/prebuilds/win32-x64/dd_pprof.node.abi127.node +0 -0
  75. package/prebuilds/win32-x64/dd_pprof.node.abi131.node +0 -0
  76. package/prebuilds/win32-x64/dd_pprof.node.abi137.node +0 -0
  77. package/prebuilds/win32-x64/dd_pprof.node.abi141.node +0 -0
  78. package/prebuilds/win32-x64/dd_pprof.node.abi147.node +0 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Whether this process's `AsyncLocalStorage` is backed by AsyncContextFrame,
3
+ * which is what puts the active value in the isolate's
4
+ * ContinuationPreservedEmbedderData slot that this addon reads.
5
+ *
6
+ * Feature-detected rather than inferred from the Node version plus
7
+ * `process.execArgv`, because the two disagree in both directions and each
8
+ * combination is reachable today:
9
+ *
10
+ * - `NODE_OPTIONS=--experimental-async-context-frame` is accepted from Node
11
+ * 22.7.0 through 23 and turns ACF on without appearing in `execArgv`.
12
+ * Inferring "off" there makes callers refuse to run in a process that would
13
+ * have worked.
14
+ * - `NODE_OPTIONS=--no-async-context-frame` is accepted on Node 24 and turns
15
+ * ACF off without appearing in `execArgv`. Inferring "on" there is the worse
16
+ * error: the CPED slot is never written, so a writer that starts anyway keeps
17
+ * looking healthy from JS — `getStore()` still works — while every
18
+ * out-of-process reader sees a record that nothing ever updates.
19
+ * - A worker thread created with an explicit `execArgv` doesn't inherit the
20
+ * main thread's command line either, and tooling sometimes rewrites
21
+ * `process.execArgv` outright.
22
+ *
23
+ * Detected by asking the addon what is in the CPED slot during a `run()`. With
24
+ * ACF, Node installs an AsyncContextFrame — a JS Map keyed by the
25
+ * `AsyncLocalStorage` instance, valued by its store — as the running
26
+ * continuation's CPED; without it, nothing writes the slot. So a probe storage
27
+ * whose own store is visible there is direct evidence, and it is evidence about
28
+ * the exact slot both consumers read: `WallProfiler::SetContext` requires that
29
+ * Map, and the thread-ctx reader looks this very key up by the identity hash
30
+ * published as `als_identity_hash`.
31
+ *
32
+ * Observing whether `run()` delegates to `enterWith()` would be an indirect
33
+ * proxy for the same thing: it holds today, but it depends on `run()`
34
+ * dispatching through the instance property, which is unspecified and which
35
+ * anything patching `AsyncLocalStorage` can break — and the failure would be
36
+ * silent and in the dangerous direction.
37
+ *
38
+ * Memoized: the answer is fixed for the life of the thread.
39
+ */
40
+ export declare function isAsyncContextFrameActive(): boolean;
41
+ /**
42
+ * How to turn AsyncContextFrame on, for the error message of whatever declined
43
+ * to run without it.
44
+ *
45
+ * Advisory text only — never decide availability from this. That is what
46
+ * {@link isAsyncContextFrameActive} is for.
47
+ */
48
+ export declare function asyncContextFrameHint(): string;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2026 Datadog, Inc
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.isAsyncContextFrameActive = isAsyncContextFrameActive;
19
+ exports.asyncContextFrameHint = asyncContextFrameHint;
20
+ const node_async_hooks_1 = require("node:async_hooks");
21
+ const path_1 = require("path");
22
+ let addon;
23
+ // Required lazily so importing this module doesn't force the addon to load;
24
+ // memoized by isAsyncContextFrameActive, so this runs at most once per thread.
25
+ function bindings() {
26
+ if (!addon) {
27
+ const findBinding = require('node-gyp-build');
28
+ addon = findBinding((0, path_1.join)(__dirname, '..', '..'));
29
+ }
30
+ return addon;
31
+ }
32
+ let active;
33
+ /**
34
+ * Whether this process's `AsyncLocalStorage` is backed by AsyncContextFrame,
35
+ * which is what puts the active value in the isolate's
36
+ * ContinuationPreservedEmbedderData slot that this addon reads.
37
+ *
38
+ * Feature-detected rather than inferred from the Node version plus
39
+ * `process.execArgv`, because the two disagree in both directions and each
40
+ * combination is reachable today:
41
+ *
42
+ * - `NODE_OPTIONS=--experimental-async-context-frame` is accepted from Node
43
+ * 22.7.0 through 23 and turns ACF on without appearing in `execArgv`.
44
+ * Inferring "off" there makes callers refuse to run in a process that would
45
+ * have worked.
46
+ * - `NODE_OPTIONS=--no-async-context-frame` is accepted on Node 24 and turns
47
+ * ACF off without appearing in `execArgv`. Inferring "on" there is the worse
48
+ * error: the CPED slot is never written, so a writer that starts anyway keeps
49
+ * looking healthy from JS — `getStore()` still works — while every
50
+ * out-of-process reader sees a record that nothing ever updates.
51
+ * - A worker thread created with an explicit `execArgv` doesn't inherit the
52
+ * main thread's command line either, and tooling sometimes rewrites
53
+ * `process.execArgv` outright.
54
+ *
55
+ * Detected by asking the addon what is in the CPED slot during a `run()`. With
56
+ * ACF, Node installs an AsyncContextFrame — a JS Map keyed by the
57
+ * `AsyncLocalStorage` instance, valued by its store — as the running
58
+ * continuation's CPED; without it, nothing writes the slot. So a probe storage
59
+ * whose own store is visible there is direct evidence, and it is evidence about
60
+ * the exact slot both consumers read: `WallProfiler::SetContext` requires that
61
+ * Map, and the thread-ctx reader looks this very key up by the identity hash
62
+ * published as `als_identity_hash`.
63
+ *
64
+ * Observing whether `run()` delegates to `enterWith()` would be an indirect
65
+ * proxy for the same thing: it holds today, but it depends on `run()`
66
+ * dispatching through the instance property, which is unspecified and which
67
+ * anything patching `AsyncLocalStorage` can break — and the failure would be
68
+ * silent and in the dangerous direction.
69
+ *
70
+ * Memoized: the answer is fixed for the life of the thread.
71
+ */
72
+ function isAsyncContextFrameActive() {
73
+ if (active === undefined) {
74
+ const probe = new node_async_hooks_1.AsyncLocalStorage();
75
+ // Object identity, so a stray equal-valued binding can't answer for us.
76
+ const sentinel = {};
77
+ let bound = false;
78
+ probe.run(sentinel, () => {
79
+ bound = bindings().cpedMapContains(probe, sentinel);
80
+ });
81
+ probe.disable();
82
+ active = bound;
83
+ }
84
+ return active;
85
+ }
86
+ /**
87
+ * How to turn AsyncContextFrame on, for the error message of whatever declined
88
+ * to run without it.
89
+ *
90
+ * Advisory text only — never decide availability from this. That is what
91
+ * {@link isAsyncContextFrameActive} is for.
92
+ */
93
+ function asyncContextFrameHint() {
94
+ const version = process.versions.node;
95
+ const [major, minor] = version.split('.').map(Number);
96
+ // Hand-rolled rather than semver.satisfies: semver is a devDependency, and
97
+ // this module ships.
98
+ if (major < 22 || (major === 22 && minor < 7)) {
99
+ return `Node ${version} does not support it at all; Node 24 and later enable it by default`;
100
+ }
101
+ if (major < 24) {
102
+ return `Node ${version} needs --experimental-async-context-frame, on the command line or in NODE_OPTIONS; Node 24 and later enable it by default`;
103
+ }
104
+ return `Node ${version} enables it by default, so something turned it off — look for --no-async-context-frame on the command line, in NODE_OPTIONS, or in this worker's execArgv`;
105
+ }
106
+ //# sourceMappingURL=async-context-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-context-frame.js","sourceRoot":"","sources":["../../ts/src/async-context-frame.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AA8DH,8DAaC;AASD,sDAYC;AA9FD,uDAAmD;AACnD,+BAA0B;AAM1B,IAAI,KAAwB,CAAC;AAE7B,4EAA4E;AAC5E,+EAA+E;AAC/E,SAAS,QAAQ;IACf,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC9C,KAAK,GAAG,WAAW,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAU,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,IAAI,MAA2B,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,yBAAyB;IACvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,oCAAiB,EAAU,CAAC;QAC9C,wEAAwE;QACxE,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,IAAI,KAAK,GAAG,KAAK,CAAC;QAClB,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE;YACvB,KAAK,GAAG,QAAQ,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,2EAA2E;IAC3E,qBAAqB;IACrB,IAAI,KAAK,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,OAAO,qEAAqE,CAAC;IAC9F,CAAC;IACD,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QACf,OAAO,QAAQ,OAAO,2HAA2H,CAAC;IACpJ,CAAC;IACD,OAAO,QAAQ,OAAO,2JAA2J,CAAC;AACpL,CAAC"}
@@ -19,4 +19,4 @@ export declare function stopSamplingHeapProfiler(): void;
19
19
  export declare function getAllocationProfile(): AllocationProfileNode | AllocationProfileNodeWithStats;
20
20
  export declare function mapAllocationProfile<T>(callback: (root: AllocationProfileNode) => T): T;
21
21
  export type NearHeapLimitCallback = (profile: AllocationProfileNode) => void;
22
- export declare function monitorOutOfMemory(heapLimitExtensionSize: number, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand: Array<string> | undefined, callback: NearHeapLimitCallback | undefined, callbackMode: number, isMainThread: boolean): void;
22
+ export declare function monitorOutOfMemory(heapLimitExtensionSize: number, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand: Array<string> | undefined, callback: NearHeapLimitCallback | undefined, callbackMode: number, isMainThread: boolean, automaticHeapLimitExtension: boolean): void;
@@ -69,7 +69,7 @@ function getAllocationProfile() {
69
69
  function mapAllocationProfile(callback) {
70
70
  return profiler.heapProfiler.mapAllocationProfile(callback);
71
71
  }
72
- function monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode, isMainThread) {
73
- profiler.heapProfiler.monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode, isMainThread);
72
+ function monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode, isMainThread, automaticHeapLimitExtension) {
73
+ profiler.heapProfiler.monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode, isMainThread, automaticHeapLimitExtension);
74
74
  }
75
75
  //# sourceMappingURL=heap-profiler-bindings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"heap-profiler-bindings.js","sourceRoot":"","sources":["../../ts/src/heap-profiler-bindings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,8DAUC;AAED,4DAEC;AAED,oDAIC;AAED,oDAIC;AAID,gDAkBC;AA5DD,2CAA6B;AAO7B,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE/D,kDAAkD;AAElD,SAAgB,yBAAyB,CACvC,iBAAyB,EACzB,cAAsB,EACtB,WAAW,GAAG,KAAK;IAEnB,QAAQ,CAAC,YAAY,CAAC,yBAAyB,CAC7C,iBAAiB,EACjB,cAAc,EACd,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB;IACtC,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,CAAC;AACnD,CAAC;AAED,SAAgB,oBAAoB;IAGlC,OAAO,QAAQ,CAAC,YAAY,CAAC,oBAAoB,EAAE,CAAC;AACtD,CAAC;AAED,SAAgB,oBAAoB,CAClC,QAA4C;IAE5C,OAAO,QAAQ,CAAC,YAAY,CAAC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B,CAChC,sBAA8B,EAC9B,0BAAkC,EAClC,uBAAgC,EAChC,aAAwC,EACxC,QAA2C,EAC3C,YAAoB,EACpB,YAAqB,EACrB,2BAAoC;IAEpC,QAAQ,CAAC,YAAY,CAAC,kBAAkB,CACtC,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,2BAA2B,CAC5B,CAAC;AACJ,CAAC"}
@@ -68,25 +68,38 @@ export declare const CallbackMode: {
68
68
  Interrupt: number;
69
69
  Both: number;
70
70
  };
71
+ /**
72
+ * How much the heap limit is raised when v8 signals it is near the limit.
73
+ *
74
+ * A number is an exact byte count, and 0 means "grant no extension and let v8
75
+ * run its normal OOM handling". `'auto'` instead sizes the extension to one
76
+ * maximum young generation - the same budget Node.js grants its own near-OOM
77
+ * heap snapshot callback - which is what v8 actually needs to finish one more
78
+ * GC while the profile is captured.
79
+ */
80
+ export type HeapLimitExtensionSize = number | 'auto';
71
81
  /**
72
82
  * Add monitoring for v8 heap, heap profiler must already be started.
73
83
  * When an out of heap memory event occurs:
74
- * - an extension of heap memory of |heapLimitExtensionSize| bytes is
75
- * requested to v8. This extension can occur |maxHeapLimitExtensionCount|
76
- * number of times. If the extension amount is not enough to satisfy
77
- * memory allocation that triggers GC and OOM, process will abort.
84
+ * - the heap limit is extended by |heapLimitExtensionSize| so a profile can
85
+ * be captured before the process dies. If the extension amount is not
86
+ * enough to satisfy the memory allocation that triggers GC and OOM, the
87
+ * process will abort, so prefer 'auto' over a hand-picked constant. This
88
+ * top-level extension can occur |maxHeapLimitExtensionCount| times.
89
+ * Reentrant rescue extensions used to finish an in-progress capture are
90
+ * additional and are not included in that count.
78
91
  * - heap profile is dumped as folded stacks on stderr if
79
92
  * |dumpHeapProfileOnSdterr| is true
80
93
  * - heap profile is dumped in temporary file and a new process is spawned
81
94
  * with |exportCommand| arguments and profile path appended at the end.
82
- * - |callback| is called. Callback can be invoked only if
83
- * heapLimitExtensionSize is enough for the process to continue. Invocation
84
- * will be done by a RequestInterrupt if |callbackMode| is Interrupt or Both,
85
- * this might be unsafe since Isolate should not be reentered
86
- * from RequestInterrupt, but this allows to interrupt synchronous code.
87
- * Otherwise the callback is scheduled to be called asynchronously.
95
+ * - |callback| is called. Callback can be invoked only if the extension is
96
+ * enough for the process to continue. Invocation will be done by a
97
+ * RequestInterrupt if |callbackMode| is Interrupt or Both, this might be
98
+ * unsafe since Isolate should not be reentered from RequestInterrupt, but
99
+ * this allows to interrupt synchronous code. Otherwise the callback is
100
+ * scheduled to be called asynchronously.
88
101
  * @param heapLimitExtensionSize - amount of bytes heap should be expanded
89
- * with upon OOM
102
+ * with upon OOM, or 'auto' to size it to one maximum young generation
90
103
  * @param maxHeapLimitExtensionCount - maximum number of times heap size
91
104
  * extension can occur
92
105
  * @param dumpHeapProfileOnSdterr - dump heap profile on stderr upon OOM
@@ -95,4 +108,4 @@ export declare const CallbackMode: {
95
108
  * @param callback - callback to call when OOM occurs
96
109
  * @param callbackMode
97
110
  */
98
- export declare function monitorOutOfMemory(heapLimitExtensionSize: number, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand?: Array<string>, callback?: NearHeapLimitCallback, callbackMode?: number): void;
111
+ export declare function monitorOutOfMemory(heapLimitExtensionSize: HeapLimitExtensionSize, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand?: Array<string>, callback?: NearHeapLimitCallback, callbackMode?: number): void;
@@ -180,22 +180,25 @@ exports.CallbackMode = {
180
180
  /**
181
181
  * Add monitoring for v8 heap, heap profiler must already be started.
182
182
  * When an out of heap memory event occurs:
183
- * - an extension of heap memory of |heapLimitExtensionSize| bytes is
184
- * requested to v8. This extension can occur |maxHeapLimitExtensionCount|
185
- * number of times. If the extension amount is not enough to satisfy
186
- * memory allocation that triggers GC and OOM, process will abort.
183
+ * - the heap limit is extended by |heapLimitExtensionSize| so a profile can
184
+ * be captured before the process dies. If the extension amount is not
185
+ * enough to satisfy the memory allocation that triggers GC and OOM, the
186
+ * process will abort, so prefer 'auto' over a hand-picked constant. This
187
+ * top-level extension can occur |maxHeapLimitExtensionCount| times.
188
+ * Reentrant rescue extensions used to finish an in-progress capture are
189
+ * additional and are not included in that count.
187
190
  * - heap profile is dumped as folded stacks on stderr if
188
191
  * |dumpHeapProfileOnSdterr| is true
189
192
  * - heap profile is dumped in temporary file and a new process is spawned
190
193
  * with |exportCommand| arguments and profile path appended at the end.
191
- * - |callback| is called. Callback can be invoked only if
192
- * heapLimitExtensionSize is enough for the process to continue. Invocation
193
- * will be done by a RequestInterrupt if |callbackMode| is Interrupt or Both,
194
- * this might be unsafe since Isolate should not be reentered
195
- * from RequestInterrupt, but this allows to interrupt synchronous code.
196
- * Otherwise the callback is scheduled to be called asynchronously.
194
+ * - |callback| is called. Callback can be invoked only if the extension is
195
+ * enough for the process to continue. Invocation will be done by a
196
+ * RequestInterrupt if |callbackMode| is Interrupt or Both, this might be
197
+ * unsafe since Isolate should not be reentered from RequestInterrupt, but
198
+ * this allows to interrupt synchronous code. Otherwise the callback is
199
+ * scheduled to be called asynchronously.
197
200
  * @param heapLimitExtensionSize - amount of bytes heap should be expanded
198
- * with upon OOM
201
+ * with upon OOM, or 'auto' to size it to one maximum young generation
199
202
  * @param maxHeapLimitExtensionCount - maximum number of times heap size
200
203
  * extension can occur
201
204
  * @param dumpHeapProfileOnSdterr - dump heap profile on stderr upon OOM
@@ -214,6 +217,7 @@ function monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount,
214
217
  callback(convertProfile(profile));
215
218
  };
216
219
  }
217
- (0, heap_profiler_bindings_1.monitorOutOfMemory)(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand || [], newCallback, typeof callbackMode !== 'undefined' ? callbackMode : exports.CallbackMode.Async, worker_threads_1.isMainThread);
220
+ const automatic = heapLimitExtensionSize === 'auto';
221
+ (0, heap_profiler_bindings_1.monitorOutOfMemory)(automatic ? 0 : heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand || [], newCallback, typeof callbackMode !== 'undefined' ? callbackMode : exports.CallbackMode.Async, worker_threads_1.isMainThread, automatic);
218
222
  }
219
223
  //# sourceMappingURL=heap-profiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"heap-profiler.js","sourceRoot":"","sources":["../../ts/src/heap-profiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAmCH,8BAOC;AAaD,kCAUC;AASD,0BAuBC;AAED,wCA0DC;AAUD,8BAeC;AAcD,sBAeC;AAGD,oBAMC;AAqCD,gDA4BC;AAzRD,qEAMkC;AAClC,6DAI8B;AAO9B,mDAA4C;AAE5C,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAC1B,IAAI,cAAc,GAAG,CAAC,CAAC;AACvB,IAAI,sBAAsB,GAAG,KAAK,CAAC;AAEnC;;;;;GAKG;AACH,SAAgB,SAAS;IAGvB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,IAAA,6CAAoB,GAAE,CAAC;AAChC,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,WAAW,CACzB,QAA4C;IAE5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,IAAI,sBAAsB,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAA,6CAAoB,EAAC,QAAQ,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CACrB,gBAAyB,EACzB,YAA2B,EAC3B,cAAiD,EACjD,gBAA+B,2CAAsB;IAErD,MA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6B,EAC7B,QAAgC,EAChC,YAAqB;IAErB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAC;IACJ,CAAC;IACD,IAAI,WAAW,CAAC;IAChB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,WAAW,GAAG,CAAC,OAA8B,EAAE,EAAE;YAC/C,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QACpC,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,sBAAsB,KAAK,MAAM,CAAC;IACpD,IAAA,2CAA0B,EACxB,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,EACtC,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,IAAI,EAAE,EACnB,WAAW,EACX,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAY,CAAC,KAAK,EACvE,6BAAY,EACZ,SAAS,CACV,CAAC;AACJ,CAAC"}
@@ -2,6 +2,7 @@ import * as heapProfiler from './heap-profiler';
2
2
  import * as otelThreadCtxModule from './otel-thread-ctx';
3
3
  import * as timeProfiler from './time-profiler';
4
4
  export { AllocationProfileNode, TimeProfileNode, ProfileNode, LabelSet, } from './v8-types';
5
+ export { HeapLimitExtensionSize } from './heap-profiler';
5
6
  export { encode, encodeSync } from './profile-encoder';
6
7
  export { SourceMapper } from './sourcemapper/sourcemapper';
7
8
  export { setLogger } from './logger';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,2BAAiC;AAEjC,8DAAgD;AAChD,uEAAyD;AACzD,uDAA6C;AAC7C,8DAAgD;AAQhD,qDAAqD;AAA7C,yGAAA,MAAM,OAAA;AAAE,6G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only 'threadlocal.schema_version': 'nodejs_v1_dev';
8
8
  readonly 'threadlocal.attribute_key_map': readonly string[];
9
- readonly 'threadlocal.wrapped_object_offset': number;
9
+ readonly 'threadlocal.js_object_record_offset': number;
10
10
  readonly 'threadlocal.tagged_size': number;
11
- readonly 'threadlocal.native_wrap_fields_offset': number;
12
11
  readonly 'threadlocal.js_map_table_offset': number;
13
12
  readonly 'threadlocal.ordered_hash_map_header_size': number;
14
13
  }
@@ -20,9 +19,9 @@ export interface ProcessContextAttributes {
20
19
  *
21
20
  * `appendAttributes` mutates the context's record in place. Because every
22
21
  * async-context frame that holds the same `ThreadContext` reference observes
23
- * the same native record buffer, an append is visible across all those
24
- * frames even when the reallocate path runs (the context's internal
25
- * pointer is updated, the JS object is not replaced).
22
+ * the same native record, an append is visible across all those frames even
23
+ * when the reallocate path runs (the record is re-published on the same JS
24
+ * object, which is never replaced).
26
25
  */
27
26
  export interface ThreadContext {
28
27
  appendAttributes(attributes: Array<string | null | undefined> | undefined): void;
@@ -38,6 +37,19 @@ export interface ThreadContext {
38
37
  * the finished span's trace / span IDs. Idempotent.
39
38
  */
40
39
  invalidate(): void;
40
+ /**
41
+ * Overwrite this context's W3C trace-flags byte in place, for the case
42
+ * where the flags are not yet known when the context is built — an SDK
43
+ * whose sampling decision is deferred learns the sampled bit later, and a
44
+ * decision already taken can still be overridden. Like {@link invalidate},
45
+ * the write is seen at once by every async-context frame holding this
46
+ * context, because they all share one record.
47
+ *
48
+ * Must be an integer in 0..255. Bits beyond those W3C currently defines are
49
+ * stored as given rather than masked off, since W3C requires unknown flag
50
+ * bits to be propagated.
51
+ */
52
+ setTraceFlags(traceFlags: number): void;
41
53
  isTruncated(): boolean;
42
54
  /** Debug-only: returns the on-the-wire record bytes. Not stable. */
43
55
  debugBytes(): Uint8Array;
@@ -66,7 +78,7 @@ export interface ThreadContext {
66
78
  * contract is ELF-TLSDESC, only meaningful on Linux.
67
79
  */
68
80
  export interface ThreadContextCtor {
69
- new (traceId: Uint8Array, spanId: Uint8Array, attributes?: Array<string | null | undefined>): ThreadContext;
81
+ new (traceId: Uint8Array, spanId: Uint8Array, traceFlags?: number, attributes?: Array<string | null | undefined>): ThreadContext;
70
82
  readonly prototype: ThreadContext;
71
83
  }
72
84
  /** {@inheritDoc ThreadContextCtor} */
@@ -22,6 +22,11 @@ exports.getProcessContextAttributes = getProcessContextAttributes;
22
22
  // as a near-verbatim copy: edits should ideally land upstream first and
23
23
  // be ported here, so the two stay in sync. We plan to drop this vendored
24
24
  // copy once the upstream package is suitable to depend on directly.
25
+ //
26
+ // Known divergence from upstream: AsyncContextFrame availability is
27
+ // feature-detected via ./async-context-frame instead of being inferred from
28
+ // `process.execArgv`, which is wrong in both directions — see that module. Keep
29
+ // the divergence across re-syncs until upstream does the same.
25
30
  // Node.js writer for the OpenTelemetry Thread Local Context Record
26
31
  // (OTEP-4947), discoverable from an out-of-process reader via the
27
32
  // `otel_thread_ctx_nodejs_v1` thread-local symbol exported by
@@ -30,15 +35,15 @@ exports.getProcessContextAttributes = getProcessContextAttributes;
30
35
  // Linux only; on other platforms the exported functions degrade to no-ops.
31
36
  const path_1 = require("path");
32
37
  const node_async_hooks_1 = require("node:async_hooks");
38
+ const async_context_frame_1 = require("./async-context-frame");
33
39
  const SCHEMA_VERSION = 'nodejs_v1_dev';
34
40
  // V8 layout constants the addon captured from the V8 headers Node bundles.
35
41
  // On non-Linux these fall back to values matching Node's standard build
36
42
  // (no V8 pointer compression, no sandbox); the reader is Linux-only per
37
43
  // the OTEP anyway, so the fallbacks just keep processContextAttributes
38
44
  // consistent in shape.
39
- let WRAPPED_OBJECT_OFFSET = 24;
45
+ let JS_OBJECT_RECORD_OFFSET = 0x18;
40
46
  let TAGGED_SIZE = 8;
41
- let NATIVE_WRAP_FIELDS_OFFSET = 0;
42
47
  let JS_MAP_TABLE_OFFSET = 0x18;
43
48
  let ORDERED_HASH_MAP_HEADER_SIZE = 0x10;
44
49
  // Debug accessor (not part of the stable API; for tests / reader dev).
@@ -48,34 +53,18 @@ if (process.platform === 'linux') {
48
53
  // eslint-disable-next-line @typescript-eslint/no-require-imports
49
54
  const findBinding = require('node-gyp-build');
50
55
  const addon = findBinding((0, path_1.join)(__dirname, '..', '..'));
51
- WRAPPED_OBJECT_OFFSET = addon.otelThreadCtxWrappedObjectOffset;
56
+ JS_OBJECT_RECORD_OFFSET = addon.otelThreadCtxJsObjectRecordOffset;
52
57
  TAGGED_SIZE = addon.otelThreadCtxTaggedSize;
53
- NATIVE_WRAP_FIELDS_OFFSET = addon.otelThreadCtxNativeWrapFieldsOffset;
54
58
  JS_MAP_TABLE_OFFSET = addon.otelThreadCtxJsMapTableOffset;
55
59
  ORDERED_HASH_MAP_HEADER_SIZE = addon.otelThreadCtxOrderedHashMapHeaderSize;
56
60
  exports.ThreadContext = addon.threadContext;
57
61
  let als;
58
- function asyncContextFrameError() {
59
- const [major] = process.versions.node.split('.').map(Number);
60
- if (process.execArgv.includes('--no-async-context-frame')) {
61
- return 'Node explicitly launched with --no-async-context-frame';
62
- }
63
- if (major >= 24)
64
- return undefined;
65
- if (process.execArgv.includes('--experimental-async-context-frame')) {
66
- return undefined;
67
- }
68
- if (major >= 22) {
69
- return 'Node versions prior to v24 must be launched with --experimental-async-context-frame';
70
- }
71
- return 'Node major versions prior to v22 do not support the feature at all';
72
- }
73
62
  function ensureHook() {
74
63
  if (als)
75
64
  return als;
76
- const err = asyncContextFrameError();
77
- if (err) {
78
- throw new Error(`otel thread-ctx writer requires async_context_frame support, which is unavailable: ${err}.`);
65
+ if (!(0, async_context_frame_1.isAsyncContextFrameActive)()) {
66
+ throw new Error('otel thread-ctx writer requires async_context_frame support, which is ' +
67
+ `unavailable: ${(0, async_context_frame_1.asyncContextFrameHint)()}.`);
79
68
  }
80
69
  als = new node_async_hooks_1.AsyncLocalStorage();
81
70
  addon.otelThreadCtxStoreAls(als);
@@ -118,6 +107,7 @@ else {
118
107
  class NoopThreadContext {
119
108
  appendAttributes() { }
120
109
  invalidate() { }
110
+ setTraceFlags() { }
121
111
  isTruncated() {
122
112
  return false;
123
113
  }
@@ -167,9 +157,8 @@ function getProcessContextAttributes(keys) {
167
157
  return Object.freeze({
168
158
  'threadlocal.schema_version': SCHEMA_VERSION,
169
159
  'threadlocal.attribute_key_map': Object.freeze(keys.slice()),
170
- 'threadlocal.wrapped_object_offset': WRAPPED_OBJECT_OFFSET,
160
+ 'threadlocal.js_object_record_offset': JS_OBJECT_RECORD_OFFSET,
171
161
  'threadlocal.tagged_size': TAGGED_SIZE,
172
- 'threadlocal.native_wrap_fields_offset': NATIVE_WRAP_FIELDS_OFFSET,
173
162
  'threadlocal.js_map_table_offset': JS_MAP_TABLE_OFFSET,
174
163
  'threadlocal.ordered_hash_map_header_size': ORDERED_HASH_MAP_HEADER_SIZE,
175
164
  });
@@ -1 +1 @@
1
- {"version":3,"file":"otel-thread-ctx.js","sourceRoot":"","sources":["../../ts/src/otel-thread-ctx.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAgQH,kEA6BC;AA3RD,2FAA2F;AAC3F,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AAEpE,mEAAmE;AACnE,kEAAkE;AAClE,8DAA8D;AAC9D,mBAAmB;AACnB,EAAE;AACF,2EAA2E;AAE3E,+BAA0B;AAC1B,uDAAmD;AAiGnD,MAAM,cAAc,GAAG,eAAe,CAAC;AAEvC,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,uEAAuE;AACvE,uBAAuB;AACvB,IAAI,qBAAqB,GAAG,EAAE,CAAC;AAC/B,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,yBAAyB,GAAG,CAAC,CAAC;AAClC,IAAI,mBAAmB,GAAG,IAAI,CAAC;AAC/B,IAAI,4BAA4B,GAAG,IAAI,CAAC;AAkBxC,uEAAuE;AAChE,IAAI,mBAAmB,GAAiC,GAAG,EAAE,CAAC,SAAS,CAAC;AAApE,QAAA,mBA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EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,4BAA4B,EAAE,cAAc;QAC5C,+BAA+B,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5D,qCAAqC,EAAE,uBAAuB;QAC9D,yBAAyB,EAAE,WAAW;QACtC,iCAAiC,EAAE,mBAAmB;QACtD,0CAA0C,EAAE,4BAA4B;KACzE,CAA6B,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/pprof",
3
- "version": "5.18.0",
3
+ "version": "5.19.0",
4
4
  "description": "pprof support for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,17 +43,17 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/mocha": "^10.0.1",
46
- "@types/node": "26.1.2",
47
- "@types/semver": "^7.5.8",
46
+ "@types/node": "26.4.1",
47
+ "@types/semver": "^7.8.0",
48
48
  "@types/sinon": "^22.0.0",
49
49
  "@types/tmp": "^0.2.3",
50
50
  "clang-format": "^1.8.0",
51
51
  "codecov": "^3.8.3",
52
52
  "deep-copy": "^1.4.2",
53
- "eslint-plugin-n": "^18.2.2",
53
+ "eslint-plugin-n": "^18.3.0",
54
54
  "gts": "^7.0.0",
55
55
  "js-green-licenses": "^4.0.0",
56
- "mocha": "^11.7.6",
56
+ "mocha": "^11.8.0",
57
57
  "nan": "^2.28.0",
58
58
  "nyc": "^18.0.0",
59
59
  "semver": "^7.8.5",