Skip to content

Commit 5165d49

Browse files
committed
wb | locli: provide correct log object count for truncated logs
1 parent f38e662 commit 5165d49

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

bench/locli/src/Cardano/Analysis/Summary.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,20 @@ computeSummary sumAnalysisTime
172172
where
173173
cdfLogLineRate = cdf stdCentiles lineRates
174174

175+
hostLogs =
176+
rlHostLogs
177+
& Map.elems
178+
175179
(,) logObjectsEmitted textLinesEmitted =
176-
rlHostLogs
177-
& Map.toList
178-
& fmap ((hlRawLogObjects &&& hlRawLines) . snd)
180+
hostLogs
181+
& fmap (hlRawLogObjects &&& hlRawLines)
179182
& unzip
183+
180184
objLists = rlLogs rl <&> snd
181185

182186
losFirsts, losLasts :: [UTCTime]
183-
losFirsts = objLists <&> loAt . Prelude.head
184-
losLasts = objLists <&> loAt . Prelude.last
187+
losFirsts = hostLogs <&> (\HostLogs{hlLogs, hlRawFirstAt} -> fromMaybe (loAt $ Prelude.head $ snd hlLogs) hlRawFirstAt)
188+
losLasts = hostLogs <&> (\HostLogs{hlLogs, hlRawLastAt} -> fromMaybe (loAt $ Prelude.last $ snd hlLogs) hlRawLastAt)
185189
runtimes :: [NominalDiffTime]
186190
runtimes = zipWith diffUTCTime losLasts losFirsts
187191
lineRates = zipWith (/) (textLinesEmitted <&> fromIntegral)

bench/locli/src/Cardano/Unlog/LogObject.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ data HostLogs a
114114
, hlLogs :: (JsonLogfile, a)
115115
, hlFilteredSha256 :: Hash
116116
, hlProfile :: [ProfileEntry I]
117+
, hlRawFirstAt :: Maybe UTCTime
118+
, hlRawLastAt :: Maybe UTCTime
117119
}
118120
deriving (Generic)
119121

nix/workbench/analyse/analyse.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,6 @@ EOF
572572
then remanifest_reasons+=("$(red logs modified after manifest)")
573573
fi
574574

575-
echo $(ls 2>/dev/null --sort=time $dir/node-*/*.json $dir/node-*/stdout $run_logs)
576-
577575
if test ${#remanifest_reasons[*]} = 0
578576
then progress "analyse" "log manifest exists and is up to date"
579577
else progress "analyse" "assembling log manifest: ${remanifest_reasons[*]}"
@@ -623,6 +621,13 @@ EOF
623621

624622
done
625623
wait
624+
625+
for mach in $(jq_tolist '.rlHostLogs | keys' $run_logs)
626+
do jq_fmutate "$run_logs" '
627+
.rlHostLogs["'"$mach"'"].hlRawFirstAt = '"$(cat $adir/logs-$mach.flt.json | head -n1 | jq .at)"'
628+
| .rlHostLogs["'"$mach"'"].hlRawLastAt = '"$(cat $adir/logs-$mach.flt.json | tail -n1 | jq .at)"'
629+
'
630+
done
626631
}
627632
fi
628633

0 commit comments

Comments
 (0)