Telemetry metrics for the Node.JS process.
npm install @carv/metrics-process
Register the plugin and if needed pass to it some custom options.
const { Telemetry } = require('@carv/telemetry')
const telemetry = new Telemetry()
// using the defaults
telemetry.use(require('@carv/metrics-process'))
// with custom options
telemetry.use(require('@carv/metrics-process'), { /* ... Options ... */ })
// using only eventLoopDelay metric
telemetry.use(require('@carv/metrics-process').eventLoopDelay)
Each metric is exported as a @carv/telemetry plugin. The default export registers all metrics/plugins. The following plugins are available and exported by name:
- cpuUsage: Process CPU time spent in seconds
- eventLoopDelay: Approximate event loop delay in seconds
- eventLoopUtilization: ELU is similar to CPU utilization, except that it only measures event loop statistics and not CPU usage. It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait)
- gcDuration: Garbage collection duration by kind, one of major, minor, incremental or weakcb
- heapSpace: Statistics about the V8 heap spaces
- memoryUsage: Memory usage of the Node.js process
- startTime: Start time of the process since unix epoch in seconds
- uptime: The number of seconds the current Node.js process has been running
- version: Node.js version info
Thanks for being willing to contribute!
Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
We are following the Conventional Commits convention.
yarn test
: Run test suiteyarn build
: Generate bundlesyarn lint
: Lints code