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 3.1.0 to 3.2.0

1

out/src/index.d.ts

@@ -13,2 +13,3 @@ import * as heapProfiler from './heap-profiler';

isStarted: typeof timeProfiler.isStarted;
v8ProfilerStuckEventLoopDetected: typeof timeProfiler.v8ProfilerStuckEventLoopDetected;
getState: typeof timeProfiler.getState;

@@ -15,0 +16,0 @@ constants: {

@@ -59,2 +59,3 @@ "use strict";

isStarted: timeProfiler.isStarted,
v8ProfilerStuckEventLoopDetected: timeProfiler.v8ProfilerStuckEventLoopDetected,
getState: timeProfiler.getState,

@@ -61,0 +62,0 @@ constants: timeProfiler.constants,

3

out/src/profile-serializer.js

@@ -179,4 +179,3 @@ "use strict";

if (totalHitCount > 0) {
intervalMicros = Math.min(Math.max(Math.floor((prof.endTime - prof.startTime) /
computeTotalHitCount(prof.topDownRoot)), intervalMicros), 2 * intervalMicros);
intervalMicros = Math.min(Math.max(Math.floor((prof.endTime - prof.startTime) / totalHitCount), intervalMicros), 2 * intervalMicros);
}

@@ -183,0 +182,0 @@ }

@@ -34,5 +34,6 @@ /**

withContexts?: boolean;
workaroundV8Bug?: boolean;
}
export declare function profile({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, }: TimeProfilerOptions): Promise<import("pprof-format").Profile>;
export declare function start({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, }: TimeProfilerOptions): void;
export declare function profile({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, workaroundV8Bug, }: TimeProfilerOptions): Promise<import("pprof-format").Profile>;
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;

@@ -42,2 +43,3 @@ export declare function getState(): any;

export declare function isStarted(): boolean;
export declare function v8ProfilerStuckEventLoopDetected(): number;
export declare const constants: {

@@ -44,0 +46,0 @@ kSampleCount: any;

@@ -21,3 +21,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.constants = exports.isStarted = exports.setContext = exports.getState = exports.stop = exports.start = exports.profile = void 0;
exports.constants = exports.v8ProfilerStuckEventLoopDetected = exports.isStarted = exports.setContext = exports.getState = exports.stop = exports.start = exports.profile = void 0;
const delay_1 = __importDefault(require("delay"));

@@ -32,2 +32,3 @@ const profile_serializer_1 = require("./profile-serializer");

let gIntervalMicros;
let gV8ProfilerStuckEventLoopDetected = 0;
/** Make sure to stop profiler before node shuts down, otherwise profiling

@@ -39,3 +40,3 @@ * signal might cause a crash if it occurs during shutdown */

});
async function profile({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, }) {
async function profile({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, workaroundV8Bug = true, }) {
start({

@@ -47,2 +48,3 @@ intervalMicros,

withContexts,
workaroundV8Bug,
});

@@ -54,9 +56,10 @@ await (0, delay_1.default)(durationMillis);

// Temporarily retained for backwards compatibility with older tracer
function start({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, }) {
function start({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, workaroundV8Bug = true, }) {
if (gProfiler) {
throw new Error('Wall profiler is already started');
}
gProfiler = new time_profiler_bindings_1.TimeProfiler(intervalMicros, durationMillis * 1000, lineNumbers, withContexts);
gProfiler = new time_profiler_bindings_1.TimeProfiler(intervalMicros, durationMillis * 1000, lineNumbers, withContexts, workaroundV8Bug);
gSourceMapper = sourceMapper;
gIntervalMicros = intervalMicros;
gV8ProfilerStuckEventLoopDetected = 0;
gProfiler.start();

@@ -70,2 +73,16 @@ }

const profile = gProfiler.stop(restart);
if (restart) {
gV8ProfilerStuckEventLoopDetected =
gProfiler.v8ProfilerStuckEventLoopDetected();
// Workaround for v8 bug, where profiler event processor thread is stuck in
// a loop eating 100% CPU, leading to empty profiles.
// Fully stop and restart the profiler to reset the profile to a valid state.
if (gV8ProfilerStuckEventLoopDetected > 0) {
gProfiler.stop(false);
gProfiler.start();
}
}
else {
gV8ProfilerStuckEventLoopDetected = 0;
}
const serialized_profile = (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels);

@@ -97,3 +114,8 @@ if (!restart) {

exports.isStarted = isStarted;
// Return 0 if no issue detected, 1 if possible issue, 2 if issue detected for certain
function v8ProfilerStuckEventLoopDetected() {
return gV8ProfilerStuckEventLoopDetected;
}
exports.v8ProfilerStuckEventLoopDetected = v8ProfilerStuckEventLoopDetected;
exports.constants = { kSampleCount };
//# sourceMappingURL=time-profiler.js.map
{
"name": "@datadog/pprof",
"version": "3.1.0",
"version": "3.2.0",
"description": "pprof support for Node.js",

@@ -5,0 +5,0 @@ "repository": "datadog/pprof-nodejs",

@@ -40,3 +40,3 @@ # pprof support for Node.js

# Install through npm while saving to the local 'package.json'
npm install --save pprof
npm install --save @datadog/pprof
```

@@ -70,3 +70,3 @@

```sh
node --require pprof app.js
node --require @datadog/pprof app.js
```

@@ -73,0 +73,0 @@

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

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