Skip to content

Commit bfdd45d

Browse files
authored
Merge pull request #6262 from IntersectMBO/jutaro/10.5.0_patches
HOTFIX: Fix metric in ForgingStats tracer
2 parents b897881 + 4f0bc8a commit bfdd45d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingStats.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ calculateForgingStats stats _context
100100
TraceNodeCannotForge {} =
101101
pure $ stats { fsNodeCannotForgeNum = fsNodeCannotForgeNum stats + 1 }
102102
calculateForgingStats stats _context
103-
TraceNodeIsLeader {} =
104-
pure $ stats { fsNodeIsLeaderNum = fsNodeIsLeaderNum stats + 1 }
103+
(TraceNodeIsLeader (SlotNo slot)) =
104+
pure $ stats { fsNodeIsLeaderNum = fsNodeIsLeaderNum stats + 1
105+
, fsLastSlot = fromIntegral slot }
105106
calculateForgingStats stats _context
106107
TraceForgedBlock {} =
107108
pure $ stats { fsBlocksForgedNum = fsBlocksForgedNum stats + 1 }
108109
calculateForgingStats stats _context
109110
(TraceNodeNotLeader (SlotNo slot')) =
111+
-- Node is not a leader again: The number of blocks forged by
112+
-- this node should now be equal to the number of slots when
113+
-- this node was a leader.
110114
let slot = fromIntegral slot'
111115
in if fsLastSlot stats == 0 || succ (fsLastSlot stats) == slot
112116
then pure $ stats { fsLastSlot = slot }

0 commit comments

Comments
 (0)