From 1c88306d44ae22e071e307052782dff7a50193f5 Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Mon, 3 Jul 2023 18:51:04 -0700 Subject: [PATCH 1/4] Extract Zeek shaper from markdown --- scripts/perf-compare.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/perf-compare.sh b/scripts/perf-compare.sh index 8d51269036..bba81bdb3d 100755 --- a/scripts/perf-compare.sh +++ b/scripts/perf-compare.sh @@ -6,6 +6,9 @@ set -eo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" cd "$SCRIPT_DIR" || exit 1 +SHAPER=$(mktemp) +sed -e '1,/```mdtest-input shaper.zed/d' ../docs/integrations/zeek/shaping-zeek-ndjson.md | sed -e '/```/,$d' > "$SHAPER" + DATA="../zed-sample-data" ln -sfn zeek-default "$DATA/zeek" ln -sfn zeek-ndjson "$DATA/ndjson" @@ -84,7 +87,7 @@ do zed=${ZED_QUERIES[$n]} echo -n "|\`zq\`|\`$zed\`|$INPUT|$OUTPUT|" | tee -a "$MD" case $INPUT in - ndjson ) zq_flags="-i json -I ../zeek/shaper.zed" zed="| $zed" ;; + ndjson ) zq_flags="-i json -I $SHAPER" zed="| $zed" ;; zng-uncompressed ) zq_flags="-i zng" ;; * ) zq_flags="-i $INPUT" ;; esac From be5edf6482d71aac123f2af75a105f5b61df4e68 Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Mon, 3 Jul 2023 18:54:32 -0700 Subject: [PATCH 2/4] Remove shaper tmpfile at end of perf script --- scripts/perf-compare.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/perf-compare.sh b/scripts/perf-compare.sh index bba81bdb3d..25e9b9b5bc 100755 --- a/scripts/perf-compare.sh +++ b/scripts/perf-compare.sh @@ -117,3 +117,5 @@ do echo | tee -a "$MD" done + +rm -f "$SHAPER" From 0d6f463e776293c11ae3fe7bf7c7c7cf4a74b6fb Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Wed, 5 Jul 2023 12:38:36 -0700 Subject: [PATCH 3/4] PR feedback Co-authored-by: Noah Treuhaft --- scripts/perf-compare.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/perf-compare.sh b/scripts/perf-compare.sh index 25e9b9b5bc..4519671b22 100755 --- a/scripts/perf-compare.sh +++ b/scripts/perf-compare.sh @@ -6,8 +6,8 @@ set -eo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" cd "$SCRIPT_DIR" || exit 1 -SHAPER=$(mktemp) -sed -e '1,/```mdtest-input shaper.zed/d' ../docs/integrations/zeek/shaping-zeek-ndjson.md | sed -e '/```/,$d' > "$SHAPER" +shaper=$(mktemp) +sed -e '1,/```mdtest-input shaper.zed/d' -e '/```/,$d' ../docs/integrations/zeek/shaping-zeek-ndjson.md > "$shaper" DATA="../zed-sample-data" ln -sfn zeek-default "$DATA/zeek" From 86da76b8842456656f5eea0e740545ebd6c7e3fe Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Wed, 5 Jul 2023 12:39:24 -0700 Subject: [PATCH 4/4] More SHAPER/shaper changes --- scripts/perf-compare.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/perf-compare.sh b/scripts/perf-compare.sh index 4519671b22..8c5ac6313a 100755 --- a/scripts/perf-compare.sh +++ b/scripts/perf-compare.sh @@ -87,7 +87,7 @@ do zed=${ZED_QUERIES[$n]} echo -n "|\`zq\`|\`$zed\`|$INPUT|$OUTPUT|" | tee -a "$MD" case $INPUT in - ndjson ) zq_flags="-i json -I $SHAPER" zed="| $zed" ;; + ndjson ) zq_flags="-i json -I $shaper" zed="| $zed" ;; zng-uncompressed ) zq_flags="-i zng" ;; * ) zq_flags="-i $INPUT" ;; esac @@ -118,4 +118,4 @@ do echo | tee -a "$MD" done -rm -f "$SHAPER" +rm -f "$shaper"