metrics on dashboard

This commit is contained in:
KingKDot
2026-05-31 14:27:59 -05:00
parent 4565074739
commit b31901e62a
6 changed files with 754 additions and 4 deletions
+3 -2
View File
@@ -178,13 +178,14 @@ describe("MetricsCollector", () => {
});
test("history is capped at maxHistoryPoints", () => {
for (let i = 0; i < 4500; i++) {
const weekOfFiveSecondSamples = 7 * 24 * 60 * 12;
for (let i = 0; i < weekOfFiveSecondSamples + 180; i++) {
const snap = metrics.getSnapshot();
metrics.recordHistoryEntry(snap);
}
const history = metrics.getHistory();
expect(history.length).toBeLessThanOrEqual(4320);
expect(history.length).toBeLessThanOrEqual(weekOfFiveSecondSamples);
});
test("getHistory returns a copy", () => {
+1 -1
View File
@@ -94,7 +94,7 @@ class MetricsCollector {
private receivedPerSecond: number = 0;
private history: MetricsHistory[] = [];
private maxHistoryPoints: number = 4320;
private maxHistoryPoints: number = 7 * 24 * 60 * 12;
private snapshotEnricher: ((snapshot: MetricsSnapshot) => void) | null = null;
private pingValues: number[] = [];