Skip to content

Commit 87f9ef2

Browse files
committed
workbench | analysis: make prefiltering refresh automatic
1 parent f3a3522 commit 87f9ef2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

nix/workbench/analyse.sh

+11-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ usage_analyse() {
4747
$(helpopt --dump-slots) Machperf: dump filtered slots (JSON)
4848
$(helpopt --multi-overall) Multirun: Overall dataset statistical summary
4949
$(helpopt --multi-inter-cdf) Multirun: Inter-sample (i.e. inter-CDF) stats
50-
$(helpopt --refresh) Redo initial log filtering
5150
EOF
5251
}
5352
analysis_allowed_loanys=(
@@ -59,7 +58,7 @@ analysis_allowed_loanys=(
5958
analyse() {
6059
local filters=() filter_exprs=() filter_reasons= chain_errors= aws= sargs=() unfiltered= perf_omit_hosts=()
6160
local dump_logobjects= dump_machviews= dump_chain= dump_slots_raw= dump_slots=
62-
local multi_aspect='--inter-cdf' refresh= rtsmode= locli_args=()
61+
local multi_aspect='--inter-cdf' rtsmode= locli_args=()
6362

6463
progress "analyse" "args: $(yellow $*)"
6564
while test $# -gt 0
@@ -81,7 +80,6 @@ do case "$1" in
8180
--dump-slots | -s ) sargs+=($1); dump_slots='true';;
8281
--multi-overall ) sargs+=($1); multi_aspect='--overall';;
8382
--multi-inter-cdf ) sargs+=($1); multi_aspect='--inter-cdf';;
84-
--refresh | -re | -r ) sargs+=($1); refresh='true';;
8583
--rtsmode-aws | --aws ) sargs+=($1); rtsmode='aws';;
8684
--rtsmode-lomem | --lomem ) sargs+=($1); rtsmode='lomem';;
8785
--rtsmode-hipar ) sargs+=($1); rtsmode='hipar';;
@@ -437,17 +435,24 @@ case "$op" in
437435

438436
## 0. ask locli what it cares about
439437
local keyfile="$adir"/substring-keys
438+
local key_old=$(sha256sum "$keyfile" | cut -d' ' -f1)
440439
case $(jq '.node.tracing_backend // "iohk-monitoring"' --raw-output $dir/profile.json) in
441440
trace-dispatcher ) locli 'list-logobject-keys' --keys "$keyfile";;
442441
iohk-monitoring ) locli 'list-logobject-keys-legacy' --keys-legacy "$keyfile";;
443442
esac
443+
local key_new=$(sha256sum "$keyfile" | cut -d' ' -f1)
444444

445445
## 1. unless already done, filter logs according to locli's requirements
446446
local logdirs=($(ls -d "$dir"/node-*/ 2>/dev/null))
447447
local logfiles=($(ls "$adir"/logs-node-*.flt.json 2>/dev/null))
448-
local prefilter=$(test -z "${logfiles[*]}" -o -n "$refresh" && echo 'true' || echo 'false')
449-
echo "{ \"prefilter\": $prefilter }"
450-
if test x$prefilter != xtrue
448+
local prefilter=$(if test -z "${logfiles[*]}"
449+
then echo 'prefiltered-logs-not-yet-created'
450+
elif test "$key_new" -ne "$key_old"
451+
then echo 'prefiltering-keyset-changed'
452+
else echo 'false'
453+
fi)
454+
echo "{ \"prefilter\": \"$prefilter\" }"
455+
if test "$prefilter" == "false"
451456
then return; fi
452457

453458
verbose "analyse" "filtering logs: $(with_color black ${logdirs[@]})"

0 commit comments

Comments
 (0)