Move issues (01–29) and PRD from .scratch/distributed-inference-network/ into docs/issues/ and docs/. Update ralph_progress.py DEFAULT_PRD path and rewrite docs/agents/issue-tracker.md to reflect the new layout. The distributed_inference_network.egg-info/docs/ mirror is a build artifact already covered by *.egg-info/ in .gitignore — not committed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.3 KiB
1.3 KiB
US-025 — Model usage statistics: rolling RPM windows + SQLite persistence
Status: done Priority: Medium Stage: Implemented
Context
Trackers need per-model request-rate data to drive smart shard assignment (US-026) and to give operators visibility into what the network is actually serving. Stats must survive tracker restarts and should be shareable across a tracker cluster.
Design
_RollingCounter: circular-bucket counter, epoch-indexed, stale buckets auto-reset- Three windows: 60×1-min buckets (last hour), 24×1-hr (last day), 30×1-day (last month)
_StatsCollector:record_request(),get_local_rpms(),merge_peer_rpms(),get_combined_stats()- SQLite persistence via
--stats-db PATH - Gossip: each tracker keeps its own slice; merge is additive (not averaged)
Acceptance criteria
_RollingCounterpasses unit tests (record, rpm, stale bucket reset)_StatsCollectoraccumulates and merges peer slices additively- SQLite round-trip: buckets saved and restored across restart
GET /v1/statsreturns combined stats JSONPOST /v1/stats/gossipaccepts peer slice and merges_handle_proxy_chatcallsstats.record_request()after model is resolved--stats-db PATHCLI flag added to tracker- 6 unit tests pass;
python -m pytestpasses