diff --git a/nix/tools/loadtest.nix b/nix/tools/loadtest.nix index 9831efe4c..c9538daac 100644 --- a/nix/tools/loadtest.nix +++ b/nix/tools/loadtest.nix @@ -267,7 +267,8 @@ let workingDir = "/"; } '' - ${vegeta}/bin/vegeta report -type=json "$_arg_file" \ + ${vegeta}/bin/vegeta encode "$_arg_file" \ + | ${jq}/bin/jq --slurp 'map(select(.url != "")) | group_by("\(.code) \(.method) \(.url)") | map({("\(.[0].code) \(.[0].method) \(.[0].url)" | sub("http://postgrest";"")): add | .latency / length | 10e6 / . }) | .[]' \ | ${jq}/bin/jq --arg branch "$(basename "$_arg_file" .bin)" '. + {branch: $branch}' ''; @@ -281,10 +282,10 @@ let import pandas as pd pd.read_json(sys.stdin) \ - .set_index('param') \ - .loc['rate'] \ + .set_index('rate') \ + .drop(['branch']) \ .convert_dtypes() \ - .to_markdown(sys.stdout, floatfmt='.0f') + .to_markdown(sys.stdout, floatfmt='.1f') ''; @@ -304,8 +305,8 @@ let echo -e "## Loadtest results $marker\n" find loadtest -type f -iname '*.bin' -exec ${reporter} {} \; \ - | ${jq}/bin/jq '[paths(scalars) as $path | {param: $path | join("."), (.branch): getpath($path)}]' \ - | ${jq}/bin/jq --slurp 'flatten | group_by(.param) | map(add)' \ + | ${jq}/bin/jq '[paths(scalars) as $path | {rate: $path | join("."), (.branch): getpath($path)}]' \ + | ${jq}/bin/jq --slurp 'flatten | group_by(.rate) | map(add)' \ | ${toMarkdown} echo -e "\n\n## Loadtest elapsed seconds vs CPU/MEM usage $marker\n"