Repository navigation
prometheus: v4.2.0
@routup/prometheus4.2.0 corrects status labels for unanswered requests. These notes coverprometheus-v4.1.0→prometheus-v4.2.0only.
👀 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.
⬆️ Upgrading
npm install @routup/prometheus@^4.2.0The 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.