Prometheus client for Node.js is a Prometheus client library that instruments Node.js applications to expose metrics in Prometheus format.
The library addresses the need to collect and expose application metrics for monitoring and observability. It provides built-in support for the four core metric types: counters, gauges, histograms, and summaries. The tool exposes metrics through a registry that responds to Prometheus scrape requests via the `registry.metrics()` method. Rather than bundling a web framework, it leaves the responsibility of HTTP endpoint creation to the user, allowing integration with any Node.js framework.
The project includes a set of default metrics aligned with Prometheus recommendations, covering standard runtime collectors plus Node.js-specific instrumentation such as event loop lag, active handles, garbage collection duration, and Node.js version. These default metrics are collected on-demand during scrape rather than continuously. The `collectDefaultMetrics` function accepts configuration for metric prefixes, custom histogram buckets for GC duration, event loop monitoring precision, and event loop utilization percentiles and buckets. Some metrics including file descriptor and memory statistics are available only on Linux. For point-in-time observations, custom metrics can define a `collect()` function invoked at scrape time, supporting both synchronous and promise-based implementations. The library was previously published under a different package name, with breaking changes documented in the changelog for those upgrading.
Development activity shows consistent engagement with pull requests being reviewed and merged regularly. Issues receive responses and are addressed through code changes. The project maintains active communication with contributors through discussion and feedback on submissions. Release cycles occur at regular intervals with updates to dependencies and bug fixes. The codebase demonstrates ongoing maintenance with attention to both new features and stability of existing functionality.