Add unique and new player metrics (Refs #142)
CI / checks (push) Successful in 4m53s

This commit is contained in:
2026-10-10 18:47:56 -04:00
parent 7fcf1cded2
commit e3e740cea3
16 changed files with 1212 additions and 3 deletions
+10
View File
@@ -32,6 +32,11 @@ const autoscaling = (value: unknown) =>
['readinessMeanSeconds', 'readinessMaxSeconds'].every(
(key) => value[key] === null || nonnegative(value[key])
);
const players = (value: unknown) =>
record(value) &&
['uniquePlayers', 'newPlayers'].every(
(key) => value[key] === null || (nonnegative(value[key]) && Number.isInteger(value[key]))
);
const policy = (value: unknown) =>
value === null ||
(record(value) &&
@@ -51,6 +56,9 @@ function validReport(value: unknown): value is MetricsData {
!totals(value.summary) ||
!running(value.running) ||
!matches(value.matches) ||
!record(value.players) ||
!players(value.players) ||
!timestamp(value.players.historyStartAt) ||
!autoscaling(value.autoscaling)
)
return false;
@@ -95,6 +103,8 @@ function validReport(value: unknown): value is MetricsData {
numeric(item.startAt) &&
numeric(item.endAt) &&
nonnegative(item.capturedHours) &&
players(item) &&
typeof item.playerHistoryPartial === 'boolean' &&
typeof item.partial === 'boolean'
)
)