Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Tracing with New Metrics, Renames, and Fixes #5991

Merged
merged 6 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cardano-node/src/Cardano/Node/Tracing/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ mkConsensusTracers configReflection trBase trForward mbTrEKG _trDataPoint trConf
["BlockFetch", "Server"]
configureTracers configReflection trConfig [blockFetchServerTr]

!servedBlockLatestTr <- servedBlockLatest mbTrEKG

!forgeKESInfoTr <- mkCardanoTracer
trBase trForward mbTrEKG
["Forge", "StateInfo"]
Expand Down Expand Up @@ -350,6 +352,7 @@ mkConsensusTracers configReflection trBase trForward mbTrEKG _trDataPoint trConf
<> traceWith blockFetchClientMetricsTr
, Consensus.blockFetchServerTracer = Tracer $
traceWith blockFetchServerTr
<> traceWith servedBlockLatestTr
, Consensus.forgeStateInfoTracer = Tracer $
traceWith (traceAsKESInfo (Proxy @blk) forgeKESInfoTr)
, Consensus.gddTracer = Tracer $
Expand Down
17 changes: 9 additions & 8 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
Expand Down Expand Up @@ -32,7 +32,8 @@ import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB
import qualified Ouroboros.Consensus.Storage.ImmutableDB as ImmDB
import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal (chunkNoToInt)
import qualified Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types as ImmDB
import Ouroboros.Consensus.Storage.LedgerDB (UpdateLedgerDbTraceEvent (..), ReplayStart (..))
import Ouroboros.Consensus.Storage.LedgerDB (ReplayStart (..),
UpdateLedgerDbTraceEvent (..))
import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB
import qualified Ouroboros.Consensus.Storage.VolatileDB as VolDB
import Ouroboros.Consensus.Util.Condense (condense)
Expand Down Expand Up @@ -540,17 +541,19 @@ instance ( LogFormatting (Header blk)
]


asMetrics (ChainDB.SwitchedToAFork _warnings selChangedInfo _oldChain newChain) =
let ChainInformation { slots, blocks, density, epoch, slotInEpoch } =
chainInformation selChangedInfo newChain 0
asMetrics (ChainDB.SwitchedToAFork _warnings selChangedInfo oldChain newChain) =
let forkIt = not $ AF.withinFragmentBounds (AF.headPoint oldChain)
newChain
ChainInformation { .. } = chainInformation selChangedInfo newChain 0
in [ DoubleM "density" (fromRational density)
, IntM "slotNum" (fromIntegral slots)
, IntM "blockNum" (fromIntegral blocks)
, IntM "slotInEpoch" (fromIntegral slotInEpoch)
, IntM "epoch" (fromIntegral (unEpochNo epoch))
, CounterM "forks" (Just (if forkIt then 1 else 0))
]
asMetrics (ChainDB.AddedToCurrentChain _warnings selChangedInfo _oldChain newChain) =
let ChainInformation { slots, blocks, density, epoch, slotInEpoch } =
let ChainInformation { .. } =
chainInformation selChangedInfo newChain 0
in [ DoubleM "density" (fromRational density)
, IntM "slotNum" (fromIntegral slots)
Expand Down Expand Up @@ -2094,8 +2097,6 @@ data ChainInformation = ChainInformation
-- ^ Relative slot number of the tip of the current chain within the
-- epoch.
, blocksUncoupledDelta :: Int64
-- ^ The net change in number of blocks forged since last restart not on the
-- current chain.
}

chainInformation
Expand Down
Loading
Loading