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
npm install prom-client
- Create
src/metrics.ts with all metrics defined above
- Instrument both ingesters and the x402 middleware
- 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
Drips Wave · Complexity: Medium · 150 points
Comment below to request assignment. PR must include Closes #[this issue].
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
/metricsendpoint enables dashboards and alerts on key ingestion and API health signals.Key metrics to expose
trades_ingested_total— counter per pairamm_snapshots_total— counter per poolprice_requests_total— counterx402_payments_received_total— counterlast_trade_timestamp— gauge per pairdb_query_duration_seconds— histogramKey files
src/metrics.ts— create usingprom-clientsrc/server.ts— registerGET /metricssrc/ingesters/— increment countersSuggested execution
npm install prom-clientsrc/metrics.tswith all metrics defined aboveGET /metricsreturning Prometheus text format with no x402 gateExample commit message:
feat(api): add Prometheus /metrics endpoint with ingestion and payment countersAcceptance criteria
GET /metricsreturns valid Prometheus text