Skip to content

Commit

Permalink
TODO: add LoE Consensus tracers
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadales committed Mar 28, 2024
1 parent 7c60413 commit c0808ae
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ instance ( LogFormatting (Header blk)
forHuman (ChainDB.ChainSelectionForFutureBlock pt) =
"Chain selection run for block previously from future: " <> renderRealPointAsPhrase pt
forHuman (ChainDB.PipeliningEvent ev') = forHumanOrMachine ev'
forHuman (ChainDB.AddedReprocessLoEBlocksToQueue) = undefined

Check warning on line 421 in cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs

View workflow job for this annotation

GitHub Actions / build

Warning in module Cardano.Node.Tracing.Tracers.ChainDB: Redundant bracket ▫︎ Found: "(ChainDB.AddedReprocessLoEBlocksToQueue)" ▫︎ Perhaps: "ChainDB.AddedReprocessLoEBlocksToQueue"
forHuman (ChainDB.PoppedReprocessLoEBlocksFromQueue) = undefined

Check warning on line 422 in cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs

View workflow job for this annotation

GitHub Actions / build

Warning in module Cardano.Node.Tracing.Tracers.ChainDB: Redundant bracket ▫︎ Found: "(ChainDB.PoppedReprocessLoEBlocksFromQueue)" ▫︎ Perhaps: "ChainDB.PoppedReprocessLoEBlocksFromQueue"
forHuman (ChainDB.ChainSelectionLoEDebug _ _) = undefined
forMachine dtal (ChainDB.IgnoreBlockOlderThanK pt) =
mconcat [ "kind" .= String "IgnoreBlockOlderThanK"
, "block" .= forMachine dtal pt ]
Expand Down Expand Up @@ -493,6 +496,9 @@ instance ( LogFormatting (Header blk)
, "block" .= forMachine dtal pt ]
forMachine dtal (ChainDB.PipeliningEvent ev') =
forMachine dtal ev'
forMachine dtal (ChainDB.AddedReprocessLoEBlocksToQueue) = undefined

Check warning on line 499 in cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs

View workflow job for this annotation

GitHub Actions / build

Warning in module Cardano.Node.Tracing.Tracers.ChainDB: Redundant bracket ▫︎ Found: "(ChainDB.AddedReprocessLoEBlocksToQueue)" ▫︎ Perhaps: "ChainDB.AddedReprocessLoEBlocksToQueue"
forMachine dtal (ChainDB.PoppedReprocessLoEBlocksFromQueue) = undefined

Check warning on line 500 in cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs

View workflow job for this annotation

GitHub Actions / build

Warning in module Cardano.Node.Tracing.Tracers.ChainDB: Redundant bracket ▫︎ Found: "(ChainDB.PoppedReprocessLoEBlocksFromQueue)" ▫︎ Perhaps: "ChainDB.PoppedReprocessLoEBlocksFromQueue"
forMachine dtal (ChainDB.ChainSelectionLoEDebug _ _) = undefined

asMetrics (ChainDB.SwitchedToAFork _warnings selChangedInfo _oldChain newChain) =
let ChainInformation { slots, blocks, density, epoch, slotInEpoch } =
Expand Down
44 changes: 44 additions & 0 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ instance HasSeverityAnnotation (ChainDB.TraceEvent blk) where
ChainDB.UpdateLedgerDbTraceEvent {} -> Debug
ChainDB.ChainSelectionForFutureBlock{} -> Debug
ChainDB.PipeliningEvent {} -> Debug
ChainDB.AddedReprocessLoEBlocksToQueue -> Info
ChainDB.PoppedReprocessLoEBlocksFromQueue -> Info
ChainDB.ChainSelectionLoEDebug _ _ -> Debug


getSeverityAnnotation (ChainDB.TraceLedgerReplayEvent ev) = case ev of
LedgerDB.ReplayFromGenesis {} -> Info
Expand Down Expand Up @@ -236,6 +240,10 @@ instance HasSeverityAnnotation (TraceChainSyncClientEvent blk) where
getSeverityAnnotation (TraceRolledBack _) = Notice
getSeverityAnnotation (TraceException _) = Warning
getSeverityAnnotation (TraceTermination _) = Notice
getSeverityAnnotation (TraceValidatedHeader _) = Info
getSeverityAnnotation (TraceWaitingBeyondForecastHorizon _) = Info
getSeverityAnnotation (TraceAccessingForecastHorizon _) = Info
getSeverityAnnotation (TraceGaveLoPToken _ _ _) = Info


instance HasPrivacyAnnotation (TraceChainSyncServerEvent blk)
Expand Down Expand Up @@ -487,6 +495,12 @@ instance ( ConvertRawHash blk
"About to add block to queue: " <> renderRealPointAsPhrase pt
FallingEdgeWith sz ->
"Block added to queue: " <> renderRealPointAsPhrase pt <> " queue size " <> condenseT sz
ChainDB.AddedReprocessLoEBlocksToQueue ->
"Added LoE blocks to queue."
ChainDB.PoppedReprocessLoEBlocksFromQueue ->
"Added LoE blocks to queue."
ChainDB.ChainSelectionLoEDebug _anchFrag0 _anchFrag1 -> undefined -- ???

ChainDB.PoppedBlockFromQueue edgePt ->
case edgePt of
RisingEdge ->
Expand Down Expand Up @@ -980,6 +994,14 @@ instance ( ConvertRawHash blk
mconcat [ "kind" .= String "TraceAddBlockEvent.PipeliningEvent.OutdatedTentativeHeader"
, "block" .= renderPointForVerbosity verb (blockPoint hdr)
]
ChainDB.AddedReprocessLoEBlocksToQueue ->
mconcat [ "kind" .= String "AddedReprocessLoEBlocksToQueue" ]
ChainDB.PoppedReprocessLoEBlocksFromQueue ->
mconcat [ "kind" .= String "PoppedReprocessLoEBlocksFromQueue" ]
ChainDB.ChainSelectionLoEDebug _frag0 _frag1 ->
mconcat [ "kind" .= String "ChainSelectionLoEDebug"
--, "???" .= undefined
]

where
addedHdrsNewChain
Expand Down Expand Up @@ -1303,6 +1325,20 @@ instance (ConvertRawHash blk, LedgerSupportsProtocol blk)
TraceTermination reason ->
mconcat [ "kind" .= String "ChainSyncClientEvent.TraceTermination"
, "reason" .= String (pack $ show reason) ]
TraceValidatedHeader h ->
mconcat [ "kind" .= String "ChainSyncClientEvent.TraceValidatedHeader"
, tipToObject (tipFromHeader h) ]
TraceWaitingBeyondForecastHorizon slotNo ->
mconcat [ "kind" .= String "ChainSyncClientEvent.TraceWaitingBeyondForecastHorizon"
, "slotNo" .= condense slotNo ]
TraceAccessingForecastHorizon slotNo ->
mconcat [ "kind" .= String "ChainSyncClientEvent.TraceAccessingForecastHorizon"
, "slotNo" .= condense slotNo ]
TraceGaveLoPToken tokenGiven h bestBlockNumberPriorToH ->
mconcat [ "kind" .= String "ChainSyncClientEvent.TraceGaveLoPToken"
, "given" .= String (pack $ show tokenGiven)
, tipToObject (tipFromHeader h)
, "blockNo" .= bestBlockNumberPriorToH ]

instance ConvertRawHash blk
=> ToObject (TraceChainSyncServerEvent blk) where
Expand Down Expand Up @@ -1537,6 +1573,14 @@ instance ToObject selection => ToObject (TraceGsmEvent selection) where
, "currentSelection" .= toObject verb s
, "age" .= toJSON (show a)
]
toObject _verb (GsmEventPreSyncingToSyncing) =

Check warning on line 1576 in cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs

View workflow job for this annotation

GitHub Actions / build

Warning in module Cardano.Tracing.OrphanInstances.Consensus: Redundant bracket ▫︎ Found: "(GsmEventPreSyncingToSyncing)" ▫︎ Perhaps: "GsmEventPreSyncingToSyncing"
mconcat
[ "kind" .= String ""
]
toObject _verb (GsmEventSyncingToPreSyncing) =

Check warning on line 1580 in cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs

View workflow job for this annotation

GitHub Actions / build

Warning in module Cardano.Tracing.OrphanInstances.Consensus: Redundant bracket ▫︎ Found: "(GsmEventSyncingToPreSyncing)" ▫︎ Perhaps: "GsmEventSyncingToPreSyncing"
mconcat
[ "kind" .= String "GsmEventSyncingToPreSyncing"
]

instance ConvertRawHash blk => ToObject (Tip blk) where
toObject _verb TipGenesis =
Expand Down

0 comments on commit c0808ae

Please sign in to comment.