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:
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user