inspector-vm
NodeJS VM Metric Collector
install
This library is meant to be used with typescript
/ nodejs
.
npm install --save inspector-vm
basic usage
import { MetricRegistry } from "inspector-metrics";
import { V8MemoryMetrics, V8GCMetrics } from "inspector-vm";
// get a registry
const registry: MetricRegistry = ...;
// instance the memory metric, contains
// - space statistics
// - memory statistics
const memoryMetrics: V8MemoryMetrics = new V8MemoryMetrics("v8", registry.getDefaultClock());
// - gc statistics
const gcMetrics: V8GCMetrics = new V8GCMetrics("gc", registry.getDefaultClock());
// metric is registered und the name "v8"
// defaults to group "gc"
registry.register(memoryMetrics.getName(), memoryMetrics);
// setup reporter ...
// note that unstopped metrics can cause the application to keep running
gcMetrics.stop();
memoryMetrics.stop();