feat: Prometheus metrics endpoint for knox nodes
Refs #2 - /metrics served on a dedicated port (KNOX_METRICS_ADDR, default localhost:8932) via prometheus/client_golang, with Go runtime + process collectors - DB-derived gauges refreshed per scrape: observations by source, last-24h observations, entries, projects, sessions, pending reflections, threads by status, peers, observations by origin node, knowledge vector (max hcl per node) - live gossip counters (pulls/pushes, observations pulled/pushed, errors) incremented during the anti-entropy sweep; Run accepts an optional metrics handle (nil for one-shot CLI) - knox_node_info{node_id,name} for scrape identification - internal/metrics package + db MetricsSnapshot; tests for snapshot, scrape output, and counter increments
This commit is contained in:
@@ -249,6 +249,17 @@ reach a booting node. Config via env `KNOX_PEER_ADDR` / `KNOX_PEERS`.
|
||||
Verified e2e: two daemons, `diff` previewed 1655 peer-only fingerprints, `sync`
|
||||
pulled all and converged B to 1655 observations.
|
||||
|
||||
**M5 — Prometheus metrics.** DONE. `/metrics` served on a dedicated port
|
||||
(`KNOX_METRICS_ADDR`, default `:8932`, separate from gossip). Uses
|
||||
`prometheus/client_golang`; ships with the Go runtime and process collectors.
|
||||
Gauge set: DB-derived gauges refreshed per scrape (`observations_total{source_id}`,
|
||||
`observations_last_24h`, `entries`, `projects`, `sessions`, `pending_reflections`,
|
||||
`threads_total{status}`, `peers`, `observations_by_node{node_id}`,
|
||||
`knowledge_max_hcl{node_id}`) plus live gossip counters
|
||||
(`pulls/pushes`, `observations_pulled/pushed`, `errors`) incremented during the
|
||||
anti-entropy sweep, and `knox_node_info{node_id,name}` for scrape identity
|
||||
(tracks issue #2).
|
||||
|
||||
## 9. Future Work (explicitly out of M1–M4)
|
||||
|
||||
- mDNS / rendezvous peer discovery.
|
||||
|
||||
Reference in New Issue
Block a user