Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@datadog/pprof

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/pprof - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

2

out/src/heap-profiler-bindings.d.ts

@@ -20,3 +20,3 @@ /**

export declare function getAllocationProfile(): AllocationProfileNode;
export declare type NearHeapLimitCallback = (profile: AllocationProfileNode) => void;
export type NearHeapLimitCallback = (profile: AllocationProfileNode) => void;
export declare function monitorOutOfMemory(heapLimitExtensionSize: number, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand: Array<String> | undefined, callback: NearHeapLimitCallback | undefined, callbackMode: number): void;

@@ -39,3 +39,3 @@ /**

export declare function stop(): void;
export declare type NearHeapLimitCallback = (profile: Profile) => void;
export type NearHeapLimitCallback = (profile: Profile) => void;
export declare const CallbackMode: {

@@ -42,0 +42,0 @@ Async: number;

@@ -41,2 +41,11 @@ "use strict";

const MAP_EXT = '.map';
const debug = process.env.DD_PROFILING_DEBUG_SOURCE_MAPS
? (msg) => {
console.log(typeof msg === 'function' ? msg() : msg);
}
: () => { };
function error(msg) {
debug(`Error: ${msg}`);
return new Error(msg);
}
/**

@@ -53,3 +62,3 @@ * @param {!Map} infoMap The map that maps input source files to

if (!mapPath || !mapPath.endsWith(MAP_EXT)) {
throw new Error(`The path "${mapPath}" does not specify a source map file`);
throw error(`The path "${mapPath}" does not specify a source map file`);
}

@@ -62,3 +71,3 @@ mapPath = path.normalize(mapPath);

catch (e) {
throw new Error('Could not read source map file ' + mapPath + ': ' + e);
throw error('Could not read source map file ' + mapPath + ': ' + e);
}

@@ -76,3 +85,3 @@ let consumer;

catch (e) {
throw new Error('An error occurred while reading the ' +
throw error('An error occurred while reading the ' +
'sourceMap file ' +

@@ -95,16 +104,7 @@ mapPath +

infoMap.set(generatedPath, { mapFileDir: dir, mapConsumer: consumer });
debug(`Loaded source map for ${generatedPath} => ${mapPath}`);
}
class SourceMapper {
/**
* @param {Array.<string>} sourceMapPaths An array of paths to .map source map
* files that should be processed. The paths should be relative to the
* current process's current working directory
* @param {Logger} logger A logger that reports errors that occurred while
* processing the given source map files
* @constructor
*/
constructor() {
this.infoMap = new Map();
}
static async create(searchDirs) {
debug(() => `Looking for source map files in dirs: [${searchDirs.join(', ')}]`);
const mapFiles = [];

@@ -119,8 +119,20 @@ for (const dir of searchDirs) {

catch (e) {
throw new Error(`failed to get source maps from ${dir}: ${e}`);
throw error(`failed to get source maps from ${dir}: ${e}`);
}
}
debug(() => `Found source map files: [${mapFiles.join(', ')}]`);
return createFromMapFiles(mapFiles);
}
/**
* @param {Array.<string>} sourceMapPaths An array of paths to .map source map
* files that should be processed. The paths should be relative to the
* current process's current working directory
* @param {Logger} logger A logger that reports errors that occurred while
* processing the given source map files
* @constructor
*/
constructor() {
this.infoMap = new Map();
}
/**
* Used to get the information about the transpiled file from a given input

@@ -181,2 +193,3 @@ * source file provided there isn't any ambiguity with associating the input

if (entry === null) {
debug(() => `Source map lookup failed: no map found for ${location.file} (normalized: ${inputPath})`);
return location;

@@ -186,21 +199,19 @@ }

line: location.line,
column: location.column,
bias: sourceMap.SourceMapConsumer.LEAST_UPPER_BOUND,
column: location.column > 0 ? location.column - 1 : 0, // SourceMapConsumer expects column to be 0-based
};
// TODO: Determine how to remove the explicit cast here.
const consumer = entry.mapConsumer;
let pos = consumer.originalPositionFor(generatedPos);
const pos = consumer.originalPositionFor(generatedPos);
if (pos.source === null) {
generatedPos.bias = sourceMap.SourceMapConsumer.GREATEST_LOWER_BOUND;
pos = consumer.originalPositionFor(generatedPos);
}
if (pos.source === null) {
debug(() => `Source map lookup failed for ${location.name}(${location.file}:${location.line}:${location.column})`);
return location;
}
return {
const loc = {
file: path.resolve(entry.mapFileDir, pos.source),
line: pos.line || undefined,
name: pos.name || location.name,
column: pos.column || undefined,
column: pos.column === null ? undefined : pos.column + 1, // convert column back to 1-based
};
debug(() => `Source map lookup succeeded for ${location.name}(${location.file}:${location.line}:${location.column}) => ${loc.name}(${loc.file}:${loc.line}:${loc.column})`);
return loc;
}

@@ -217,3 +228,3 @@ }

catch (err) {
throw new Error('An error occurred while processing the source map files' + err);
throw error('An error occurred while processing the source map files' + err);
}

@@ -252,2 +263,5 @@ return mapper;

}
else {
debug(() => `Non fatal error: ${error}`);
}
}

@@ -254,0 +268,0 @@ }

@@ -17,4 +17,4 @@ /**

import { SourceMapper } from './sourcemapper/sourcemapper';
declare type Microseconds = number;
declare type Milliseconds = number;
type Microseconds = number;
type Milliseconds = number;
export interface TimeProfilerOptions {

@@ -21,0 +21,0 @@ /** time in milliseconds for which to collect profile. */

{
"name": "@datadog/pprof",
"version": "2.2.1",
"version": "2.2.2",
"description": "pprof support for Node.js",

@@ -21,3 +21,3 @@ "repository": "datadog/pprof-nodejs",

"prebuilds": "node scripts/prebuilds.js",
"prepare": "npm run compile",
"prepare": "npm run compile && npm run rebuild",
"pretest": "npm run compile && npm run rebuild"

@@ -34,3 +34,3 @@ },

"pify": "^5.0.0",
"pprof-format": "^2.0.6",
"pprof-format": "^2.0.7",
"source-map": "^0.7.3",

@@ -41,3 +41,3 @@ "split": "^1.0.1"

"@types/mocha": "^9.1.1",
"@types/node": "^18.0.6",
"@types/node": "^18.16.16",
"@types/p-limit": "^2.0.0",

@@ -47,5 +47,5 @@ "@types/pify": "^5.0.0",

"@types/request": "^2.47.1",
"@types/sinon": "^10.0.0",
"@types/sinon": "^10.0.15",
"@types/tmp": "^0.2.3",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"axios": "^0.27.2",

@@ -56,10 +56,9 @@ "checksum": "^1.0.0",

"deep-copy": "^1.4.2",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.0",
"eslint-plugin-promise": "^6.0.0",
"glob": "^8.0.3",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"glob": "^8.1.0",
"gts": "^3.0.0",
"js-green-licenses": "^4.0.0",
"linkinator": "^4.0.2",
"mkdirp": "^1.0.4",

@@ -71,9 +70,9 @@ "mocha": "^9.2.2",

"rimraf": "^3.0.2",
"semver": "^7.3.5",
"sinon": "^14.0.0",
"semver": "^7.5.1",
"sinon": "^14.0.2",
"source-map-support": "^0.5.12",
"tar": "^6.1.0",
"tar": "^6.1.15",
"tmp": "0.2.1",
"ts-mockito": "^2.2.5",
"typescript": "^4.7.4"
"typescript": "^4.9.5"
},

@@ -80,0 +79,0 @@ "files": [

# pprof support for Node.js
[![NPM Version][npm-image]][npm-url]
[![Build Status][circle-image]][circle-url]
[![Build Status][build-image]][build-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]

@@ -111,4 +111,4 @@

[circle-image]: https://circleci.com/gh/google/pprof-nodejs.svg?style=svg
[circle-url]: https://circleci.com/gh/google/pprof-nodejs
[build-image]: https://github.com/Datadog/pprof-nodejs/actions/workflows/build.yml/badge.svg?branch=main
[build-url]: https://github.com/Datadog/pprof-nodejs/actions/workflows/build.yml
[coveralls-image]: https://coveralls.io/repos/google/pprof-nodejs/badge.svg?branch=main&service=github

@@ -115,0 +115,0 @@ [npm-image]: https://badge.fury.io/js/pprof.svg

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc