Skip to content

Instrument the HTTP surface in Prometheus #189

Closed

Description

@Miracle656

Background

src/metrics.ts exports indexer counters and a DB-query histogram, but nothing about HTTP: no request count, no status breakdown, no latency. /metrics is served at src/api.ts:268 and deliberately exempted from rate limiting (src/api.ts:72) — the scrape endpoint exists, the API just never reports on itself. A route that starts returning 500s is invisible on the same dashboard that shows ingest health.

Acceptance criteria

  • http_requests_total{method,route,status} and http_request_duration_seconds{method,route} in src/metrics.ts
  • One middleware in createApp() records both on response finish
  • The route label uses the Express route pattern (/transfers/incoming/:address), never the raw path — addresses must not become label values
  • /metrics is excluded from its own counters
  • A supertest hit increments the counter with the expected labels — fails before

Drips Wave · Complexity: Easy · 100 points


How this repo is laid out

Wraith is a Soroban incoming-transfer indexer: it fills the gap Horizon leaves for SAC/SEP-41 token events by recipient address. Roughly 14k lines under src/, REST + GraphQL + WebSocket, Postgres via Prisma, deployed on Render.

  • Unit tests are jest (src/**/__tests__, tests/*.test.ts), with a coverage gate.
  • Integration tests are vitest (tests/integration/, vitest.integration.config.ts, Docker).
  • Don't mix the two runners in one file.

Known state of main before you start

tsc --noEmit and the unit suite are green. The Integration tests CI job is red, and so is Load test — both predate this batch. Open PRs #177 and #178 address them. If the integration job is red when you open a PR, that is not your fault; say so in the PR and carry on.

Four modules are shipped, closed as done, and imported by nothing: src/indexer/checkpoint.ts, src/ingest/reorg.ts, src/middleware/opa.ts, and src/api/candles.ts + src/workers/ohlc-refresh.ts. So the live indexer today has no reorg handling and no atomic checkpointing, despite both features being closed. Two issues below start unpicking that — don't assume a closed issue means a wired feature.

Ground rules

  • Every PR needs a test that fails before the change and passes after, unless the issue says otherwise.
  • Don't widen a Prometheus label to something unbounded — addresses and contract ids must never become label values.
  • Nothing may log or return a raw database error, a connection string, or a provider URL.
  • Don't reformat a file you're changing. A diff that is 90% whitespace hides the 10% that matters.


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

  1. collinsezedike commented on Sep 28, 2026

    @collinsezedike
    Contributor

    @collinsezedike has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    GM Ebube, let me help you with this issue.

    The HTTP surface has no Prometheus metrics despite the scrape endpoint existing, so a route returning 500s is invisible on the same dashboard that shows ingest health. The key constraint is that route labels must use Express route patterns (not raw paths) to avoid unbounded label cardinality from addresses.

    Here's my plan:

    • Add http_requests_total with method route status labels and http_request_duration_seconds with method route labels to src/metrics.ts
    • Add a middleware in createApp that records both metrics on response finish
    • Use the Express route pattern for the route label and exclude /metrics from its own counters
    • Add a supertest that hits an endpoint and verifies the counter increments with the expected labels
    • Run the unit test suite and format check to verify

    Happy to start as soon as I'm assigned

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @collinsezedike to this issue.

  2. drips-wave commented on Sep 29, 2026

    @drips-wave

    Congratulations, @collinsezedike! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

    🧑‍💻 @collinsezedike: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

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

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions