Skip to content

Add Prometheus /metrics endpoint #33

Description

@Miracle656

Background

Lens runs continuously ingesting trades and serving prices, but exposes no operational metrics. When ingestion stalls or prices stop updating, there is no automated way to detect it. A Prometheus /metrics endpoint enables dashboards and alerts on key ingestion and API health signals.

Key metrics to expose

  • trades_ingested_total — counter per pair
  • amm_snapshots_total — counter per pool
  • price_requests_total — counter
  • x402_payments_received_total — counter
  • last_trade_timestamp — gauge per pair
  • db_query_duration_seconds — histogram

Key files

  • src/metrics.ts — create using prom-client
  • src/server.ts — register GET /metrics
  • src/ingesters/ — increment counters

Suggested execution

git checkout -b feat/prometheus-metrics
  1. npm install prom-client
  2. Create src/metrics.ts with all metrics defined above
  3. Instrument both ingesters and the x402 middleware
  4. Add GET /metrics returning Prometheus text format with no x402 gate

Example commit message:
feat(api): add Prometheus /metrics endpoint with ingestion and payment counters

Acceptance criteria

  • GET /metrics returns valid Prometheus text
  • At least 5 custom metrics
  • No x402 gate on the metrics endpoint

Drips Wave · Complexity: Medium · 150 points
Comment below to request assignment. PR must include Closes #[this issue].

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions