inspector-vm
TypeScript icon, indicating that this package has built-in type declarations

3.7.0 • Public • Published

inspector-vm

NodeJS VM Metric Collector

NPM Version License CI Status

Take a look at the Documentation.

install

This library is meant to be used with typescript / nodejs.

npm install --save inspector-vm

basic usage

import { MetricRegistry } from "inspector-metrics";
import {
    V8EventLoop,
    V8MemoryMetrics,
    V8GCMetrics,
    V8ProcessMetrics,
} from "inspector-vm";

// get a registry
const registry: MetricRegistry = ...;

// instance the memory metric, contains
//   - space statistics
//   - memory statistics
const memoryMetrics: V8MemoryMetrics = new V8MemoryMetrics("v8");
//   - gc statistics
const gc: V8GCMetrics = new V8GCMetrics("gc", registry.getDefaultClock());
//   - event loop delay / latency
const eventLoop: V8EventLoop = new V8EventLoop("eventLoop");
//   - cpu_usage (system, user, total)
//   - active_handles
//   - active_requests
const processMetric: V8ProcessMetrics = new V8ProcessMetrics("process");

// metric is registered und the name "v8"
registry.registerMetric(memoryMetrics);
// metric is registered und the name "gc"
registry.registerMetric(gc);
// metric is registered und the name "eventLoop"
registry.registerMetric(eventLoop);
// metric is registered und the name "process"
registry.registerMetric(processMetric);

// setup reporter ...

// note that unstopped metrics can cause the application to keep running
memoryMetrics.stop();
gc.stop();
eventLoop.stop();
processMetric.stop();

License

MIT

Package Sidebar

Install

npm i inspector-vm

Weekly Downloads

48

Version

3.7.0

License

MIT

Unpacked Size

43.7 kB

Total Files

18

Last publish

Collaborators

  • rstiller