feat(03-01): create MetricsCollector and wire into gateway

- Add MetricsCollector class with counters, model call ring buffer, event ring buffer, and active request tracking
- Add system.metrics, system.events, system.activeRequests RPC handlers
- Add GET /health unauthenticated HTTP endpoint for Docker HEALTHCHECK
- Add totalPending() to LaneQueue for queue depth metrics
- Add 20 tests for MetricsCollector
This commit is contained in:
William Valentin
2026-02-09 21:28:05 -08:00
parent 7565d55551
commit bd1880a44c
6 changed files with 536 additions and 0 deletions
+9
View File
@@ -67,6 +67,15 @@ export class LaneQueue {
return this.lanes.get(laneId)?.queue.length ?? 0;
}
/** Get the total number of pending items across all lanes. */
totalPending(): number {
let total = 0;
for (const lane of this.lanes.values()) {
total += lane.queue.length;
}
return total;
}
/**
* Cancel all pending entries in a lane.
* Active work is NOT interrupted — only queued items are rejected.