Add matched training signals, daily recovery and performance analysis

This commit is contained in:
Peter Stockings
2026-10-03 13:22:32 +10:00
parent e6e2f22479
commit 418e03583a
37 changed files with 1380 additions and 47 deletions
+11 -1
View File
@@ -8,6 +8,7 @@ import statistics
from .stats_dsl import UNITS, QueryError, parse_dsl
FUNCTIONS = {
"latest",
"sum",
"mean",
"weighted_mean",
@@ -134,6 +135,13 @@ EXTRA_UNITS = {
}
from .training_metrics import METRICS as TRAINING_METRICS
from .training_metrics import UNITS as TRAINING_UNITS
EXTRA_METRICS.update(TRAINING_METRICS)
EXTRA_UNITS.update(TRAINING_UNITS)
def valid(value):
return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
@@ -261,7 +269,7 @@ def parse_analysis(text, metrics, defaults):
function, field = match.groups()
if function not in FUNCTIONS or (not field and function != "count"):
raise QueryError(
"Use sum, mean, weighted_mean, median, min, max, stddev, count or p10/p25/p75/p90/p95/p99.",
"Use latest, sum, mean, weighted_mean, median, min, max, stddev, count or p10/p25/p75/p90/p95/p99.",
line,
)
if field and field not in catalog:
@@ -531,6 +539,8 @@ def describe(key, catalog, aggregates):
)
+ ". Percentiles use linear interpolation; stddev is population standard deviation. Missing values are excluded."
)
if function == "latest":
definition = "Value on the latest input by local date/time, including a missing value on that input. Sorting does not change which input is latest."
return label, unit, definition