Add autoscaling outcomes to Metrics (Refs #140)

This commit is contained in:
2026-10-10 17:51:31 -04:00
parent 0bfda267ec
commit 528ed7f37a
15 changed files with 612 additions and 6 deletions
+10 -1
View File
@@ -24,6 +24,14 @@ const matches = (value: unknown) =>
) &&
(value.averageGroupSize === null || nonnegative(value.averageGroupSize)) &&
(value.soloShare === null || (nonnegative(value.soloShare) && value.soloShare <= 100));
const autoscaling = (value: unknown) =>
record(value) &&
['added', 'removed', 'failed', 'cancelled', 'readinessSamples'].every(
(key) => nonnegative(value[key]) && Number.isInteger(value[key])
) &&
['readinessMeanSeconds', 'readinessMaxSeconds'].every(
(key) => value[key] === null || nonnegative(value[key])
);
const policy = (value: unknown) =>
value === null ||
(record(value) &&
@@ -40,7 +48,8 @@ function validReport(value: unknown): value is MetricsData {
!numeric(value.since) ||
!totals(value.summary) ||
!running(value.running) ||
!matches(value.matches)
!matches(value.matches) ||
!autoscaling(value.autoscaling)
)
return false;
if (