Skip to content

Commit 0d34651

Browse files
committed
cardano-node: rename metrics ChainDB Consensus
1 parent 76ca996 commit 0d34651

File tree

10 files changed

+319
-259
lines changed

10 files changed

+319
-259
lines changed

cardano-node/src/Cardano/Node/Tracing/API.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ initTraceDispatcher nc p networkMagic nodeKernel p2pMode = do
8282
mkTracers trConfig = do
8383
ekgStore <- EKG.newStore
8484
EKG.registerGcMetrics ekgStore
85-
ekgTrace <- ekgTracer (Left ekgStore)
85+
ekgTrace <- ekgTracer trConfig (Left ekgStore)
8686

8787
stdoutTrace <- standardTracer
8888

@@ -113,7 +113,7 @@ initTraceDispatcher nc p networkMagic nodeKernel p2pMode = do
113113
p
114114
where
115115
forwarderBackendEnabled =
116-
any checkForwarder . concat . Map.elems $ tcOptions trConfig
116+
(any (any checkForwarder) . Map.elems) $ tcOptions trConfig
117117

118118
checkForwarder (ConfBackend backends') = Forwarder `elem` backends'
119119
checkForwarder _ = False

cardano-node/src/Cardano/Node/Tracing/Documentation.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import Cardano.Node.Tracing.Tracers.KESInfo ()
3636
import Cardano.Node.Tracing.Tracers.NodeToClient ()
3737
import Cardano.Node.Tracing.Tracers.NodeToNode ()
3838
import Cardano.Node.Tracing.Tracers.NodeVersion (NodeVersionTrace)
39-
4039
import Cardano.Node.Tracing.Tracers.NonP2P ()
4140
import Cardano.Node.Tracing.Tracers.P2P ()
4241
import Cardano.Node.Tracing.Tracers.Peer
@@ -104,6 +103,8 @@ import GHC.Generics (Generic)
104103
import Network.Mux (MuxTrace (..), WithMuxBearer (..))
105104
import qualified Network.Socket as Socket
106105
import qualified Options.Applicative as Opt
106+
import System.IO
107+
107108

108109
data TraceDocumentationCmd
109110
= TraceDocumentationCmd
@@ -764,6 +765,8 @@ docTracersSecondPhase ::
764765
-> DocTracer
765766
-> IO ()
766767
docTracersSecondPhase outputFileName trConfig bl = do
767-
res <- docuResultsToText bl trConfig
768-
T.writeFile outputFileName res
769-
pure ()
768+
content <- docuResultsToText bl trConfig
769+
handle <- openFile outputFileName WriteMode
770+
hSetEncoding handle utf8
771+
T.hPutStr handle content
772+
hClose handle

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ instance LogFormatting ReplayBlockStats where
3939
]
4040
forHuman ReplayBlockStats {..} = "Block replay progress " <> textShow rpsProgress <> "%"
4141
asMetrics ReplayBlockStats {..} =
42-
[DoubleM "ChainDB.BlockReplayProgress" rpsProgress]
42+
[DoubleM "blockReplayProgress" rpsProgress]
4343

4444
instance MetaTrace ReplayBlockStats where
4545
namespaceFor ReplayBlockStats {} = Namespace [] ["LedgerReplay"]
@@ -52,7 +52,7 @@ instance MetaTrace ReplayBlockStats where
5252
documentFor _ = Nothing
5353

5454
metricsDocFor (Namespace _ ["LedgerReplay"]) =
55-
[("ChainDB.BlockReplayProgress", "Progress in percent")]
55+
[("blockReplayProgress", "Progress in percent")]
5656
metricsDocFor _ = []
5757

5858
allNamespaces =

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -525,20 +525,20 @@ instance ( LogFormatting (Header blk)
525525
asMetrics (ChainDB.SwitchedToAFork _warnings selChangedInfo _oldChain newChain) =
526526
let ChainInformation { slots, blocks, density, epoch, slotInEpoch } =
527527
chainInformation selChangedInfo newChain 0
528-
in [ DoubleM "ChainDB.Density" (fromRational density)
529-
, IntM "ChainDB.SlotNum" (fromIntegral slots)
530-
, IntM "ChainDB.BlockNum" (fromIntegral blocks)
531-
, IntM "ChainDB.SlotInEpoch" (fromIntegral slotInEpoch)
532-
, IntM "ChainDB.Epoch" (fromIntegral (unEpochNo epoch))
528+
in [ DoubleM "density" (fromRational density)
529+
, IntM "slotNum" (fromIntegral slots)
530+
, IntM "blockNum" (fromIntegral blocks)
531+
, IntM "slotInEpoch" (fromIntegral slotInEpoch)
532+
, IntM "epoch" (fromIntegral (unEpochNo epoch))
533533
]
534534
asMetrics (ChainDB.AddedToCurrentChain _warnings selChangedInfo _oldChain newChain) =
535535
let ChainInformation { slots, blocks, density, epoch, slotInEpoch } =
536536
chainInformation selChangedInfo newChain 0
537-
in [ DoubleM "ChainDB.Density" (fromRational density)
538-
, IntM "ChainDB.SlotNum" (fromIntegral slots)
539-
, IntM "ChainDB.BlockNum" (fromIntegral blocks)
540-
, IntM "ChainDB.SlotInEpoch" (fromIntegral slotInEpoch)
541-
, IntM "ChainDB.Epoch" (fromIntegral (unEpochNo epoch))
537+
in [ DoubleM "density" (fromRational density)
538+
, IntM "slotNum" (fromIntegral slots)
539+
, IntM "blockNum" (fromIntegral blocks)
540+
, IntM "slotInEpoch" (fromIntegral slotInEpoch)
541+
, IntM "epoch" (fromIntegral (unEpochNo epoch))
542542
]
543543
asMetrics _ = []
544544

@@ -638,48 +638,48 @@ instance MetaTrace (ChainDB.TraceAddBlockEvent blk) where
638638
detailsFor _ _ = Just DNormal
639639

640640
metricsDocFor (Namespace _ ["SwitchedToAFork"]) =
641-
[ ( "ChainDB.Density"
641+
[ ( "density"
642642
, mconcat
643643
[ "The actual number of blocks created over the maximum expected number"
644644
, " of blocks that could be created over the span of the last @k@ blocks."
645645
]
646646
)
647-
, ( "ChainDB.SlotNum"
647+
, ( "slotNum"
648648
, "Number of slots in this chain fragment."
649649
)
650-
, ( "ChainDB.Blocks"
650+
, ( "blockNum"
651651
, "Number of blocks in this chain fragment."
652652
)
653-
, ( "ChainDB.SlotInEpoch"
653+
, ( "slotInEpoch"
654654
, mconcat
655655
[ "Relative slot number of the tip of the current chain within the"
656656
, " epoch.."
657657
]
658658
)
659-
, ( "ChainDB.Epoch"
659+
, ( "epoch"
660660
, "In which epoch is the tip of the current chain."
661661
)
662662
]
663663
metricsDocFor (Namespace _ ["AddedToCurrentChain"]) =
664-
[ ( "ChainDB.Density"
664+
[ ( "density"
665665
, mconcat
666666
[ "The actual number of blocks created over the maximum expected number"
667667
, " of blocks that could be created over the span of the last @k@ blocks."
668668
]
669669
)
670-
, ( "ChainDB.SlotNum"
670+
, ( "slotNum"
671671
, "Number of slots in this chain fragment."
672672
)
673-
, ( "ChainDB.Blocks"
673+
, ( "blockNum"
674674
, "Number of blocks in this chain fragment."
675675
)
676-
, ( "ChainDB.SlotInEpoch"
676+
, ( "slotInEpoch"
677677
, mconcat
678678
[ "Relative slot number of the tip of the current chain within the"
679679
, " epoch.."
680680
]
681681
)
682-
, ( "ChainDB.Epoch"
682+
, ( "epoch"
683683
, "In which epoch is the tip of the current chain."
684684
)
685685
]

0 commit comments

Comments
 (0)