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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user