Skip to content

prometheus: v4.2.0

Choose a tag to compare

@github-actions github-actions released this 22 Nov 19:36
daf8d3a

@routup/prometheus 4.2.0 corrects status labels for unanswered requests. These notes cover prometheus-v4.1.0 → prometheus-v4.2.0 only.

👀 Highlights

📊 Unmatched requests count as 404s, not successes

Requests that no handler answers now record status_code="404" instead of "200", so scanner traffic and missing routes no longer inflate your successful-request metrics. Unanswered OPTIONS requests retain the status of routup's automatic Allow response; responses returned by your handlers keep their actual status.

import { App } from 'routup';
import { Registry } from 'prom-client';
import { prometheus } from '@routup/prometheus';

const registry = new Registry();
const app = new App();
app.use(prometheus({ registry, uptime: false, unmatchedPath: '<unmatched>' }));

await app.fetch(new Request('http://localhost/nope'));
// Client: 404; request-duration labels: status_code="404", path="<unmatched>".

Warning

An error that no error handler answers is also labelled 404, even when the client receives 500: routup builds that response after the middleware pipeline and does not expose the error there. Return a response from an error handler to record its actual status.

📖 Prometheus documentation

⬆️ Upgrading

npm install @routup/prometheus@^4.2.0

The plugin's routup peer range remains ^6.4.0 (prom-client >=15.0.0); the move to routup 6.5.0 in this component is a development-dependency update, not a new peer requirement. Review dashboards that previously counted unmatched requests under 200.

👉 Changelog

4.2.0 (2026-11-22)

Features

Bug Fixes

  • prometheus: label a request no handler answered with 404 (4e61b06), closes #879