Release 1.26.0
28 Sep 2026 · pinned package [email protected]
Async gauges (ADR-035: services on PostgreSQL read their counts asynchronously). A gauge's collect() may return a promise. The /metrics handler (metricsHandler, and the instrument() middleware that uses it) now calls the new registry.metricsAsync({ timeoutMs = 2000 }). It awaits every async collect together. A collect that rejects or runs past its budget is left out of that scrape and is never reported stale, just as a throwing one already was. The synchronous registry.metrics() is unchanged, and it leaves an async gauge out. The handler is now an async function; Express and plain http callers need no change. test/metrics.test.js covers async, rejecting and slow collects. This replaces the "one scrape behind" workaround the first PostgreSQL services used.