client_js
Prometheus client_js is the official Node.js client library for Prometheus monitoring. It provides instrumentation for counters, gauges, histograms, and summaries, with built-in default metrics for runtime and process monitoring.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | prometheus/client_js |
| Owner | prometheus |
| Primary language | JavaScript |
| License | Apache-2.0 — OSI-approved |
| Stars | 3.5k |
| Forks | 402 |
| Open issues | 107 |
| Latest release | v15.1.3 (2024-06-27) |
| Last updated | 2026-07-08 |
| Source | https://github.com/prometheus/client_js |
What client_js is
Apache-2.0 licensed JavaScript library enabling Node.js applications to expose Prometheus metrics via a scrape endpoint. Supports metric types (counter, gauge, histogram, summary), custom registries, multi-process aggregation via cluster module, and on-demand collection.
Get the client_js source
Clone the repository and explore it locally.
git clone https://github.com/prometheus/client_js.gitcd client_js# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Expose metrics endpoint via custom HTTP handler (library does not bundle web framework); call `registry.metrics()` and respond with text/plain content-type.
- Configure custom metric buckets and percentiles upfront; changing histogram buckets after metrics are scraped breaks cardinality consistency.
- For cluster deployments, use AggregatorRegistry explicitly or default registry aggregation will miss multi-worker insights.
- Event loop lag percentiles are averaged across workers, not properly aggregated; document this limitation in SLOs.
- Test `collect()` function performance; synchronous or promise-based collection is invoked on every Prometheus scrape (typically 15–60s intervals).
When to avoid it — and what to weigh
- Non-Prometheus monitoring stack — This client is Prometheus-specific. If you use Datadog, New Relic, or other backends, use their native client instead.
- Minimal overhead is critical — Default metrics collection (event loop sampling at 10ms precision, GC tracking) introduces measurable CPU overhead in latency-sensitive applications.
- Synchronous request handling only — The library requires async context (promise-aware collect functions). If you cannot use promises/async-await, integration becomes cumbersome.
- File descriptor / memory metrics on non-Linux — Some default metrics (FD count, memory details) are Linux-only; Windows/macOS users see partial metric coverage.
License & commercial use
Apache License 2.0 (Apache-2.0)—a permissive OSI-approved license.
Commercial use is permitted under Apache-2.0. Requires inclusion of license text and notice of modifications. Not a warranty or liability guarantee; review Apache-2.0 terms for your use case.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
No sensitive data exposure documented. Metrics endpoint is unencrypted by default (relies on application-level TLS/auth). Review custom metric names to avoid leaking PII (e.g., user IDs, API keys). No known CVEs recorded in data; standard security review recommended for production deployments.
Alternatives to consider
prom-client (npm)
Appears to be the same or equivalent project (Prometheus official client). Verify package name in your dependency manager.
StatsD + telegraf/influx
If you prefer a push-based, lower-cardinality metrics pipeline with less overhead; requires different instrumentation.
OpenTelemetry JS (with Prometheus exporter)
For multi-vendor observability (traces, logs, metrics); heavier instrumentation but vendor-agnostic.
Build on client_js with DEV.co software developers
Add Prometheus metrics in minutes. Install @prometheus/client, register metrics, and expose your /metrics endpoint.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
client_js FAQ
Does this library support TypeScript?
Can I use multiple registries in one application?
What is the performance impact of default metrics collection?
How do I filter or deny certain metric types?
Custom software development services
DEV.co helps companies turn open-source tools like client_js into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source observability stack.
Ready to instrument your Node.js app?
Add Prometheus metrics in minutes. Install @prometheus/client, register metrics, and expose your /metrics endpoint.