ingest-api: export error_hub_* Prometheus metrics for hub freshness alerts
CI / Test ingest-api (pull_request) Successful in 38s
CI / Test api (pull_request) Successful in 43s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m30s
CI / Validate Docker build (pull_request) Successful in 5m45s

Join er_projects in ingest auth to expose lowercase project slug. Record
error_hub_last_event_timestamp from stored events occurred_at and
error_hub_ingest_failures_total on HTTP 500 batches (BIT-4903 / BIT-4932).

Add integration assertion when ERROR_REPORTING_TEST_DATABASE_URL is set.

Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-4932
Paperclip-Run: 00b93610-8794-4264-81a9-6f4cb39a9d8d
Made-with: Cursor
This commit is contained in:
David Santos committed 2026-04-21 05:08:42 +00:00
1 parent 988b4c57a4
commit b7cbf528ee
5 files changed
+91 -16

No files matched your search

+16
View File
@@ -60,6 +60,22 @@ export const activeConnections = new Gauge({
registers: [register],
});
/* ── Error hub SLO / alerting (BIT-4903 / BIT-4932) — names match Prometheus rules in Paperclip bundle ─ */
export const errorHubLastEventTimestamp = new Gauge({
name: "error_hub_last_event_timestamp",
help: "Unix time (seconds) of the latest successfully stored ingest event occurred_at, per project_slug",
labelNames: ["project_slug"] as const,
registers: [register],
});
export const errorHubIngestFailuresTotal = new Counter({
name: "error_hub_ingest_failures_total",
help: "Ingest handler failures (HTTP 500) counted by events in the failed batch, per project_slug",
labelNames: ["project_slug"] as const,
registers: [register],
});
export { register as prometheusRegistry };
export default async function prometheusPlugin(