Skip to content

[telemetry] Prometheus metrics endpoint (liquidations, profit, scan latency, chain health) #20

@obchain

Description

@obchain

Context

Visibility is non-negotiable for a live bot. Prometheus + Grafana is self-hosted, zero marginal cost, and integrates with every standard alerting tool. This issue covers the exposition side; the Grafana dashboards are part of the deploy issue.

Scope

  • Create crates/charon-telemetry/ crate
  • /metrics HTTP endpoint on a configurable port (default 9090)
  • Counters: charon_liquidations_total, charon_liquidation_failures_total, charon_scans_total
  • Gauges: charon_positions_tracked, charon_latest_block, charon_chain_ws_connected
  • Histograms: charon_scan_duration_seconds, charon_build_duration_seconds
  • Labels: chain, protocol, bucket (healthy / near-liq / liquidatable)
  • prometheus crate (or metrics + metrics-exporter-prometheus)

Acceptance criteria

  • curl localhost:9090/metrics returns Prometheus-formatted text
  • All metrics emit during a normal listen run
  • Counter increments are observable across multiple scans
  • Histograms capture realistic latency distributions
  • No metric-cardinality explosions (label values bounded)

References

  • PRD section 7a (Telemetry & Alerting)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions