@datadog/pprof
Advanced tools
Comparing version 4.0.0-pre-ff50bca to 4.0.0
@@ -18,3 +18,3 @@ /** | ||
import { SourceMapper } from './sourcemapper/sourcemapper'; | ||
import { AllocationProfileNode, LabelSet, TimeProfile } from './v8-types'; | ||
import { AllocationProfileNode, LabelSet, TimeProfile, TimeProfileNodeContext } from './v8-types'; | ||
/** | ||
@@ -27,3 +27,3 @@ * Converts v8 time profile into into a profile proto. | ||
*/ | ||
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean, generateLabels?: (context: object) => LabelSet): Profile; | ||
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean, generateLabels?: (context: TimeProfileNodeContext) => LabelSet): Profile; | ||
/** | ||
@@ -30,0 +30,0 @@ * Converts v8 heap profile into into a profile proto. |
@@ -186,3 +186,3 @@ "use strict"; | ||
for (const context of entry.node.contexts || []) { | ||
const labels = generateLabels ? generateLabels(context) : context; | ||
const labels = generateLabels ? generateLabels(context) : context.context; | ||
if (Object.keys(labels).length > 0) { | ||
@@ -223,12 +223,17 @@ const sample = new pprof_format_1.Sample({ | ||
for (const [key, value] of Object.entries(labelSet)) { | ||
if (typeof value === 'number' || typeof value === 'string') { | ||
const label = new pprof_format_1.Label({ | ||
key: stringTable.dedup(key), | ||
num: typeof value === 'number' ? value : undefined, | ||
str: typeof value === 'string' | ||
? stringTable.dedup(value) | ||
: undefined, | ||
}); | ||
labels.push(label); | ||
const labelInput = { | ||
key: stringTable.dedup(key), | ||
}; | ||
switch (typeof value) { | ||
case 'string': | ||
labelInput.str = stringTable.dedup(value); | ||
break; | ||
case 'number': | ||
case 'bigint': | ||
labelInput.num = value; | ||
break; | ||
default: | ||
continue; | ||
} | ||
labels.push(new pprof_format_1.Label(labelInput)); | ||
} | ||
@@ -235,0 +240,0 @@ return labels; |
@@ -17,3 +17,3 @@ /** | ||
import { SourceMapper } from './sourcemapper/sourcemapper'; | ||
import { LabelSet } from './v8-types'; | ||
import { LabelSet, TimeProfileNodeContext } from './v8-types'; | ||
type Microseconds = number; | ||
@@ -39,3 +39,3 @@ type Milliseconds = number; | ||
export declare function start({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, workaroundV8Bug, }: TimeProfilerOptions): void; | ||
export declare function stop(restart?: boolean, generateLabels?: (context: object) => LabelSet): import("pprof-format").Profile; | ||
export declare function stop(restart?: boolean, generateLabels?: (context: TimeProfileNodeContext) => LabelSet): import("pprof-format").Profile; | ||
export declare function getState(): any; | ||
@@ -42,0 +42,0 @@ export declare function setContext(context?: object): void; |
@@ -31,5 +31,9 @@ /** | ||
} | ||
export interface TimeProfileNodeContext { | ||
context: object; | ||
timestamp: bigint; | ||
} | ||
export interface TimeProfileNode extends ProfileNode { | ||
hitCount: number; | ||
contexts?: object[]; | ||
contexts?: TimeProfileNodeContext[]; | ||
} | ||
@@ -36,0 +40,0 @@ export interface AllocationProfileNode extends ProfileNode { |
{ | ||
"name": "@datadog/pprof", | ||
"version": "4.0.0-pre-ff50bca", | ||
"version": "4.0.0", | ||
"description": "pprof support for Node.js", | ||
@@ -36,3 +36,3 @@ "repository": "datadog/pprof-nodejs", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": ">=12", | ||
"@types/node": ">=14", | ||
"@types/sinon": "^10.0.15", | ||
@@ -78,4 +78,4 @@ "@types/tmp": "^0.2.3", | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=14" | ||
} | ||
} |
@@ -10,18 +10,12 @@ # pprof support for Node.js | ||
## Prerequisites | ||
1. Your application will need to be using Node.js 10.4.1 or greater, or any | ||
version of Node 12 or 14. | ||
1. Your application will need to be using Node.js 14 or greater. | ||
The profiler should not be enabled when using earlier versions of Node 10, | ||
since versions of Node.js 10 prior to 10.4.1 are impacted by | ||
[this](https://bugs.chromium.org/p/chromium/issues/detail?id=847863) issue, | ||
which can cause garbage collection to take several minutes when heap profiling | ||
is enabled. | ||
2. The `pprof` module has a native component that is used to collect profiles | ||
with v8's CPU and Heap profilers. You may need to install additional | ||
dependencies to build this module. | ||
* For Linux: `pprof` has prebuilt binaries available for Linux and Alpine | ||
Linux for Node 10, 12 and 14. No additional dependencies are required. | ||
* For other environments: when using `@google-cloud/profiler` on environments | ||
that `pprof` does not have prebuilt binaries for, the module | ||
* For Linux: `pprof` has prebuilt binaries available for Linux arm64/x64, | ||
Alpine Linux x64, macOS arm64/x64, windows x64 for Node 14/16/18/20. | ||
No additional dependencies are required. | ||
* For other environments: on environments that `pprof` does not have | ||
prebuilt binaries for, the module | ||
[`node-gyp`](https://www.npmjs.com/package/node-gyp) will be used to | ||
@@ -32,3 +26,3 @@ build binaries. See `node-gyp`'s | ||
3. The [`pprof`][pprof-url] CLI can be used to view profiles collected with | ||
3. The [`pprof`][pprof-url] CLI can be used to view profiles collected with | ||
this module. Instructions for installing the `pprof` CLI can be found | ||
@@ -35,0 +29,0 @@ [here][pprof-install-url]. |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 18 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1477
1
53
8249970
86
114