Skip to content

Commit 6cfde5b

Browse files
committed
Refactor benchmark workflow to improve JSON file filtering using jq for enhanced validation and accuracy
1 parent f7db367 commit 6cfde5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/benchmark.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
for store in umadb kurrentdb axonserver eventsourcingdb; do
5252
printf "| %s " "$store" >> $GITHUB_STEP_SUMMARY
5353
for w in 1 2 4 8 16; do
54-
json_file=$(find results/raw -type f -name "summary.json" | xargs grep -l "\"adapter\": \"$store\"" | xargs grep -l "\"writers\": $w" | head -1)
54+
json_file=$(find results/raw -type f -name "summary.json" -exec sh -c 'jq -e ".adapter == \"'$store'\" and .writers == '$w'" "$1" > /dev/null 2>&1 && echo "$1"' _ {} \; | head -1)
5555
if [ -n "$json_file" ] && [ -f "$json_file" ]; then
5656
throughput=$(jq -r '.throughput_eps' "$json_file" | xargs printf "%.0f")
5757
printf "| %s eps " "$throughput" >> $GITHUB_STEP_SUMMARY
@@ -74,7 +74,7 @@ jobs:
7474
for store in umadb kurrentdb axonserver eventsourcingdb; do
7575
printf "| %s " "$store" >> $GITHUB_STEP_SUMMARY
7676
for w in 1 2 4 8 16; do
77-
json_file=$(find results/raw -type f -name "summary.json" | xargs grep -l "\"adapter\": \"$store\"" | xargs grep -l "\"writers\": $w" | head -1)
77+
json_file=$(find results/raw -type f -name "summary.json" -exec sh -c 'jq -e ".adapter == \"'$store'\" and .writers == '$w'" "$1" > /dev/null 2>&1 && echo "$1"' _ {} \; | head -1)
7878
if [ -n "$json_file" ] && [ -f "$json_file" ]; then
7979
p99=$(jq -r '.latency.p99_ms' "$json_file" | xargs printf "%.2f")
8080
printf "| %s ms " "$p99" >> $GITHUB_STEP_SUMMARY
@@ -95,7 +95,7 @@ jobs:
9595
9696
# Extract container metrics for 16 writers
9797
for store in umadb kurrentdb axonserver eventsourcingdb; do
98-
json_file=$(find results/raw -type f -name "summary.json" | xargs grep -l "\"adapter\": \"$store\"" | xargs grep -l "\"writers\": 16" | head -1)
98+
json_file=$(find results/raw -type f -name "summary.json" -exec sh -c 'jq -e ".adapter == \"'$store'\" and .writers == 16" "$1" > /dev/null 2>&1 && echo "$1"' _ {} \; | head -1)
9999
if [ -n "$json_file" ] && [ -f "$json_file" ]; then
100100
image_mb=$(jq -r '.container.image_size_bytes / 1024 / 1024' "$json_file" | xargs printf "%.0f")
101101
startup=$(jq -r '.container.startup_time_s' "$json_file" | xargs printf "%.2f")

0 commit comments

Comments
 (0)