Show match demand in metrics (Refs #138)
CI / checks (push) Successful in 4m44s

This commit is contained in:
2026-10-10 16:26:32 -04:00
parent ea932ec563
commit 616b1937ed
15 changed files with 775 additions and 42 deletions
+10 -1
View File
@@ -17,6 +17,13 @@ const running = (value: unknown) =>
(value.average === null || nonnegative(value.average)) &&
nonnegative(value.peak) &&
nonnegative(value.capturedHours);
const matches = (value: unknown) =>
record(value) &&
['started', 'withRecordedPlayers', 'solo'].every(
(key) => nonnegative(value[key]) && Number.isInteger(value[key])
) &&
(value.averageGroupSize === null || nonnegative(value.averageGroupSize)) &&
(value.soloShare === null || (nonnegative(value.soloShare) && value.soloShare <= 100));
const policy = (value: unknown) =>
value === null ||
(record(value) &&
@@ -32,7 +39,8 @@ function validReport(value: unknown): value is MetricsData {
!numeric(value.now) ||
!numeric(value.since) ||
!totals(value.summary) ||
!running(value.running)
!running(value.running) ||
!matches(value.matches)
)
return false;
if (
@@ -84,6 +92,7 @@ function validReport(value: unknown): value is MetricsData {
(item) =>
record(item) &&
totals(item) &&
matches(item.matches) &&
typeof item.game === 'string' &&
typeof item.map === 'string' &&
[