Summary
Add a /metrics Prometheus endpoint for production monitoring of API health, request rates, and scoring throughput.
Background
/health confirms process status. Operators need metrics for Grafana/Datadog: request latency, error rates, events ingested per platform, Horizon call failures.
Proposed implementation
Endpoint: GET /metrics (Prometheus text format)
Metrics (initial set):
| Metric |
Type |
Description |
zcore_http_requests_total |
counter |
By method, route, status |
zcore_events_reported_total |
counter |
By platform, eventType |
zcore_horizon_errors_total |
counter |
Horizon fetch failures |
zcore_auth_verify_failures_total |
counter |
SEP-53 verify failures |
zcore_db_query_duration_seconds |
histogram |
Prisma query latency |
Middleware: Express middleware wrapping app.use in app.ts
Optional auth: METRICS_SECRET bearer token for production
Acceptance criteria
Related
Out of scope
- Grafana dashboard JSON
- Vercel-native metrics (use external scraper)
Summary
Add a
/metricsPrometheus endpoint for production monitoring of API health, request rates, and scoring throughput.Background
/healthconfirms process status. Operators need metrics for Grafana/Datadog: request latency, error rates, events ingested per platform, Horizon call failures.Proposed implementation
Endpoint:
GET /metrics(Prometheus text format)Metrics (initial set):
zcore_http_requests_totalzcore_events_reported_totalzcore_horizon_errors_totalzcore_auth_verify_failures_totalzcore_db_query_duration_secondsMiddleware: Express middleware wrapping
app.useinapp.tsOptional auth:
METRICS_SECRETbearer token for productionAcceptance criteria
/metricsreturns valid Prometheus exposition format/api/*routesDocs/vercel-deploy.mdRelated
Out of scope