Skip to content
tekpriestPublic

About

Live service-topology map in Rust: services push call/heartbeat events over UDP or HTTP, force-graph dashboard streams over WebSocket.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ophis

Live service-topology map. Services push call/heartbeat events over UDP or HTTP; a single Rust binary keeps the graph in memory and streams it to a force-directed dashboard in the browser over WebSocket.

No database, no scraping, no agent installs — if a service can send a JSON blob, it shows up on the map.

  connectors (Elixir / Go / whatever)
        │  UDP :9999  or  HTTP POST :8080/ingest
        ▼
  ┌────────────────────────┐
  │  ophis (Rust, axum)    │   in-memory graph
  │  ─ record_call         │   nodes: health, EMA error rate, last seen
  │  ─ heartbeat           │   edges: call count, error count, avg latency
  │  ─ stale sweeper (10s) │
  └───────────┬────────────┘
              │  WebSocket /ws (throttled 200ms snapshots)
              ▼
  force-graph dashboard at http://127.0.0.1:8080/

Run

cargo run --release
# dashboard: http://127.0.0.1:8080/

Feed it without a real connector:

curl -X POST http://127.0.0.1:8080/ingest -H 'content-type: application/json' \
  -d '{"type":"rpc_call","source":"gateway","target":"billing","duration_ms":42,"status":"ok"}'

curl -X POST http://127.0.0.1:8080/ingest -H 'content-type: application/json' \
  -d '{"type":"heartbeat","service":"gateway"}'

Same event over UDP:

echo -n '{"type":"heartbeat","service":"gateway"}' | nc -u -w1 127.0.0.1 9999

Endpoints

Method Path Port Notes
GET / 8080 dashboard (static/index.html)
GET /ws 8080 WebSocket; sends a snapshot on connect, then on change
POST /ingest 8080 accepts an event, returns 202 Accepted
UDP — 9999 same event schema, fire-and-forget

Event schema

// a call between two services — creates/updates both nodes and the edge
{ "type": "rpc_call", "source": "gateway", "target": "billing",
  "duration_ms": 42, "status": "ok", "trace_id": "optional" }

// liveness only — keeps a node out of the stale sweep
{ "type": "heartbeat", "service": "gateway", "status": "optional" }

status is "ok" for success; anything else counts as an error.

How the graph decides node health

  • error rate is an exponential moving average (alpha = 0.2) so a single failed call doesn't flip a healthy node to red.
  • degraded when that average climbs above 0.2.
  • unknown when nothing has been heard from a node for 30s — the sweeper runs every 10s.
  • snapshots are batched: an event storm produces one dashboard update per 200ms, not one per event.

Status

Early prototype (~380 lines of Rust). Deliberately: state is in memory and lost on restart, there is no auth on the ingest endpoints, and single-instance only. Next up: a persistent snapshot sink and per-edge latency percentiles.

License

MIT — see LICENSE.

About

Live service-topology map in Rust: services push call/heartbeat events over UDP or HTTP, force-graph dashboard streams over WebSocket.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages