nix(loadtest): fix postgrest-loadtest-report locally

The script currently depends on results from "head" and "main" to be
present to calculate the change ratio. Fallback nicely in case these are
not available, which allows using the same to report URL-by-URL stats
locally.
This commit is contained in:
Wolfgang Walther
2026-06-26 19:33:51 +00:00
parent bb63c3fade
commit e5eb98c8a0
+9 -6
View File
@@ -279,12 +279,15 @@ let
def evaluate_change(df):
return ((df['head'] / df['main'] - 1) * 100) \
.map(lambda r: "{icon} {ratio:.1f} %".format(
ratio=r,
# Hardcoded failure threshold for CI is 5% here.
icon="" if r < 5 else ":x:"
))
try:
return ((df['head'] / df['main'] - 1) * 100) \
.map(lambda r: "{icon} {ratio:.1f} %".format(
ratio=r,
# Hardcoded failure threshold for CI is 5% here.
icon="" if r < 5 else ":x:"
))
except KeyError:
return None
pd.read_json(sys.stdin) \