Skip to content

Prometheus /metrics endpoint for API monitoring #38

Description

@Cbiux

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

  • /metrics returns valid Prometheus exposition format
  • Middleware tracks all /api/* routes
  • Document scrape config in Docs/vercel-deploy.md
  • No high-cardinality labels (no wallet addresses in labels)
  • Unit test for metric increment

Related


Out of scope

  • Grafana dashboard JSON
  • Vercel-native metrics (use external scraper)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSPart of the GrantFox OSS programMaybe RewardedThis issue may receive a reward or bountyOfficial CampaignPart of an official ZCore campaignenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions