node-process-metrics-prometheus
Get process, system, memory, CPU, and event loop metrics from a Node.js process in Prometheus text-based exposition format. Can be used synchronously, or as an event emitter.
Basic Usage
'use strict';const NodeProcessMetrics = ;const NodeProcessMetricsPrometheus = ; // Use synchronouslyconst pm = ;console; // Use as an event emitterconst pm = metrics: period: 1000 ; pm;
API
node-process-metrics
exports a single constructor with the following API.
NodeProcessEmitter([options])
- Arguments
options
(object) - An optional configuration supporting the following options:metrics
(number) - An instance ofNodeProcessMetrics
. Optional. If not provided, a new instance is constructed.registries
(array) - An array ofCollectorRegistry
instances. Optional. Defaults to[PromDress.defaultRegistry]
.
'metrics'
Event
The 'metrics'
event has one accompanying argument - a Prometheus exposition string.