@datadog/pprof
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -21,2 +21,2 @@ /** | ||
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; | ||
export declare function monitorOutOfMemory(heapLimitExtensionSize: number, maxHeapLimitExtensionCount: number, dumpHeapProfileOnSdterr: boolean, exportCommand: Array<String> | undefined, callback: NearHeapLimitCallback | undefined, callbackMode: number, isMainThread: boolean): void; |
@@ -58,6 +58,6 @@ "use strict"; | ||
exports.getAllocationProfile = getAllocationProfile; | ||
function monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode) { | ||
profiler.heapProfiler.monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode); | ||
function monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode, isMainThread) { | ||
profiler.heapProfiler.monitorOutOfMemory(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand, callback, callbackMode, isMainThread); | ||
} | ||
exports.monitorOutOfMemory = monitorOutOfMemory; | ||
//# sourceMappingURL=heap-profiler-bindings.js.map |
@@ -18,3 +18,3 @@ /** | ||
import { SourceMapper } from './sourcemapper/sourcemapper'; | ||
import { AllocationProfileNode } from './v8-types'; | ||
import { AllocationProfileNode, LabelSet } from './v8-types'; | ||
export declare function v8Profile(): AllocationProfileNode; | ||
@@ -28,4 +28,4 @@ /** | ||
*/ | ||
export declare function profile(ignoreSamplePath?: string, sourceMapper?: SourceMapper): Profile; | ||
export declare function convertProfile(rootNode: AllocationProfileNode, ignoreSamplePath?: string, sourceMapper?: SourceMapper): Profile; | ||
export declare function profile(ignoreSamplePath?: string, sourceMapper?: SourceMapper, generateLabels?: (node: AllocationProfileNode) => LabelSet): Profile; | ||
export declare function convertProfile(rootNode: AllocationProfileNode, ignoreSamplePath?: string, sourceMapper?: SourceMapper, generateLabels?: (node: AllocationProfileNode) => LabelSet): Profile; | ||
/** | ||
@@ -32,0 +32,0 @@ * Starts heap profiling. If heap profiling has already been started with |
@@ -21,2 +21,3 @@ "use strict"; | ||
const profile_serializer_1 = require("./profile-serializer"); | ||
const node_worker_threads_1 = require("node:worker_threads"); | ||
let enabled = false; | ||
@@ -45,7 +46,7 @@ let heapIntervalBytes = 0; | ||
*/ | ||
function profile(ignoreSamplePath, sourceMapper) { | ||
return convertProfile(v8Profile(), ignoreSamplePath, sourceMapper); | ||
function profile(ignoreSamplePath, sourceMapper, generateLabels) { | ||
return convertProfile(v8Profile(), ignoreSamplePath, sourceMapper, generateLabels); | ||
} | ||
exports.profile = profile; | ||
function convertProfile(rootNode, ignoreSamplePath, sourceMapper) { | ||
function convertProfile(rootNode, ignoreSamplePath, sourceMapper, generateLabels) { | ||
const startTimeNanos = Date.now() * 1000 * 1000; | ||
@@ -66,3 +67,3 @@ // Add node for external memory usage. | ||
} | ||
return (0, profile_serializer_1.serializeHeapProfile)(rootNode, startTimeNanos, heapIntervalBytes, ignoreSamplePath, sourceMapper); | ||
return (0, profile_serializer_1.serializeHeapProfile)(rootNode, startTimeNanos, heapIntervalBytes, ignoreSamplePath, sourceMapper, generateLabels); | ||
} | ||
@@ -138,5 +139,5 @@ exports.convertProfile = convertProfile; | ||
} | ||
(0, heap_profiler_bindings_1.monitorOutOfMemory)(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand || [], newCallback, typeof callbackMode !== 'undefined' ? callbackMode : exports.CallbackMode.Async); | ||
(0, heap_profiler_bindings_1.monitorOutOfMemory)(heapLimitExtensionSize, maxHeapLimitExtensionCount, dumpHeapProfileOnSdterr, exportCommand || [], newCallback, typeof callbackMode !== 'undefined' ? callbackMode : exports.CallbackMode.Async, node_worker_threads_1.isMainThread); | ||
} | ||
exports.monitorOutOfMemory = monitorOutOfMemory; | ||
//# sourceMappingURL=heap-profiler.js.map |
@@ -7,2 +7,3 @@ import * as heapProfiler from './heap-profiler'; | ||
export { setLogger } from './logger'; | ||
export { getNativeThreadId } from './time-profiler'; | ||
export declare const time: { | ||
@@ -9,0 +10,0 @@ profile: typeof timeProfiler.profile; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.heap = exports.time = exports.setLogger = exports.SourceMapper = exports.encodeSync = exports.encode = void 0; | ||
exports.heap = exports.time = exports.getNativeThreadId = exports.setLogger = exports.SourceMapper = exports.encodeSync = exports.encode = void 0; | ||
/** | ||
@@ -54,2 +54,4 @@ * Copyright 2019 Google Inc. All Rights Reserved. | ||
Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return logger_1.setLogger; } }); | ||
var time_profiler_1 = require("./time-profiler"); | ||
Object.defineProperty(exports, "getNativeThreadId", { enumerable: true, get: function () { return time_profiler_1.getNativeThreadId; } }); | ||
exports.time = { | ||
@@ -56,0 +58,0 @@ profile: timeProfiler.profile, |
@@ -37,2 +37,2 @@ /** | ||
*/ | ||
export declare function serializeHeapProfile(prof: AllocationProfileNode, startTimeNanos: number, intervalBytes: number, ignoreSamplesPath?: string, sourceMapper?: SourceMapper): Profile; | ||
export declare function serializeHeapProfile(prof: AllocationProfileNode, startTimeNanos: number, intervalBytes: number, ignoreSamplesPath?: string, sourceMapper?: SourceMapper, generateLabels?: (node: AllocationProfileNode) => LabelSet): Profile; |
@@ -87,3 +87,3 @@ "use strict"; | ||
locationIdMap.set(keyStr, id); | ||
const line = getLine(node.scriptId, profLoc.file, profLoc.name, profLoc.line); | ||
const line = getLine(profLoc, node.scriptId); | ||
const location = new pprof_format_1.Location({ id, line: [line] }); | ||
@@ -93,10 +93,13 @@ locations.push(location); | ||
} | ||
function getLine(scriptId, scriptName, name, line) { | ||
function getLine(loc, scriptId) { | ||
return new pprof_format_1.Line({ | ||
functionId: getFunction(scriptId, scriptName, name).id, | ||
line, | ||
functionId: getFunction(loc, scriptId).id, | ||
line: loc.line, | ||
}); | ||
} | ||
function getFunction(scriptId, scriptName, name) { | ||
const keyStr = `${scriptId}:${name}`; | ||
function getFunction(loc, scriptId) { | ||
let name = loc.name; | ||
const keyStr = name | ||
? `${scriptId}:${name}` | ||
: `${scriptId}:${loc.line}:${loc.column}`; | ||
let id = functionIdMap.get(keyStr); | ||
@@ -109,3 +112,16 @@ if (id !== undefined) { | ||
functionIdMap.set(keyStr, id); | ||
const nameId = stringTable.dedup(name || '(anonymous)'); | ||
if (!name) { | ||
if (loc.line) { | ||
if (loc.column) { | ||
name = `(anonymous:L#${loc.line}:C#${loc.column})`; | ||
} | ||
else { | ||
name = `(anonymous:L#${loc.line})`; | ||
} | ||
} | ||
else { | ||
name = '(anonymous)'; | ||
} | ||
} | ||
const nameId = stringTable.dedup(name); | ||
const f = new pprof_format_1.Function({ | ||
@@ -115,3 +131,3 @@ id, | ||
systemName: nameId, | ||
filename: stringTable.dedup(scriptName || ''), | ||
filename: stringTable.dedup(loc.file || ''), | ||
}); | ||
@@ -254,5 +270,8 @@ functions.push(f); | ||
*/ | ||
function serializeHeapProfile(prof, startTimeNanos, intervalBytes, ignoreSamplesPath, sourceMapper) { | ||
function serializeHeapProfile(prof, startTimeNanos, intervalBytes, ignoreSamplesPath, sourceMapper, generateLabels) { | ||
const appendHeapEntryToSamples = (entry, samples) => { | ||
if (entry.node.allocations.length > 0) { | ||
const labels = generateLabels | ||
? buildLabels(generateLabels(entry.node), stringTable) | ||
: []; | ||
for (const alloc of entry.node.allocations) { | ||
@@ -262,2 +281,3 @@ const sample = new pprof_format_1.Sample({ | ||
value: [alloc.count, alloc.sizeBytes * alloc.count], | ||
label: labels, | ||
// TODO: add tag for allocation size | ||
@@ -264,0 +284,0 @@ }); |
export declare const TimeProfiler: any; | ||
export declare const constants: any; | ||
export declare const getNativeThreadId: any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.constants = exports.TimeProfiler = void 0; | ||
exports.getNativeThreadId = exports.constants = exports.TimeProfiler = void 0; | ||
/** | ||
@@ -24,2 +24,3 @@ * Copyright 2018 Google Inc. All Rights Reserved. | ||
exports.constants = profiler.constants; | ||
exports.getNativeThreadId = profiler.getNativeThreadId; | ||
//# sourceMappingURL=time-profiler-bindings.js.map |
@@ -17,2 +17,3 @@ /** | ||
import { SourceMapper } from './sourcemapper/sourcemapper'; | ||
import { getNativeThreadId } from './time-profiler-bindings'; | ||
import { LabelSet, TimeProfileNodeContext } from './v8-types'; | ||
@@ -48,1 +49,2 @@ type Microseconds = number; | ||
export { LabelSet }; | ||
export { getNativeThreadId }; |
@@ -21,6 +21,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.constants = exports.v8ProfilerStuckEventLoopDetected = exports.isStarted = exports.setContext = exports.getState = exports.stop = exports.start = exports.profile = void 0; | ||
exports.getNativeThreadId = exports.constants = exports.v8ProfilerStuckEventLoopDetected = exports.isStarted = exports.setContext = exports.getState = exports.stop = exports.start = exports.profile = void 0; | ||
const delay_1 = __importDefault(require("delay")); | ||
const profile_serializer_1 = require("./profile-serializer"); | ||
const time_profiler_bindings_1 = require("./time-profiler-bindings"); | ||
Object.defineProperty(exports, "getNativeThreadId", { enumerable: true, get: function () { return time_profiler_bindings_1.getNativeThreadId; } }); | ||
const { kSampleCount } = time_profiler_bindings_1.constants; | ||
@@ -27,0 +28,0 @@ const DEFAULT_INTERVAL_MICROS = 1000; |
{ | ||
"name": "@datadog/pprof", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "pprof support for Node.js", | ||
@@ -5,0 +5,0 @@ "repository": "datadog/pprof-nodejs", |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9359632
1508