@datadog/pprof 2.2.1 → 2.2.3

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 (47) hide show
  1. package/README.md +3 -3
  2. package/out/src/heap-profiler-bindings.d.ts +1 -1
  3. package/out/src/heap-profiler.d.ts +1 -1
  4. package/out/src/index.d.ts +1 -0
  5. package/out/src/index.js +3 -1
  6. package/out/src/index.js.map +1 -1
  7. package/out/src/logger.d.ts +18 -0
  8. package/out/src/logger.js +36 -0
  9. package/out/src/logger.js.map +1 -0
  10. package/out/src/sourcemapper/sourcemapper.d.ts +3 -2
  11. package/out/src/sourcemapper/sourcemapper.js +90 -48
  12. package/out/src/sourcemapper/sourcemapper.js.map +1 -1
  13. package/out/src/time-profiler.d.ts +2 -2
  14. package/package.json +16 -17
  15. package/prebuilds/darwin-arm64/node-102.node +0 -0
  16. package/prebuilds/darwin-arm64/node-108.node +0 -0
  17. package/prebuilds/darwin-arm64/node-111.node +0 -0
  18. package/prebuilds/darwin-arm64/node-115.node +0 -0
  19. package/prebuilds/darwin-arm64/node-72.node +0 -0
  20. package/prebuilds/darwin-arm64/node-79.node +0 -0
  21. package/prebuilds/darwin-arm64/node-83.node +0 -0
  22. package/prebuilds/darwin-arm64/node-88.node +0 -0
  23. package/prebuilds/darwin-arm64/node-93.node +0 -0
  24. package/prebuilds/darwin-x64/node-102.node +0 -0
  25. package/prebuilds/darwin-x64/node-108.node +0 -0
  26. package/prebuilds/darwin-x64/node-111.node +0 -0
  27. package/prebuilds/darwin-x64/node-115.node +0 -0
  28. package/prebuilds/darwin-x64/node-72.node +0 -0
  29. package/prebuilds/darwin-x64/node-79.node +0 -0
  30. package/prebuilds/darwin-x64/node-83.node +0 -0
  31. package/prebuilds/darwin-x64/node-88.node +0 -0
  32. package/prebuilds/darwin-x64/node-93.node +0 -0
  33. package/prebuilds/win32-ia32/node-102.node +0 -0
  34. package/prebuilds/win32-ia32/node-72.node +0 -0
  35. package/prebuilds/win32-ia32/node-79.node +0 -0
  36. package/prebuilds/win32-ia32/node-83.node +0 -0
  37. package/prebuilds/win32-ia32/node-88.node +0 -0
  38. package/prebuilds/win32-ia32/node-93.node +0 -0
  39. package/prebuilds/win32-x64/node-102.node +0 -0
  40. package/prebuilds/win32-x64/node-108.node +0 -0
  41. package/prebuilds/win32-x64/node-111.node +0 -0
  42. package/prebuilds/win32-x64/node-115.node +0 -0
  43. package/prebuilds/win32-x64/node-72.node +0 -0
  44. package/prebuilds/win32-x64/node-79.node +0 -0
  45. package/prebuilds/win32-x64/node-83.node +0 -0
  46. package/prebuilds/win32-x64/node-88.node +0 -0
  47. package/prebuilds/win32-x64/node-93.node +0 -0
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # pprof support for Node.js
2
2
 
3
3
  [![NPM Version][npm-image]][npm-url]
4
- [![Build Status][circle-image]][circle-url]
4
+ [![Build Status][build-image]][build-url]
5
5
  [![Known Vulnerabilities][snyk-image]][snyk-url]
6
6
 
7
7
  [pprof][pprof-url] support for Node.js.
@@ -108,8 +108,8 @@ Install [`pprof`][npm-url] with `npm` or add to your `package.json`.
108
108
  const profile = await pprof.heap.v8Profile();
109
109
  ```
110
110
 
111
- [circle-image]: https://circleci.com/gh/google/pprof-nodejs.svg?style=svg
112
- [circle-url]: https://circleci.com/gh/google/pprof-nodejs
111
+ [build-image]: https://github.com/Datadog/pprof-nodejs/actions/workflows/build.yml/badge.svg?branch=main
112
+ [build-url]: https://github.com/Datadog/pprof-nodejs/actions/workflows/build.yml
113
113
  [coveralls-image]: https://coveralls.io/repos/google/pprof-nodejs/badge.svg?branch=main&service=github
114
114
  [npm-image]: https://badge.fury.io/js/pprof.svg
115
115
  [npm-url]: https://npmjs.org/package/pprof
@@ -17,5 +17,5 @@ import { AllocationProfileNode } from './v8-types';
17
17
  export declare function startSamplingHeapProfiler(heapIntervalBytes: number, heapStackDepth: number): void;
18
18
  export declare function stopSamplingHeapProfiler(): void;
19
19
  export declare function getAllocationProfile(): AllocationProfileNode;
20
- export declare type NearHeapLimitCallback = (profile: AllocationProfileNode) => void;
20
+ export type NearHeapLimitCallback = (profile: AllocationProfileNode) => void;
21
21
  export declare function monitorOutOfMemory(heapLimitExtensionSize: number, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand: Array<String> | undefined, callback: NearHeapLimitCallback | undefined, callbackMode: number): void;
@@ -36,7 +36,7 @@ export declare function convertProfile(rootNode: AllocationProfileNode, ignoreSa
36
36
  */
37
37
  export declare function start(intervalBytes: number, stackDepth: number): void;
38
38
  export declare function stop(): void;
39
- export declare type NearHeapLimitCallback = (profile: Profile) => void;
39
+ export type NearHeapLimitCallback = (profile: Profile) => void;
40
40
  export declare const CallbackMode: {
41
41
  Async: number;
42
42
  Interrupt: number;
@@ -4,6 +4,7 @@ import * as timeProfiler from './time-profiler';
4
4
  export { AllocationProfileNode, TimeProfileNode, ProfileNode } from './v8-types';
5
5
  export { encode, encodeSync } from './profile-encoder';
6
6
  export { SourceMapper } from './sourcemapper/sourcemapper';
7
+ export { setLogger } from './logger';
7
8
  export declare const CpuProfiler: typeof cpuProfiler;
8
9
  export declare const time: {
9
10
  profile: typeof timeProfiler.profile;
package/out/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.heap = exports.time = exports.CpuProfiler = exports.SourceMapper = exports.encodeSync = exports.encode = void 0;
3
+ exports.heap = exports.time = exports.CpuProfiler = exports.setLogger = exports.SourceMapper = exports.encodeSync = exports.encode = void 0;
4
4
  /**
5
5
  * Copyright 2019 Google Inc. All Rights Reserved.
6
6
  *
@@ -26,6 +26,8 @@ Object.defineProperty(exports, "encode", { enumerable: true, get: function () {
26
26
  Object.defineProperty(exports, "encodeSync", { enumerable: true, get: function () { return profile_encoder_2.encodeSync; } });
27
27
  var sourcemapper_1 = require("./sourcemapper/sourcemapper");
28
28
  Object.defineProperty(exports, "SourceMapper", { enumerable: true, get: function () { return sourcemapper_1.SourceMapper; } });
29
+ var logger_1 = require("./logger");
30
+ Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return logger_1.setLogger; } });
29
31
  exports.CpuProfiler = cpu_profiler_1.default;
30
32
  exports.time = {
31
33
  profile: timeProfiler.profile,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,2BAAiC;AAEjC,iDAAyC;AACzC,gDAAgD;AAChD,uDAA6C;AAC7C,gDAAgD;AAGhD,qDAAqD;AAA7C,yGAAA,MAAM,OAAA;AAAE,6GAAA,UAAU,OAAA;AAC1B,4DAAyD;AAAjD,4GAAA,YAAY,OAAA;AAEP,QAAA,WAAW,GAAG,sBAAW,CAAC;AAE1B,QAAA,IAAI,GAAG;IAClB,OAAO,EAAE,YAAY,CAAC,OAAO;IAC7B,KAAK,EAAE,YAAY,CAAC,KAAK;CAC1B,CAAC;AAEW,QAAA,IAAI,GAAG;IAClB,KAAK,EAAE,YAAY,CAAC,KAAK;IACzB,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,OAAO,EAAE,YAAY,CAAC,OAAO;IAC7B,cAAc,EAAE,YAAY,CAAC,cAAc;IAC3C,SAAS,EAAE,YAAY,CAAC,SAAS;IACjC,kBAAkB,EAAE,YAAY,CAAC,kBAAkB;IACnD,YAAY,EAAE,YAAY,CAAC,YAAY;CACxC,CAAC;AAEF,6CAA6C;AAC7C,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,kBAAkB,EAAE;IAC5D,MAAM,IAAI,GAAG,YAAI,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACtB,uEAAuE;QACvE,kBAAkB;QAClB,MAAM,OAAO,GAAG,IAAI,EAAE,CAAC;QACvB,MAAM,MAAM,GA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IAAA,4BAAU,EAAC,OAAO,CAAC,CAAC;QACnC,IAAA,kBAAa,EAAC,iBAAiB,OAAO,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;CACJ"}
@@ -0,0 +1,18 @@
1
+ export interface Logger {
2
+ error(...args: Array<{}>): void;
3
+ trace(...args: Array<{}>): void;
4
+ debug(...args: Array<{}>): void;
5
+ info(...args: Array<{}>): void;
6
+ warn(...args: Array<{}>): void;
7
+ fatal(...args: Array<{}>): void;
8
+ }
9
+ export declare class NullLogger implements Logger {
10
+ info(...args: Array<{}>): void;
11
+ error(...args: Array<{}>): void;
12
+ trace(...args: Array<{}>): void;
13
+ warn(...args: Array<{}>): void;
14
+ fatal(...args: Array<{}>): void;
15
+ debug(...args: Array<{}>): void;
16
+ }
17
+ export declare let logger: NullLogger;
18
+ export declare function setLogger(newLogger: Logger): void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setLogger = exports.logger = exports.NullLogger = void 0;
4
+ class NullLogger {
5
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
+ info(...args) {
7
+ return;
8
+ }
9
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
+ error(...args) {
11
+ return;
12
+ }
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ trace(...args) {
15
+ return;
16
+ }
17
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
+ warn(...args) {
19
+ return;
20
+ }
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ fatal(...args) {
23
+ return;
24
+ }
25
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
+ debug(...args) {
27
+ return;
28
+ }
29
+ }
30
+ exports.NullLogger = NullLogger;
31
+ exports.logger = new NullLogger();
32
+ function setLogger(newLogger) {
33
+ exports.logger = newLogger;
34
+ }
35
+ exports.setLogger = setLogger;
36
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../ts/src/logger.ts"],"names":[],"mappings":";;;AASA,MAAa,UAAU;IACrB,6DAA6D;IAC7D,IAAI,CAAC,GAAG,IAAe;QACrB,OAAO;IACT,CAAC;IACD,6DAA6D;IAC7D,KAAK,CAAC,GAAG,IAAe;QACtB,OAAO;IACT,CAAC;IACD,6DAA6D;IAC7D,KAAK,CAAC,GAAG,IAAe;QACtB,OAAO;IACT,CAAC;IACD,6DAA6D;IAC7D,IAAI,CAAC,GAAG,IAAe;QACrB,OAAO;IACT,CAAC;IACD,6DAA6D;IAC7D,KAAK,CAAC,GAAG,IAAe;QACtB,OAAO;IACT,CAAC;IACD,6DAA6D;IAC7D,KAAK,CAAC,GAAG,IAAe;QACtB,OAAO;IACT,CAAC;CACF;AAzBD,gCAyBC;AAEU,QAAA,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;AAErC,SAAgB,SAAS,CAAC,SAAiB;IACzC,cAAM,GAAG,SAAS,CAAC;AACrB,CAAC;AAFD,8BAEC"}
@@ -32,7 +32,8 @@ export interface SourceLocation {
32
32
  }
33
33
  export declare class SourceMapper {
34
34
  infoMap: Map<string, MapInfoCompiled>;
35
- static create(searchDirs: string[]): Promise<SourceMapper>;
35
+ debug: boolean;
36
+ static create(searchDirs: string[], debug?: boolean): Promise<SourceMapper>;
36
37
  /**
37
38
  * @param {Array.<string>} sourceMapPaths An array of paths to .map source map
38
39
  * files that should be processed. The paths should be relative to the
@@ -41,7 +42,7 @@ export declare class SourceMapper {
41
42
  * processing the given source map files
42
43
  * @constructor
43
44
  */
44
- constructor();
45
+ constructor(debug?: boolean);
45
46
  /**
46
47
  * Used to get the information about the transpiled file from a given input
47
48
  * source file provided there isn't any ambiguity with associating the input
@@ -22,22 +22,17 @@ exports.SourceMapper = void 0;
22
22
  // code to generated code.
23
23
  const fs = require("fs");
24
24
  const path = require("path");
25
- // Apparently the source-map module feature-detects the browser by checking
26
- // if the fetch function exists. Because it now exists in Node.js v18, the
27
- // source-map module thinks it's running in a browser and doesn't work.
28
- const desc = Object.getOwnPropertyDescriptor(globalThis, 'fetch');
29
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
30
- // @ts-ignore
31
- delete globalThis.fetch;
32
25
  const sourceMap = require("source-map");
33
- if (desc) {
34
- Object.defineProperty(globalThis, 'fetch', desc);
35
- }
26
+ const logger_1 = require("../logger");
36
27
  const pify = require('pify');
37
28
  const pLimit = require('p-limit');
38
29
  const readFile = pify(fs.readFile);
39
30
  const CONCURRENCY = 10;
40
31
  const MAP_EXT = '.map';
32
+ function error(msg) {
33
+ logger_1.logger.debug(`Error: ${msg}`);
34
+ return new Error(msg);
35
+ }
41
36
  /**
42
37
  * @param {!Map} infoMap The map that maps input source files to
43
38
  * SourceMapConsumer objects that are used to calculate mapping information
@@ -45,11 +40,11 @@ const MAP_EXT = '.map';
45
40
  * path should be relative to the process's current working directory
46
41
  * @private
47
42
  */
48
- async function processSourceMap(infoMap, mapPath) {
43
+ async function processSourceMap(infoMap, mapPath, debug) {
49
44
  // this handles the case when the path is undefined, null, or
50
45
  // the empty string
51
46
  if (!mapPath || !mapPath.endsWith(MAP_EXT)) {
52
- throw new Error(`The path "${mapPath}" does not specify a source map file`);
47
+ throw error(`The path "${mapPath}" does not specify a source map file`);
53
48
  }
54
49
  mapPath = path.normalize(mapPath);
55
50
  let contents;
@@ -57,7 +52,7 @@ async function processSourceMap(infoMap, mapPath) {
57
52
  contents = await readFile(mapPath, 'utf8');
58
53
  }
59
54
  catch (e) {
60
- throw new Error('Could not read source map file ' + mapPath + ': ' + e);
55
+ throw error('Could not read source map file ' + mapPath + ': ' + e);
61
56
  }
62
57
  let consumer;
63
58
  try {
@@ -70,38 +65,62 @@ async function processSourceMap(infoMap, mapPath) {
70
65
  consumer = (await new sourceMap.SourceMapConsumer(contents));
71
66
  }
72
67
  catch (e) {
73
- throw new Error('An error occurred while reading the ' +
68
+ throw error('An error occurred while reading the ' +
74
69
  'sourceMap file ' +
75
70
  mapPath +
76
71
  ': ' +
77
72
  e);
78
73
  }
79
- /*
80
- * If the source map file defines a "file" attribute, use it as
74
+ /* If the source map file defines a "file" attribute, use it as
81
75
  * the output file where the path is relative to the directory
82
76
  * containing the map file. Otherwise, use the name of the output
83
77
  * file (with the .map extension removed) as the output file.
78
+
79
+ * With nextjs/webpack, when there are subdirectories in `pages` directory,
80
+ * the generated source maps do not reference correctly the generated files
81
+ * in their `file` property.
82
+ * For example if the generated file / source maps have paths:
83
+ * <root>/pages/sub/foo.js(.map)
84
+ * foo.js.map will have ../pages/sub/foo.js as `file` property instead of
85
+ * ../../pages/sub/foo.js
86
+ * To workaround this, check first if file referenced in `file` property
87
+ * exists and if it does not, check if generated file exists alongside the
88
+ * source map file.
84
89
  */
85
90
  const dir = path.dirname(mapPath);
86
- const generatedBase = consumer.file
87
- ? consumer.file
88
- : path.basename(mapPath, MAP_EXT);
89
- const generatedPath = path.resolve(dir, generatedBase);
90
- infoMap.set(generatedPath, { mapFileDir: dir, mapConsumer: consumer });
91
+ const generatedPathCandidates = [];
92
+ if (consumer.file) {
93
+ generatedPathCandidates.push(path.resolve(dir, consumer.file));
94
+ }
95
+ const samePath = path.resolve(dir, path.basename(mapPath, MAP_EXT));
96
+ if (generatedPathCandidates.length === 0 ||
97
+ generatedPathCandidates[0] !== samePath) {
98
+ generatedPathCandidates.push(samePath);
99
+ }
100
+ for (const generatedPath of generatedPathCandidates) {
101
+ try {
102
+ await fs.promises.access(generatedPath, fs.constants.F_OK);
103
+ infoMap.set(generatedPath, { mapFileDir: dir, mapConsumer: consumer });
104
+ if (debug) {
105
+ logger_1.logger.debug(`Loaded source map for ${generatedPath} => ${mapPath}`);
106
+ }
107
+ return;
108
+ }
109
+ catch (err) {
110
+ if (debug) {
111
+ logger_1.logger.debug(`Generated path ${generatedPath} does not exist`);
112
+ }
113
+ }
114
+ }
115
+ if (debug) {
116
+ logger_1.logger.debug(`Unable to find generated file for ${mapPath}`);
117
+ }
91
118
  }
92
119
  class SourceMapper {
93
- /**
94
- * @param {Array.<string>} sourceMapPaths An array of paths to .map source map
95
- * files that should be processed. The paths should be relative to the
96
- * current process's current working directory
97
- * @param {Logger} logger A logger that reports errors that occurred while
98
- * processing the given source map files
99
- * @constructor
100
- */
101
- constructor() {
102
- this.infoMap = new Map();
103
- }
104
- static async create(searchDirs) {
120
+ static async create(searchDirs, debug = false) {
121
+ if (debug) {
122
+ logger_1.logger.debug(`Looking for source map files in dirs: [${searchDirs.join(', ')}]`);
123
+ }
105
124
  const mapFiles = [];
106
125
  for (const dir of searchDirs) {
107
126
  try {
@@ -111,10 +130,25 @@ class SourceMapper {
111
130
  });
112
131
  }
113
132
  catch (e) {
114
- throw new Error(`failed to get source maps from ${dir}: ${e}`);
133
+ throw error(`failed to get source maps from ${dir}: ${e}`);
115
134
  }
116
135
  }
117
- return createFromMapFiles(mapFiles);
136
+ if (debug) {
137
+ logger_1.logger.debug(`Found source map files: [${mapFiles.join(', ')}]`);
138
+ }
139
+ return createFromMapFiles(mapFiles, debug);
140
+ }
141
+ /**
142
+ * @param {Array.<string>} sourceMapPaths An array of paths to .map source map
143
+ * files that should be processed. The paths should be relative to the
144
+ * current process's current working directory
145
+ * @param {Logger} logger A logger that reports errors that occurred while
146
+ * processing the given source map files
147
+ * @constructor
148
+ */
149
+ constructor(debug = false) {
150
+ this.infoMap = new Map();
151
+ this.debug = debug;
118
152
  }
119
153
  /**
120
154
  * Used to get the information about the transpiled file from a given input
@@ -172,41 +206,46 @@ class SourceMapper {
172
206
  const inputPath = path.normalize(location.file);
173
207
  const entry = this.getMappingInfo(inputPath);
174
208
  if (entry === null) {
209
+ if (this.debug) {
210
+ logger_1.logger.debug(`Source map lookup failed: no map found for ${location.file} (normalized: ${inputPath})`);
211
+ }
175
212
  return location;
176
213
  }
177
214
  const generatedPos = {
178
215
  line: location.line,
179
- column: location.column,
180
- bias: sourceMap.SourceMapConsumer.LEAST_UPPER_BOUND,
216
+ column: location.column > 0 ? location.column - 1 : 0, // SourceMapConsumer expects column to be 0-based
181
217
  };
182
218
  // TODO: Determine how to remove the explicit cast here.
183
219
  const consumer = entry.mapConsumer;
184
- let pos = consumer.originalPositionFor(generatedPos);
185
- if (pos.source === null) {
186
- generatedPos.bias = sourceMap.SourceMapConsumer.GREATEST_LOWER_BOUND;
187
- pos = consumer.originalPositionFor(generatedPos);
188
- }
220
+ const pos = consumer.originalPositionFor(generatedPos);
189
221
  if (pos.source === null) {
222
+ if (this.debug) {
223
+ logger_1.logger.debug(`Source map lookup failed for ${location.name}(${location.file}:${location.line}:${location.column})`);
224
+ }
190
225
  return location;
191
226
  }
192
- return {
227
+ const loc = {
193
228
  file: path.resolve(entry.mapFileDir, pos.source),
194
229
  line: pos.line || undefined,
195
230
  name: pos.name || location.name,
196
- column: pos.column || undefined,
231
+ column: pos.column === null ? undefined : pos.column + 1, // convert column back to 1-based
197
232
  };
233
+ if (this.debug) {
234
+ logger_1.logger.debug(`Source map lookup succeeded for ${location.name}(${location.file}:${location.line}:${location.column}) => ${loc.name}(${loc.file}:${loc.line}:${loc.column})`);
235
+ }
236
+ return loc;
198
237
  }
199
238
  }
200
239
  exports.SourceMapper = SourceMapper;
201
- async function createFromMapFiles(mapFiles) {
240
+ async function createFromMapFiles(mapFiles, debug) {
202
241
  const limit = pLimit(CONCURRENCY);
203
- const mapper = new SourceMapper();
204
- const promises = mapFiles.map(mapPath => limit(() => processSourceMap(mapper.infoMap, mapPath)));
242
+ const mapper = new SourceMapper(debug);
243
+ const promises = mapFiles.map(mapPath => limit(() => processSourceMap(mapper.infoMap, mapPath, debug)));
205
244
  try {
206
245
  await Promise.all(promises);
207
246
  }
208
247
  catch (err) {
209
- throw new Error('An error occurred while processing the source map files' + err);
248
+ throw error('An error occurred while processing the source map files' + err);
210
249
  }
211
250
  return mapper;
212
251
  }
@@ -240,6 +279,9 @@ directoryFilter = (root, dirname) => true) {
240
279
  if (!isNonFatalError(error)) {
241
280
  throw error;
242
281
  }
282
+ else {
283
+ logger_1.logger.debug(() => `Non fatal error: ${error}`);
284
+ }
243
285
  }
244
286
  }
245
287
  yield* walkRecursive(dir);
@@ -1 +1 @@
1
- {"version":3,"file":"sourcemapper.js","sourceRoot":"","sources":["../../../ts/src/sourcemapper/sourcemapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,mEAAmE;AACnE,8HAA8H;AAC9H,8EAA8E;AAC9E,0BAA0B;AAE1B,yBAAyB;AACzB,6BAA6B;AAE7B,2EAA2E;AAC3E,0EAA0E;AAC1E,uEAAuE;AACvE,MAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAClE,6DAA6D;AAC7D,aAAa;AACb,OAAO,UAAU,CAAC,KAAK,CAAC;AACxB,wCAAwC;AACxC,IAAI,IAAI,EAAE;IACR,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;CAClD;AAED,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAEnC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,OAAO,GAAG,MAAM,CAAC;AAqBvB;;;;;;GAMG;AACH,KAAK,UAAU,gBAAgB,CAC7B,OAAqC,EACrC,OAAe;IAEf,6DAA6D;IAC7D,mBAAmB;IACnB,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC1C,MAAM,IAAI,KAAK,CAAC,aAAa,OAAO,sCAAsC,CAAC,CAAC;KAC7E;IACD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAElC,IAAI,QAAQ,CAAC;IACb,IAAI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,CAAC,SAAS,CAAC,EACxC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAChB,IAAI,KAAK,OAAO,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,cAAc,CACvE,EAAE;QACD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;KAC9C;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { SourceMapper } from './sourcemapper/sourcemapper';
17
- declare type Microseconds = number;
18
- declare type Milliseconds = number;
17
+ type Microseconds = number;
18
+ type Milliseconds = number;
19
19
  export interface TimeProfilerOptions {
20
20
  /** time in milliseconds for which to collect profile. */
21
21
  durationMillis: Milliseconds;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/pprof",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "pprof support for Node.js",
5
5
  "repository": "datadog/pprof-nodejs",
6
6
  "main": "out/src/index.js",
@@ -18,8 +18,8 @@
18
18
  "format": "clang-format --style file -i --glob='bindings/**/*.{h,hh,cpp,cc}'",
19
19
  "prebuild": "node scripts/prebuild.js",
20
20
  "prebuilds": "node scripts/prebuilds.js",
21
- "prepare": "npm run compile",
22
- "pretest": "npm run compile && npm run rebuild"
21
+ "prepare": "npm run compile && npm run rebuild",
22
+ "pretest": "npm run compile"
23
23
  },
24
24
  "author": {
25
25
  "name": "Google Inc."
@@ -30,46 +30,45 @@
30
30
  "node-gyp-build": "^3.9.0",
31
31
  "p-limit": "^3.1.0",
32
32
  "pify": "^5.0.0",
33
- "pprof-format": "^2.0.6",
33
+ "pprof-format": "^2.0.7",
34
34
  "source-map": "^0.7.3",
35
35
  "split": "^1.0.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/mocha": "^9.1.1",
39
- "@types/node": "^18.0.6",
39
+ "@types/node": "^18.16.16",
40
40
  "@types/p-limit": "^2.0.0",
41
41
  "@types/pify": "^5.0.0",
42
42
  "@types/pretty-ms": "^5.0.1",
43
43
  "@types/request": "^2.47.1",
44
- "@types/sinon": "^10.0.0",
44
+ "@types/sinon": "^10.0.15",
45
45
  "@types/tmp": "^0.2.3",
46
- "@typescript-eslint/eslint-plugin": "^5.38.0",
46
+ "@typescript-eslint/eslint-plugin": "^5.59.9",
47
47
  "axios": "^0.27.2",
48
48
  "checksum": "^1.0.0",
49
49
  "clang-format": "^1.8.0",
50
50
  "codecov": "^3.0.0",
51
51
  "deep-copy": "^1.4.2",
52
- "eslint-config-standard": "^17.0.0",
53
- "eslint-plugin-import": "^2.26.0",
54
- "eslint-plugin-n": "^15.2.0",
55
- "eslint-plugin-promise": "^6.0.0",
56
- "glob": "^8.0.3",
52
+ "eslint-config-standard": "^17.1.0",
53
+ "eslint-plugin-import": "^2.27.5",
54
+ "eslint-plugin-n": "^15.7.0",
55
+ "eslint-plugin-promise": "^6.1.1",
56
+ "glob": "^8.1.0",
57
57
  "gts": "^3.0.0",
58
58
  "js-green-licenses": "^4.0.0",
59
- "linkinator": "^4.0.2",
60
59
  "mkdirp": "^1.0.4",
61
60
  "mocha": "^9.2.2",
62
61
  "nan": "^2.17.0",
63
62
  "nyc": "^15.0.0",
64
63
  "protobufjs-cli": "^1.0.2",
65
64
  "rimraf": "^3.0.2",
66
- "semver": "^7.3.5",
67
- "sinon": "^14.0.0",
65
+ "semver": "^7.5.1",
66
+ "sinon": "^14.0.2",
68
67
  "source-map-support": "^0.5.12",
69
- "tar": "^6.1.0",
68
+ "tar": "^6.1.15",
70
69
  "tmp": "0.2.1",
71
70
  "ts-mockito": "^2.2.5",
72
- "typescript": "^4.7.4"
71
+ "typescript": "^4.9.5"
73
72
  },
74
73
  "files": [
75
74
  "out/src",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file