From 76ca996eed382b8b92450decf6c51fa7415a2869 Mon Sep 17 00:00:00 2001 From: Yupanqui Date: Mon, 24 Jun 2024 09:20:08 +0200 Subject: [PATCH 1/7] trace_dispatcher: with metrix prexix and with type suffix --- .../bench/trace-dispatcher-bench.hs | 2 +- .../Cardano/Logging/ConfigurationParser.hs | 6 +++ .../Cardano/Logging/TraceDispatcherMessage.hs | 5 +++ .../src/Cardano/Logging/Tracer/EKG.hs | 39 +++++++++++-------- trace-dispatcher/src/Cardano/Logging/Types.hs | 3 ++ .../Logging/Test/Unit/Configuration.hs | 2 + .../Logging/Test/Unit/Documentation.hs | 1 + .../test/Cardano/Logging/Test/Unit/EKG.hs | 2 +- 8 files changed, 42 insertions(+), 18 deletions(-) diff --git a/trace-dispatcher/bench/trace-dispatcher-bench.hs b/trace-dispatcher/bench/trace-dispatcher-bench.hs index 961543eab50..b8425e2af4c 100644 --- a/trace-dispatcher/bench/trace-dispatcher-bench.hs +++ b/trace-dispatcher/bench/trace-dispatcher-bench.hs @@ -107,7 +107,7 @@ ekgTracers confState = do forwardTrRef <- newIORef [] forwardTracer' <- testTracer forwardTrRef ekgServer <- forkServer "localhost" 8000 - ekgTracer <- ekgTracer (Right ekgServer) + ekgTracer <- ekgTracer emptyTraceConfig (Right ekgServer) tr <- mkCardanoTracer stdoutTracer' forwardTracer' diff --git a/trace-dispatcher/src/Cardano/Logging/ConfigurationParser.hs b/trace-dispatcher/src/Cardano/Logging/ConfigurationParser.hs index 237ed92b6f1..f911d4b5756 100644 --- a/trace-dispatcher/src/Cardano/Logging/ConfigurationParser.hs +++ b/trace-dispatcher/src/Cardano/Logging/ConfigurationParser.hs @@ -32,6 +32,7 @@ data ConfigRepresentation = ConfigRepresentation { traceOptions :: OptionsRepresentation , traceOptionForwarder :: Maybe TraceOptionForwarder , traceOptionNodeName :: Maybe Text + , traceOptionMetricsPrefix :: Maybe Text , traceOptionPeerFrequency :: Maybe Int , traceOptionResourceFrequency :: Maybe Int } @@ -42,6 +43,7 @@ instance AE.FromJSON ConfigRepresentation where <$> obj .: "TraceOptions" <*> obj .:? "TraceOptionForwarder" <*> obj .:? "TraceOptionNodeName" + <*> obj .:? "TraceOptionMetricsPrefix" <*> obj .:? "TraceOptionPeerFrequency" <*> obj .:? "TraceOptionResourceFrequency" parseJSON _ = mempty @@ -51,6 +53,7 @@ instance AE.ToJSON ConfigRepresentation where [ "TraceOptions" .= traceOptions , "TraceOptionForwarder" .= traceOptionForwarder , "TraceOptionNodeName" .= traceOptionNodeName + , "TraceOptionMetricsPrefix" .= traceOptionMetricsPrefix , "TraceOptionPeerFrequency" .= traceOptionPeerFrequency , "TraceOptionResourceFrequency" .= traceOptionResourceFrequency ] @@ -107,6 +110,7 @@ readConfigurationWithDefault fp defaultConf = do else tcOptions defaultConf) (tcForwarder fileConf <|> tcForwarder defaultConf) (tcNodeName fileConf <|> tcNodeName defaultConf) + (tcMetricsPrefix fileConf <|> tcMetricsPrefix defaultConf) (tcPeerFrequency fileConf <|> tcPeerFrequency defaultConf) (tcResourceFrequency fileConf <|> tcResourceFrequency defaultConf) @@ -138,6 +142,7 @@ parseRepresentation bs = transform (decodeEither' bs) to'' (traceOptionForwarder cr) (traceOptionNodeName cr) + (traceOptionMetricsPrefix cr) (traceOptionPeerFrequency cr) (traceOptionResourceFrequency cr) @@ -158,6 +163,7 @@ configToRepresentation traceConfig = (toOptionRepresentation (tcOptions traceConfig)) (tcForwarder traceConfig) (tcNodeName traceConfig) + (tcMetricsPrefix traceConfig) (tcPeerFrequency traceConfig) (tcResourceFrequency traceConfig) where diff --git a/trace-dispatcher/src/Cardano/Logging/TraceDispatcherMessage.hs b/trace-dispatcher/src/Cardano/Logging/TraceDispatcherMessage.hs index 9376925cfb7..df5556c6505 100644 --- a/trace-dispatcher/src/Cardano/Logging/TraceDispatcherMessage.hs +++ b/trace-dispatcher/src/Cardano/Logging/TraceDispatcherMessage.hs @@ -167,6 +167,11 @@ instance MetaTrace TraceDispatcherMessage where ] <> internalRestriction documentFor _ = Nothing + metricsDocFor (Namespace _ ["StartLimiting"]) = + [("SuppressedMessages...", "Number of suppressed messages of a certain kind")] + metricsDocFor _ = [] + + allNamespaces = [ Namespace [] ["StartLimiting"] , Namespace [] ["StopLimiting"] diff --git a/trace-dispatcher/src/Cardano/Logging/Tracer/EKG.hs b/trace-dispatcher/src/Cardano/Logging/Tracer/EKG.hs index cbc3f88ac92..ba2060e34bf 100644 --- a/trace-dispatcher/src/Cardano/Logging/Tracer/EKG.hs +++ b/trace-dispatcher/src/Cardano/Logging/Tracer/EKG.hs @@ -24,8 +24,8 @@ import System.Remote.Monitoring (Server, getCounter, getGauge, getLabe -- | It is mandatory to construct only one standard tracer in any application! -- Throwing away a standard tracer and using a new one will result in an exception -ekgTracer :: MonadIO m => Either Metrics.Store Server-> m (Trace m FormattedMessage) -ekgTracer storeOrServer = liftIO $ do +ekgTracer :: MonadIO m => TraceConfig -> Either Metrics.Store Server-> m (Trace m FormattedMessage) +ekgTracer config storeOrServer = liftIO $ do rgsGauges <- newMVar Map.empty rgsLabels <- newMVar Map.empty rgsCounters <- newMVar Map.empty @@ -54,22 +54,29 @@ ekgTracer storeOrServer = liftIO $ do -> [Text] -> Metric -> IO () - setIt rgsGauges _rgsLabels _rgsCounters _namespace - (IntM name theInt) = do - gauge <- modifyMVar rgsGauges (setFunc Metrics.createGauge getGauge name) - Gauge.set gauge (fromIntegral theInt) - setIt _rgsGauges rgsLabels _rgsCounters _namespace - (DoubleM name theDouble) = do - label <- modifyMVar rgsLabels (setFunc Metrics.createLabel getLabel name) + setIt rgsGauges _rgsLabels _rgsCounters _namespace (IntM name theInt) = do + let fullName = case tcMetricsPrefix config of + Just prefix -> prefix <> name <> "_int" + Nothing -> name <> "_int" + gauge <- modifyMVar rgsGauges (setFunc Metrics.createGauge getGauge fullName) + Gauge.set gauge (fromIntegral theInt) + setIt _rgsGauges rgsLabels _rgsCounters _namespace (DoubleM name theDouble) = do + let fullName = case tcMetricsPrefix config of + Just prefix -> prefix <> name <> "_real" + Nothing -> name <> "_real" + label <- modifyMVar rgsLabels (setFunc Metrics.createLabel getLabel fullName) Label.set label ((pack . show) theDouble) - setIt _rgsGauges rgsLabels _rgsCounters _namespace - (PrometheusM name keyLabels) = do - label <- modifyMVar rgsLabels (setFunc Metrics.createLabel getLabel name) + setIt _rgsGauges rgsLabels _rgsCounters _namespace (PrometheusM name keyLabels) = do + let fullName = case tcMetricsPrefix config of + Just prefix -> prefix <> name + Nothing -> name + label <- modifyMVar rgsLabels (setFunc Metrics.createLabel getLabel fullName) Label.set label (presentPrometheusM keyLabels) - - setIt _rgsGauges _rgsLabels rgsCounters _namespace - (CounterM name mbInt) = do - counter <- modifyMVar rgsCounters (setFunc Metrics.createCounter getCounter name) + setIt _rgsGauges _rgsLabels rgsCounters _namespace (CounterM name mbInt) = do + let fullName = case tcMetricsPrefix config of + Just prefix -> prefix <> name <> "_counter" + Nothing -> name <> "_counter" + counter <- modifyMVar rgsCounters (setFunc Metrics.createCounter getCounter fullName) case mbInt of Nothing -> Counter.inc counter Just i -> Counter.add counter (fromIntegral i) diff --git a/trace-dispatcher/src/Cardano/Logging/Types.hs b/trace-dispatcher/src/Cardano/Logging/Types.hs index 3c722c0e95e..e2c21afe5ea 100644 --- a/trace-dispatcher/src/Cardano/Logging/Types.hs +++ b/trace-dispatcher/src/Cardano/Logging/Types.hs @@ -474,6 +474,8 @@ data TraceConfig = TraceConfig { , tcForwarder :: Maybe TraceOptionForwarder -- | Optional human-readable name of the node. , tcNodeName :: Maybe Text + -- | Optional prefix for metrics. + , tcMetricsPrefix :: Maybe Text -- | Optional peer trace frequency in milliseconds. , tcPeerFrequency :: Maybe Int -- | Optional resource trace frequency in milliseconds. @@ -487,6 +489,7 @@ emptyTraceConfig = TraceConfig { tcOptions = Map.empty , tcForwarder = Nothing , tcNodeName = Nothing + , tcMetricsPrefix = Nothing , tcPeerFrequency = Just 2000 -- Every 2 seconds , tcResourceFrequency = Just 5000 -- Every five seconds } diff --git a/trace-dispatcher/test/Cardano/Logging/Test/Unit/Configuration.hs b/trace-dispatcher/test/Cardano/Logging/Test/Unit/Configuration.hs index 11a1ce08b97..d07e8d93090 100644 --- a/trace-dispatcher/test/Cardano/Logging/Test/Unit/Configuration.hs +++ b/trace-dispatcher/test/Cardano/Logging/Test/Unit/Configuration.hs @@ -59,6 +59,7 @@ config1 = TraceConfig { , tcNodeName = Nothing , tcPeerFrequency = Nothing , tcResourceFrequency = Nothing + , tcMetricsPrefix = Nothing } config2 :: TraceConfig @@ -76,6 +77,7 @@ config2 = TraceConfig { , tcNodeName = Just "node-1" , tcPeerFrequency = Nothing , tcResourceFrequency = Nothing + , tcMetricsPrefix = Nothing } testConfig' :: diff --git a/trace-dispatcher/test/Cardano/Logging/Test/Unit/Documentation.hs b/trace-dispatcher/test/Cardano/Logging/Test/Unit/Documentation.hs index 72f816d59ef..f8196d5fd58 100644 --- a/trace-dispatcher/test/Cardano/Logging/Test/Unit/Documentation.hs +++ b/trace-dispatcher/test/Cardano/Logging/Test/Unit/Documentation.hs @@ -42,5 +42,6 @@ config1 = TraceConfig { , tcNodeName = Nothing , tcPeerFrequency = Nothing , tcResourceFrequency = Nothing + , tcMetricsPrefix = Just "cardano" } diff --git a/trace-dispatcher/test/Cardano/Logging/Test/Unit/EKG.hs b/trace-dispatcher/test/Cardano/Logging/Test/Unit/EKG.hs index 7d005af1e50..c03a0e03ecd 100644 --- a/trace-dispatcher/test/Cardano/Logging/Test/Unit/EKG.hs +++ b/trace-dispatcher/test/Cardano/Logging/Test/Unit/EKG.hs @@ -35,7 +35,7 @@ instance MetaTrace Measure where testEKG :: IO Int testEKG = do store <- newStore - tracer <- ekgTracer (Left store) + tracer <- ekgTracer emptyTraceConfig (Left store) let formattedTracer = metricsFormatter tracer confState <- emptyConfigReflection configureTracers confState emptyTraceConfig [formattedTracer] From 0d34651aaa55a3b014830ecbb89eab0195aa8be9 Mon Sep 17 00:00:00 2001 From: Yupanqui Date: Thu, 20 Jun 2024 16:09:10 +0200 Subject: [PATCH 2/7] cardano-node: rename metrics ChainDB Consensus --- cardano-node/src/Cardano/Node/Tracing/API.hs | 4 +- .../src/Cardano/Node/Tracing/Documentation.hs | 11 +- .../Tracing/Tracers/BlockReplayProgress.hs | 4 +- .../Cardano/Node/Tracing/Tracers/ChainDB.hs | 40 +-- .../Cardano/Node/Tracing/Tracers/Consensus.hs | 178 ++++++------ .../Tracing/Tracers/ForgingThreadStats.hs | 46 +-- .../Cardano/Node/Tracing/Tracers/KESInfo.hs | 16 +- .../src/Cardano/Node/Tracing/Tracers/P2P.hs | 271 +++++++++++------- .../src/Cardano/Node/Tracing/Tracers/Peer.hs | 4 +- .../Cardano/Node/Tracing/Tracers/Startup.hs | 4 + 10 files changed, 319 insertions(+), 259 deletions(-) diff --git a/cardano-node/src/Cardano/Node/Tracing/API.hs b/cardano-node/src/Cardano/Node/Tracing/API.hs index b7859b1c26c..cf8f182411b 100644 --- a/cardano-node/src/Cardano/Node/Tracing/API.hs +++ b/cardano-node/src/Cardano/Node/Tracing/API.hs @@ -82,7 +82,7 @@ initTraceDispatcher nc p networkMagic nodeKernel p2pMode = do mkTracers trConfig = do ekgStore <- EKG.newStore EKG.registerGcMetrics ekgStore - ekgTrace <- ekgTracer (Left ekgStore) + ekgTrace <- ekgTracer trConfig (Left ekgStore) stdoutTrace <- standardTracer @@ -113,7 +113,7 @@ initTraceDispatcher nc p networkMagic nodeKernel p2pMode = do p where forwarderBackendEnabled = - any checkForwarder . concat . Map.elems $ tcOptions trConfig + (any (any checkForwarder) . Map.elems) $ tcOptions trConfig checkForwarder (ConfBackend backends') = Forwarder `elem` backends' checkForwarder _ = False diff --git a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs index 676b8d021a9..903b6114e05 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs @@ -36,7 +36,6 @@ import Cardano.Node.Tracing.Tracers.KESInfo () import Cardano.Node.Tracing.Tracers.NodeToClient () import Cardano.Node.Tracing.Tracers.NodeToNode () import Cardano.Node.Tracing.Tracers.NodeVersion (NodeVersionTrace) - import Cardano.Node.Tracing.Tracers.NonP2P () import Cardano.Node.Tracing.Tracers.P2P () import Cardano.Node.Tracing.Tracers.Peer @@ -104,6 +103,8 @@ import GHC.Generics (Generic) import Network.Mux (MuxTrace (..), WithMuxBearer (..)) import qualified Network.Socket as Socket import qualified Options.Applicative as Opt +import System.IO + data TraceDocumentationCmd = TraceDocumentationCmd @@ -764,6 +765,8 @@ docTracersSecondPhase :: -> DocTracer -> IO () docTracersSecondPhase outputFileName trConfig bl = do - res <- docuResultsToText bl trConfig - T.writeFile outputFileName res - pure () + content <- docuResultsToText bl trConfig + handle <- openFile outputFileName WriteMode + hSetEncoding handle utf8 + T.hPutStr handle content + hClose handle diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/BlockReplayProgress.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/BlockReplayProgress.hs index 5365bc19793..61f2850a1e9 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/BlockReplayProgress.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/BlockReplayProgress.hs @@ -39,7 +39,7 @@ instance LogFormatting ReplayBlockStats where ] forHuman ReplayBlockStats {..} = "Block replay progress " <> textShow rpsProgress <> "%" asMetrics ReplayBlockStats {..} = - [DoubleM "ChainDB.BlockReplayProgress" rpsProgress] + [DoubleM "blockReplayProgress" rpsProgress] instance MetaTrace ReplayBlockStats where namespaceFor ReplayBlockStats {} = Namespace [] ["LedgerReplay"] @@ -52,7 +52,7 @@ instance MetaTrace ReplayBlockStats where documentFor _ = Nothing metricsDocFor (Namespace _ ["LedgerReplay"]) = - [("ChainDB.BlockReplayProgress", "Progress in percent")] + [("blockReplayProgress", "Progress in percent")] metricsDocFor _ = [] allNamespaces = diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs index 46af0cf6250..b5dc5a5f129 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs @@ -525,20 +525,20 @@ instance ( LogFormatting (Header blk) asMetrics (ChainDB.SwitchedToAFork _warnings selChangedInfo _oldChain newChain) = let ChainInformation { slots, blocks, density, epoch, slotInEpoch } = chainInformation selChangedInfo newChain 0 - in [ DoubleM "ChainDB.Density" (fromRational density) - , IntM "ChainDB.SlotNum" (fromIntegral slots) - , IntM "ChainDB.BlockNum" (fromIntegral blocks) - , IntM "ChainDB.SlotInEpoch" (fromIntegral slotInEpoch) - , IntM "ChainDB.Epoch" (fromIntegral (unEpochNo epoch)) + in [ DoubleM "density" (fromRational density) + , IntM "slotNum" (fromIntegral slots) + , IntM "blockNum" (fromIntegral blocks) + , IntM "slotInEpoch" (fromIntegral slotInEpoch) + , IntM "epoch" (fromIntegral (unEpochNo epoch)) ] asMetrics (ChainDB.AddedToCurrentChain _warnings selChangedInfo _oldChain newChain) = let ChainInformation { slots, blocks, density, epoch, slotInEpoch } = chainInformation selChangedInfo newChain 0 - in [ DoubleM "ChainDB.Density" (fromRational density) - , IntM "ChainDB.SlotNum" (fromIntegral slots) - , IntM "ChainDB.BlockNum" (fromIntegral blocks) - , IntM "ChainDB.SlotInEpoch" (fromIntegral slotInEpoch) - , IntM "ChainDB.Epoch" (fromIntegral (unEpochNo epoch)) + in [ DoubleM "density" (fromRational density) + , IntM "slotNum" (fromIntegral slots) + , IntM "blockNum" (fromIntegral blocks) + , IntM "slotInEpoch" (fromIntegral slotInEpoch) + , IntM "epoch" (fromIntegral (unEpochNo epoch)) ] asMetrics _ = [] @@ -638,48 +638,48 @@ instance MetaTrace (ChainDB.TraceAddBlockEvent blk) where detailsFor _ _ = Just DNormal metricsDocFor (Namespace _ ["SwitchedToAFork"]) = - [ ( "ChainDB.Density" + [ ( "density" , mconcat [ "The actual number of blocks created over the maximum expected number" , " of blocks that could be created over the span of the last @k@ blocks." ] ) - , ( "ChainDB.SlotNum" + , ( "slotNum" , "Number of slots in this chain fragment." ) - , ( "ChainDB.Blocks" + , ( "blockNum" , "Number of blocks in this chain fragment." ) - , ( "ChainDB.SlotInEpoch" + , ( "slotInEpoch" , mconcat [ "Relative slot number of the tip of the current chain within the" , " epoch.." ] ) - , ( "ChainDB.Epoch" + , ( "epoch" , "In which epoch is the tip of the current chain." ) ] metricsDocFor (Namespace _ ["AddedToCurrentChain"]) = - [ ( "ChainDB.Density" + [ ( "density" , mconcat [ "The actual number of blocks created over the maximum expected number" , " of blocks that could be created over the span of the last @k@ blocks." ] ) - , ( "ChainDB.SlotNum" + , ( "slotNum" , "Number of slots in this chain fragment." ) - , ( "ChainDB.Blocks" + , ( "blockNum" , "Number of blocks in this chain fragment." ) - , ( "ChainDB.SlotInEpoch" + , ( "slotInEpoch" , mconcat [ "Relative slot number of the tip of the current chain within the" , " epoch.." ] ) - , ( "ChainDB.Epoch" + , ( "epoch" , "In which epoch is the tip of the current chain." ) ] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs index a813658db6b..27ca806f916 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs @@ -463,7 +463,9 @@ instance ConvertRawHash blk <> [ "risingEdge" .= True | RisingEdge <- [enclosing] ] asMetrics (TraceChainSyncServerUpdate _tip (AddBlock _pt) _blocking FallingEdge) = - [CounterM "ChainSync.HeadersServed.Falling" Nothing] + [CounterM "headersServed.falling" Nothing] + asMetrics (TraceChainSyncServerUpdate _tip (AddBlock _pt) _blocking _) = + [CounterM "headersServed" Nothing] asMetrics _ = [] instance MetaTrace (TraceChainSyncServerEvent blk) where @@ -478,8 +480,8 @@ instance MetaTrace (TraceChainSyncServerEvent blk) where severityFor _ _ = Nothing metricsDocFor (Namespace _ ["Update"]) = - [ ("ChainSync.HeadersServed", "A counter triggered on any header event") - , ("ChainSync.HeadersServed.Falling", + [ ("headersServed", "A counter triggered on any header event") + , ("headersServed.falling", "A counter triggered only on header event with falling edge")] metricsDocFor _ = [] @@ -527,22 +529,20 @@ instance LogFormatting ClientMetrics where then let size = Pq.size cmSlotMap msgs = - [ DoubleM - "Blockfetch.Client.Blockdelay" + [ DoubleM "blockfetchclient.blockdelay" cmDelay - , IntM - "Blockfetch.Client.Blocksize" + , IntM "blockfetchclient.blocksize" (fromIntegral cmBlockSize) - , DoubleM "Blockfetch.Client.Blockdelay.cdfOne" + , DoubleM "blockfetchclient.blockdelay.cdfOne" (fromIntegral (counter cmCdf1sVar) / fromIntegral size) - , DoubleM "Blockfetch.Client.Blockdelay.cdfThree" + , DoubleM "blockfetchclient.blockdelay.cdfThree" (fromIntegral (counter cmCdf3sVar) / fromIntegral size) - , DoubleM "Blockfetch.Client.Blockdelay.cdfFive" + , DoubleM "blockfetchclient.blockdelay.cdfFive" (fromIntegral (counter cmCdf5sVar) / fromIntegral size) ] in if cmDelay > 5 then - CounterM "Blockfetch.Client.Lateblocks" Nothing + CounterM "blockfetchclient.lateblocks" Nothing : msgs else msgs else [] @@ -553,10 +553,12 @@ instance MetaTrace ClientMetrics where documentFor _ = Just "" metricsDocFor (Namespace _ ["ClientMetrics"]) = - [ ("Blockfetch.Client.Blockdelay", "") - , ("Blockfetch.Client.Blockdelay.cdfOne", "") - , ("Blockfetch.Client.Blockdelay.cdfThree", "") - , ("Blockfetch.Client.Blockdelay.cdfFive", "") + [ ("blockfetchclient.blockdelay", "") + , ("blockfetchclient.blocksize", "") + , ("blockfetchclient.lateblocks", "") + , ("blockfetchclient.blockdelay.cdfOne", "") + , ("blockfetchclient.blockdelay.cdfThree", "") + , ("blockfetchclient.blockdelay.cdfFive", "") ] metricsDocFor _ = [] @@ -650,7 +652,7 @@ instance (LogFormatting peer, Show peer) => , "peers" .= toJSON (List.foldl' (\acc x -> forMachine DDetailed x : acc) [] xs) ] - asMetrics peers = [IntM "BlockFetch.ConnectedPeers" (fromIntegral (length peers))] + asMetrics peers = [IntM "connectedPeers" (fromIntegral (length peers))] instance MetaTrace [TraceLabelPeer peer (FetchDecision [Point header])] where namespaceFor (a : _tl) = (nsCast . namespaceFor) a @@ -703,9 +705,9 @@ instance MetaTrace (FetchDecision [Point header]) where severityFor _ _ = Nothing metricsDocFor (Namespace _ ["Decline"]) = - [("Blockfetch.ConnectedPeers", "Number of connected peers")] + [("connectedPeers", "Number of connected peers")] metricsDocFor (Namespace _ ["Accept"]) = - [("Blockfetch.ConnectedPeers", "Number of connected peers")] + [("connectedPeers", "Number of connected peers")] metricsDocFor _ = [] documentFor _ = Just $ mconcat @@ -847,7 +849,7 @@ instance ConvertRawHash blk => LogFormatting (TraceBlockFetchServerEvent blk) wh (renderHeaderHash (Proxy @blk)) $ pointHash blk)] asMetrics (TraceBlockFetchServerSendBlock _p) = - [CounterM "BlockFetch.BlocksServed" Nothing] + [CounterM "served.block" Nothing] instance MetaTrace (TraceBlockFetchServerEvent blk) where namespaceFor TraceBlockFetchServerSendBlock {} = @@ -858,7 +860,7 @@ instance MetaTrace (TraceBlockFetchServerEvent blk) where severityFor _ _ = Nothing metricsDocFor (Namespace [] ["SendBlock"]) = - [("Blockfetch.BlocksServed", "")] + [("served.block", "")] metricsDocFor _ = [] documentFor (Namespace [] ["SendBlock"]) = Just @@ -899,11 +901,11 @@ instance LogFormatting (TraceTxSubmissionInbound txid tx) where ] asMetrics (TraceTxSubmissionCollected count)= - [CounterM "TxSubmission.Submitted" (Just count)] + [CounterM "submissions.submitted" (Just count)] asMetrics (TraceTxSubmissionProcessed processed) = - [ CounterM "TxSubmission.Accepted" + [ CounterM "submissions.accepted" (Just (ptxcAccepted processed)) - , CounterM "TxSubmission.Rejected" + , CounterM "submissions.rejected" (Just (ptxcRejected processed)) ] asMetrics _ = [] @@ -923,10 +925,10 @@ instance MetaTrace (TraceTxSubmissionInbound txid tx) where severityFor _ _ = Nothing metricsDocFor (Namespace _ ["Collected"]) = - [ ("TxSubmission.Submitted", "")] + [ ("submissions.submitted", "")] metricsDocFor (Namespace _ ["Processed"]) = - [ ("TxSubmission.Accepted", "") - , ("TxSubmission.Rejected", "") + [ ("submissions.accepted", "") + , ("submissions.rejected", "") ] metricsDocFor _ = [] @@ -1092,25 +1094,25 @@ instance ] asMetrics (TraceMempoolAddedTx _tx _mpSzBefore mpSz) = - [ IntM "Mempool.TxsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "Mempool.MempoolBytes" (fromIntegral $ msNumBytes mpSz) + [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) + , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) ] asMetrics (TraceMempoolRejectedTx _tx _txApplyErr mpSz) = - [ IntM "Mempool.TxsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "Mempool.MempoolBytes" (fromIntegral $ msNumBytes mpSz) + [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) + , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) ] asMetrics (TraceMempoolRemoveTxs _txs mpSz) = - [ IntM "Mempool.TxsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "Mempool.MempoolBytes" (fromIntegral $ msNumBytes mpSz) + [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) + , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) ] asMetrics (TraceMempoolManuallyRemovedTxs [] _txs1 mpSz) = - [ IntM "Mempool.TxsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "Mempool.MempoolBytes" (fromIntegral $ msNumBytes mpSz) + [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) + , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) ] asMetrics (TraceMempoolManuallyRemovedTxs txs _txs1 mpSz) = - [ IntM "Mempool.TxsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "Mempool.MempoolBytes" (fromIntegral $ msNumBytes mpSz) - , CounterM "Mempool.TxsProcessedNum" (Just (fromIntegral $ length txs)) + [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) + , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) + , CounterM "txsProcessedNum" (Just (fromIntegral $ length txs)) ] instance LogFormatting MempoolSize where @@ -1134,21 +1136,21 @@ instance MetaTrace (TraceEventMempool blk) where severityFor _ _ = Nothing metricsDocFor (Namespace _ ["AddedTx"]) = - [ ("Mempool.TxsInMempool","Transactions in mempool") - , ("Mempool.MempoolBytes", "Byte size of the mempool") + [ ("txsInMempool","Transactions in mempool") + , ("mempoolBytes", "Byte size of the mempool") ] metricsDocFor (Namespace _ ["RejectedTx"]) = - [ ("Mempool.TxsInMempool","Transactions in mempool") - , ("Mempool.MempoolBytes", "Byte size of the mempool") + [ ("txsInMempool","Transactions in mempool") + , ("mempoolBytes", "Byte size of the mempool") ] metricsDocFor (Namespace _ ["RemoveTxs"]) = - [ ("Mempool.TxsInMempool","Transactions in mempool") - , ("Mempool.MempoolBytes", "Byte size of the mempool") + [ ("txsInMempool","Transactions in mempool") + , ("mempoolBytes", "Byte size of the mempool") ] metricsDocFor (Namespace _ ["ManuallyRemovedTxs"]) = - [ ("Mempool.TxsInMempool","Transactions in mempool") - , ("Mempool.MempoolBytes", "Byte size of the mempool") - , ("Mempool.TxsProcessedNum", "") + [ ("txsInMempool","Transactions in mempool") + , ("mempoolBytes", "Byte size of the mempool") + , ("txsProcessedNum", "") ] metricsDocFor _ = [] @@ -1266,8 +1268,8 @@ instance LogFormatting TraceStartLeadershipCheckPlus where <> " delegMapSize " <> showT tsDelegMapSize <> " chainDensity " <> showT tsChainDensity asMetrics TraceStartLeadershipCheckPlus {..} = - [IntM "Forge.UtxoSize" (fromIntegral tsUtxoSize), - IntM "Forge.DelegMapSize" (fromIntegral tsDelegMapSize)] + [IntM "utxoSize" (fromIntegral tsUtxoSize), + IntM "delegMapSize" (fromIntegral tsDelegMapSize)] -------------------------------------------------------------------------------- @@ -1506,54 +1508,54 @@ instance ( tx ~ GenTx blk Nothing -> [] Just kesInfo -> [ IntM - "Forge.OperationalCertificateStartKESPeriod" + "operationalCertificateStartKESPeriod" (fromIntegral . unKESPeriod . HotKey.kesStartPeriod $ kesInfo) , IntM - "Forge.OperationalCertificateExpiryKESPeriod" + "operationalCertificateExpiryKESPeriod" (fromIntegral . unKESPeriod . HotKey.kesEndPeriod $ kesInfo) , IntM - "Forge.CurrentKESPeriod" + "currentKESPeriod" 0 , IntM - "Forge.RemainingKESPeriods" + "remainingKESPeriods" 0 ]) asMetrics (TraceStartLeadershipCheck slot) = - [IntM "Forge.AboutToLeadSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "aboutToLeadSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceSlotIsImmutable slot _tipPoint _tipBlkNo) = - [IntM "Forge.SlotIsImmutable" (fromIntegral $ unSlotNo slot)] + [IntM "slotIsImmutable" (fromIntegral $ unSlotNo slot)] asMetrics (TraceBlockFromFuture slot _slotNo) = - [IntM "Forge.BlockFromFuture" (fromIntegral $ unSlotNo slot)] + [IntM "blockFromFuture" (fromIntegral $ unSlotNo slot)] asMetrics (TraceBlockContext slot _tipBlkNo _tipPoint) = - [IntM "Forge.BlockContext" (fromIntegral $ unSlotNo slot)] + [IntM "blockContext" (fromIntegral $ unSlotNo slot)] asMetrics (TraceNoLedgerState slot _) = - [IntM "Forge.CouldNotForgeSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "couldNotForgeSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceLedgerState slot _) = - [IntM "Forge.LedgerState" (fromIntegral $ unSlotNo slot)] + [IntM "ledgerState" (fromIntegral $ unSlotNo slot)] asMetrics (TraceNoLedgerView slot _) = - [IntM "Forge.CouldNotForgeSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "couldNotForgeSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceLedgerView slot) = - [IntM "Forge.LedgerView" (fromIntegral $ unSlotNo slot)] + [IntM "ledgerView" (fromIntegral $ unSlotNo slot)] -- see above asMetrics (TraceNodeCannotForge slot _reason) = - [IntM "Forge.NodeCannotForge" (fromIntegral $ unSlotNo slot)] + [IntM "nodeCannotForge" (fromIntegral $ unSlotNo slot)] asMetrics (TraceNodeNotLeader slot) = - [IntM "Forge.NodeNotLeader" (fromIntegral $ unSlotNo slot)] + [IntM "nodeNotLeader" (fromIntegral $ unSlotNo slot)] asMetrics (TraceNodeIsLeader slot) = - [IntM "Forge.NodeIsLeader" (fromIntegral $ unSlotNo slot)] + [IntM "nodeIsLeader" (fromIntegral $ unSlotNo slot)] asMetrics TraceForgeTickedLedgerState {} = [] asMetrics TraceForgingMempoolSnapshot {} = [] asMetrics (TraceForgedBlock slot _ _ _) = - [IntM "Forge.ForgedSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "forgedSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceDidntAdoptBlock slot _) = - [IntM "Forge.NotAdoptedSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "notAdoptedSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceForgedInvalidBlock slot _ _) = - [IntM "Forge.ForgedInvalidSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "forgedInvalidSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceAdoptedBlock slot _ _) = - [IntM "Forge.AdoptedOwnBlockSlotLast" (fromIntegral $ unSlotNo slot)] + [IntM "adoptedOwnBlockSlotLast" (fromIntegral $ unSlotNo slot)] asMetrics (TraceAdoptionThreadDied slot _) = - [IntM "Forge.AdoptionThreadDied" (fromIntegral $ unSlotNo slot)] + [IntM "adoptionThreadDied" (fromIntegral $ unSlotNo slot)] instance MetaTrace (TraceForgeEvent blk) where namespaceFor TraceStartLeadershipCheck {} = @@ -1617,45 +1619,45 @@ instance MetaTrace (TraceForgeEvent blk) where severityFor _ _ = Nothing metricsDocFor (Namespace _ ["StartLeadershipCheck"]) = - [("Forge.AboutToLeadSlotLast", "")] + [("aboutToLeadSlotLast", "")] metricsDocFor (Namespace _ ["SlotIsImmutable"]) = - [("Forge.SlotIsImmutable", "")] + [("slotIsImmutable", "")] metricsDocFor (Namespace _ ["BlockFromFuture"]) = - [("Forge.BlockFromFuture", "")] + [("blockFromFuture", "")] metricsDocFor (Namespace _ ["BlockContext"]) = - [("Forge.BlockContext", "")] + [("blockContext", "")] metricsDocFor (Namespace _ ["NoLedgerState"]) = - [("Forge.CouldNotForgeSlotLast", "")] + [("couldNotForgeSlotLast", "")] metricsDocFor (Namespace _ ["LedgerState"]) = - [("Forge.LedgerState", "")] + [("ledgerState", "")] metricsDocFor (Namespace _ ["NoLedgerView"]) = - [("Forge.CouldNotForgeSlotLast", "")] + [("couldNotForgeSlotLast", "")] metricsDocFor (Namespace _ ["LedgerView"]) = - [("Forge.LedgerView", "")] + [("ledgerView", "")] metricsDocFor (Namespace _ ["ForgeStateUpdateError"]) = - [ ("Forge.OperationalCertificateStartKESPeriod", "") - , ("Forge.OperationalCertificateExpiryKESPeriod", "") - , ("Forge.CurrentKESPeriod", "") - , ("Forge.RemainingKESPeriods", "") + [ ("operationalCertificateStartKESPeriod", "") + , ("operationalCertificateExpiryKESPeriod", "") + , ("currentKESPeriod", "") + , ("remainingKESPeriods", "") ] metricsDocFor (Namespace _ ["NodeCannotForge"]) = - [("Forge.NodeCannotForge", "")] + [("nodeCannotForge", "")] metricsDocFor (Namespace _ ["NodeNotLeader"]) = - [("Forge.NodeNotLeader", "")] + [("nodeNotLeader", "")] metricsDocFor (Namespace _ ["NodeIsLeader"]) = - [("Forge.NodeIsLeader", "")] + [("nodeIsLeader", "")] metricsDocFor (Namespace _ ["ForgeTickedLedgerState"]) = [] metricsDocFor (Namespace _ ["ForgingMempoolSnapshot"]) = [] metricsDocFor (Namespace _ ["ForgedBlock"]) = - [("Forge.ForgedSlotLast", "")] + [("forgedSlotLast", "")] metricsDocFor (Namespace _ ["DidntAdoptBlock"]) = - [("Forge.NotAdoptedSlotLast", "")] + [("notAdoptedSlotLast", "")] metricsDocFor (Namespace _ ["ForgedInvalidBlock"]) = - [("Forge.ForgedInvalidSlotLast", "")] + [("forgedInvalidSlotLast", "")] metricsDocFor (Namespace _ ["AdoptedBlock"]) = - [("Forge.AdoptedOwnBlockSlotLast", "")] + [("adoptedOwnBlockSlotLast", "")] metricsDocFor (Namespace _ ["AdoptionThreadDied"]) = - [("Forge.AdoptionThreadDied", "")] + [("adoptionThreadDied", "")] metricsDocFor _ = [] documentFor (Namespace _ ["StartLeadershipCheck"]) = Just diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs index d6b38e92b61..549059190d8 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs @@ -52,17 +52,17 @@ instance LogFormatting ForgeThreadStats where <> " last slot " <> showT ftsLastSlot forMachine _dtal ForgeThreadStats {..} = mconcat [ "kind" .= String "ForgeThreadStats" - , "nodeCannotForgeNum" .= String (showT ftsNodeCannotForgeNum) - , "nodeIsLeaderNum" .= String (showT ftsNodeIsLeaderNum) - , "blocksForgedNum" .= String (showT ftsBlocksForgedNum) + , "nodeCannotForge" .= String (showT ftsNodeCannotForgeNum) + , "nodeIsLeader" .= String (showT ftsNodeIsLeaderNum) + , "blocksForged" .= String (showT ftsBlocksForgedNum) , "slotsMissed" .= String (showT ftsSlotsMissedNum) , "lastSlot" .= String (showT ftsLastSlot) ] asMetrics ForgeThreadStats {..} = - [ IntM "Forge.NodeCannotForgeNum" (fromIntegral ftsNodeCannotForgeNum) - , IntM "Forge.NodeIsLeaderNum" (fromIntegral ftsNodeIsLeaderNum) - , IntM "Forge.BlocksForgedNum" (fromIntegral ftsBlocksForgedNum) - , IntM "Forge.SlotsMissed" (fromIntegral ftsSlotsMissedNum) + [ IntM "nodeCannotForge" (fromIntegral ftsNodeCannotForgeNum) + , IntM "nodeIsLeader" (fromIntegral ftsNodeIsLeaderNum) + , IntM "blocksForged" (fromIntegral ftsBlocksForgedNum) + , IntM "slotsMissed" (fromIntegral ftsSlotsMissedNum) ] instance MetaTrace ForgeThreadStats where @@ -73,13 +73,13 @@ instance MetaTrace ForgeThreadStats where documentFor _ = Just "" metricsDocFor _ = - [("Forge.NodeCannotForgeNum", + [("nodeCannotForge", "How many times was this node unable to forge [a block]?") - ,("Forge.NodeIsLeaderNum", + ,("nodeIsLeader", "How many times was this node slot leader?") - ,("Forge.BlocksForgedNum", + ,("blocksForged", "How many blocks did this node forge?") - ,("Forge.SlotsMissed", + ,("lotsMissed", "How many slots did this node miss?") ] @@ -112,16 +112,16 @@ instance LogFormatting ForgingStats where <> " slots missed " <> showT fsSlotsMissedNum forMachine _dtal ForgingStats {..} = mconcat [ "kind" .= String "ForgingStats" - , "nodeCannotForgeNum" .= String (showT fsNodeCannotForgeNum) - , "nodeIsLeaderNum" .= String (showT fsNodeIsLeaderNum) - , "blocksForgedNum" .= String (showT fsBlocksForgedNum) + , "nodeCannotForge" .= String (showT fsNodeCannotForgeNum) + , "nodeIsLeader" .= String (showT fsNodeIsLeaderNum) + , "blocksForged" .= String (showT fsBlocksForgedNum) , "slotsMissed" .= String (showT fsSlotsMissedNum) ] asMetrics ForgingStats {..} = - [ IntM "Forge.NodeCannotForgeNum" (fromIntegral fsNodeCannotForgeNum) - , IntM "Forge.NodeIsLeaderNum" (fromIntegral fsNodeIsLeaderNum) - , IntM "Forge.BlocksForgedNum" (fromIntegral fsBlocksForgedNum) - , IntM "Forge.SlotsMissed" (fromIntegral fsSlotsMissedNum) + [ IntM "nodeCannotForge" (fromIntegral fsNodeCannotForgeNum) + , IntM "nodeIsLeader" (fromIntegral fsNodeIsLeaderNum) + , IntM "blocksForged" (fromIntegral fsBlocksForgedNum) + , IntM "slotsMissed" (fromIntegral fsSlotsMissedNum) ] instance MetaTrace ForgingStats where @@ -136,15 +136,15 @@ instance MetaTrace ForgingStats where \\nslotsMissed shows how many slots were missed in this node." metricsDocFor _ = - [("Forge.NodeCannotForgeNum", + [("nodeCannotForge", "How many times was this node unable to forge [a block]?") - ,("Forge.NodeIsLeaderNum", + ,("nodeIsLeader", "How many times was this node slot leader?") - ,("Forge.BlocksForgedNum", + ,("blocksForged", "How many blocks did this node forge?") - ,("Forge.SlotsMissed", + ,("slotsMissed", "How many slots did this node miss?") - ,("Forge.LastSlot", + ,("lastSlot", "") ] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs index 9dd2f497e91..e75b07cd37e 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs @@ -108,13 +108,13 @@ instance LogFormatting HotKey.KESInfo where let maxKesEvos = endKesPeriod - startKesPeriod oCertExpiryKesPeriod = startKesPeriod + maxKesEvos in [ - IntM "KESInfo.operationalCertificateStartKESPeriod" + IntM "operationalCertificateStartKESPeriod" (fromIntegral startKesPeriod) - , IntM "KESInfo.operationalCertificateExpiryKESPeriod" + , IntM "operationalCertificateExpiryKESPeriod" (fromIntegral (startKesPeriod + maxKesEvos)) - , IntM "KESInfo.currentKESPeriod" + , IntM "currentKESPeriod" (fromIntegral currKesPeriod) - , IntM "KESInfo.remainingKESPeriods" + , IntM "remainingKESPeriods" (fromIntegral (max 0 (oCertExpiryKesPeriod - currKesPeriod))) ] where @@ -154,10 +154,10 @@ instance MetaTrace HotKey.KESInfo where documentFor _ = Nothing metricsDocFor (Namespace _ ["StateInfo"]) = - [ ("KESInfo.operationalCertificateStartKESPeriod", "") - , ("KESInfo.operationalCertificateExpiryKESPeriod", "") - , ("KESInfo.currentKESPeriod", "") - , ("KESInfo.remainingKESPeriods", "")] + [ ("operationalCertificateStartKESPeriod", "") + , ("operationalCertificateExpiryKESPeriod", "") + , ("currentKESPeriod", "") + , ("remainingKESPeriods", "")] metricsDocFor _ = [] allNamespaces = [Namespace [] ["StateInfo"]] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs index 4b536288e3f..316c9122369 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -34,9 +34,8 @@ import qualified Ouroboros.Network.InboundGovernor as InboundGovernor import Ouroboros.Network.InboundGovernor.State (InboundGovernorCounters (..)) import qualified Ouroboros.Network.NodeToNode as NtN import Ouroboros.Network.PeerSelection.Governor (ChurnCounters (..), - DebugPeerSelection (..), DebugPeerSelectionState (..), - PeerSelectionCounters , PeerSelectionView (..), - PeerSelectionState (..), PeerSelectionTargets (..), + DebugPeerSelection (..), DebugPeerSelectionState (..), PeerSelectionCounters, + PeerSelectionState (..), PeerSelectionTargets (..), PeerSelectionView (..), TracePeerSelection (..), peerSelectionStateToCounters) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) import Ouroboros.Network.PeerSelection.RelayAccessPoint (RelayAccessPoint) @@ -559,7 +558,7 @@ instance LogFormatting (TracePeerSelection SockAddr) where forHuman = pack . show asMetrics (TraceChurnAction duration action _) = - [ DoubleM ("Net.PeerSelection.Churn." <> pack (show action) <> ".duration") + [ DoubleM ("peerSelection.churn" <> pack (show action) <> ".duration") (realToFrac duration) ] asMetrics _ = [] @@ -774,6 +773,11 @@ instance MetaTrace (TracePeerSelection SockAddr) where "peer selection internal state" documentFor _ = Nothing + metricsDocFor (Namespace [] ["ChurnAction"]) = + [ ("peerSelection.churn", "Duration of a churn action") + ] + metricsDocFor _ = [] + allNamespaces = [ Namespace [] ["LocalRootPeersChanged"] , Namespace [] ["TargetsChanged"] @@ -917,74 +921,75 @@ instance LogFormatting PeerSelectionCounters where PeerSelectionCountersHWC {..} -> -- Deprecated metrics; they will be removed in a future version. [ IntM - "Net.PeerSelection.Cold" + "peerSelection.cold" (fromIntegral numberOfColdPeers) , IntM - "Net.PeerSelection.Warm" + "peerSelection.warm" (fromIntegral numberOfWarmPeers) , IntM - "Net.PeerSelection.Hot" + "peerSelection.hot" (fromIntegral numberOfHotPeers) , IntM - "Net.PeerSelection.ColdBigLedgerPeers" + "peerSelection.coldBigLedgerPeers" (fromIntegral numberOfColdBigLedgerPeers) , IntM - "Net.PeerSelection.WarmBigLedgerPeers" + "peerSelection.warmBigLedgerPeers" (fromIntegral numberOfWarmBigLedgerPeers) , IntM - "Net.PeerSelection.HotBigLedgerPeers" + "peerSelection.hotBigLedgerPeers" (fromIntegral numberOfHotBigLedgerPeers) , IntM - "Net.PeerSelection.WarmLocalRoots" + "peerSelection.warmLocalRoots" (fromIntegral $ numberOfActiveLocalRootPeers psc) , IntM - "Net.PeerSelection.HotLocalRoots" + "peerSelection.hotLocalRoots" (fromIntegral $ numberOfEstablishedLocalRootPeers psc - numberOfActiveLocalRootPeers psc) ] ++ case psc of PeerSelectionCounters {..} -> - [ IntM "Net.PeerSelection.RootPeers" (fromIntegral numberOfRootPeers) - - , IntM "Net.PeerSelection.KnownPeers" (fromIntegral numberOfKnownPeers) - , IntM "Net.PeerSelection.ColdPeersPromotions" (fromIntegral numberOfColdPeersPromotions) - , IntM "Net.PeerSelection.EstablishedPeers" (fromIntegral numberOfEstablishedPeers) - , IntM "Net.PeerSelection.WarmPeersDemotions" (fromIntegral numberOfWarmPeersDemotions) - , IntM "Net.PeerSelection.WarmPeersPromotions" (fromIntegral numberOfWarmPeersPromotions) - , IntM "Net.PeerSelection.ActivePeers" (fromIntegral numberOfActivePeers) - , IntM "Net.PeerSelection.ActivePeersDemotions" (fromIntegral numberOfActivePeersDemotions) - - , IntM "Net.PeerSelection.KnownBigLedgerPeers" (fromIntegral numberOfKnownBigLedgerPeers) - , IntM "Net.PeerSelection.ColdBigLedgerPeersPromotions" (fromIntegral numberOfColdBigLedgerPeersPromotions) - , IntM "Net.PeerSelection.EstablishedBigLedgerPeers" (fromIntegral numberOfEstablishedBigLedgerPeers) - , IntM "Net.PeerSelection.WarmBigLedgerPeersDemotions" (fromIntegral numberOfWarmBigLedgerPeersDemotions) - , IntM "Net.PeerSelection.WarmBigLedgerPeersPromotions" (fromIntegral numberOfWarmBigLedgerPeersPromotions) - , IntM "Net.PeerSelection.ActiveBigLedgerPeers" (fromIntegral numberOfActiveBigLedgerPeers) - , IntM "Net.PeerSelection.ActiveBigLedgerPeersDemotions" (fromIntegral numberOfActiveBigLedgerPeersDemotions) - - , IntM "Net.PeerSelection.KnownLocalRootPeers" (fromIntegral numberOfKnownLocalRootPeers) - , IntM "Net.PeerSelection.EstablishedLocalRootPeers" (fromIntegral numberOfEstablishedLocalRootPeers) - , IntM "Net.PeerSelection.WarmLocalRootPeersPromotions" (fromIntegral numberOfWarmLocalRootPeersPromotions) - , IntM "Net.PeerSelection.ActiveLocalRootPeers" (fromIntegral numberOfActiveLocalRootPeers) - , IntM "Net.PeerSelection.ActiveLocalRootPeersDemotions" (fromIntegral numberOfActiveLocalRootPeersDemotions) - - , IntM "Net.PeerSelection.KnownNonRootPeers" (fromIntegral numberOfKnownNonRootPeers) - , IntM "Net.PeerSelection.ColdNonRootPeersPromotions" (fromIntegral numberOfColdNonRootPeersPromotions) - , IntM "Net.PeerSelection.EstablishedNonRootPeers" (fromIntegral numberOfEstablishedNonRootPeers) - , IntM "Net.PeerSelection.WarmNonRootPeersDemotions" (fromIntegral numberOfWarmNonRootPeersDemotions) - , IntM "Net.PeerSelection.WarmNonRootPeersPromotions" (fromIntegral numberOfWarmNonRootPeersPromotions) - , IntM "Net.PeerSelection.ActiveNonRootPeers" (fromIntegral numberOfActiveNonRootPeers) - , IntM "Net.PeerSelection.ActiveNonRootPeersDemotions" (fromIntegral numberOfActiveNonRootPeersDemotions) - - , IntM "Net.PeerSelection.KnownBootstrapPeers" (fromIntegral numberOfKnownBootstrapPeers) - , IntM "Net.PeerSelection.ColdBootstrapPeersPromotions" (fromIntegral numberOfColdBootstrapPeersPromotions) - , IntM "Net.PeerSelection.EstablishedBootstrapPeers" (fromIntegral numberOfEstablishedBootstrapPeers) - , IntM "Net.PeerSelection.WarmBootstrapPeersDemotions" (fromIntegral numberOfWarmBootstrapPeersDemotions) - , IntM "Net.PeerSelection.WarmBootstrapPeersPromotions" (fromIntegral numberOfWarmBootstrapPeersPromotions) - , IntM "Net.PeerSelection.ActiveBootstrapPeers" (fromIntegral numberOfActiveBootstrapPeers) - , IntM "Net.PeerSelection.ActiveBootstrapPeersDemotions" (fromIntegral numberOfActiveBootstrapPeersDemotions) + [ IntM "peerSelection.RootPeers" (fromIntegral numberOfRootPeers) + + , IntM "peerSelection.KnownPeers" (fromIntegral numberOfKnownPeers) + , IntM "peerSelection.ColdPeersPromotions" (fromIntegral numberOfColdPeersPromotions) + , IntM "peerSelection.EstablishedPeers" (fromIntegral numberOfEstablishedPeers) + , IntM "peerSelection.WarmPeersDemotions" (fromIntegral numberOfWarmPeersDemotions) + , IntM "peerSelection.WarmPeersPromotions" (fromIntegral numberOfWarmPeersPromotions) + , IntM "peerSelection.ActivePeers" (fromIntegral numberOfActivePeers) + , IntM "peerSelection.ActivePeersDemotions" (fromIntegral numberOfActivePeersDemotions) + + , IntM "peerSelection.KnownBigLedgerPeers" (fromIntegral numberOfKnownBigLedgerPeers) + , IntM "peerSelection.ColdBigLedgerPeersPromotions" (fromIntegral numberOfColdBigLedgerPeersPromotions) + , IntM "peerSelection.EstablishedBigLedgerPeers" (fromIntegral numberOfEstablishedBigLedgerPeers) + , IntM "peerSelection.WarmBigLedgerPeersDemotions" (fromIntegral numberOfWarmBigLedgerPeersDemotions) + , IntM "peerSelection.WarmBigLedgerPeersPromotions" (fromIntegral numberOfWarmBigLedgerPeersPromotions) + , IntM "peerSelection.ActiveBigLedgerPeers" (fromIntegral numberOfActiveBigLedgerPeers) + , IntM "peerSelection.ActiveBigLedgerPeersDemotions" (fromIntegral numberOfActiveBigLedgerPeersDemotions) + + , IntM "peerSelection.KnownLocalRootPeers" (fromIntegral numberOfKnownLocalRootPeers) + , IntM "peerSelection.EstablishedLocalRootPeers" (fromIntegral numberOfEstablishedLocalRootPeers) + , IntM "peerSelection.WarmLocalRootPeersPromotions" (fromIntegral numberOfWarmLocalRootPeersPromotions) + , IntM "peerSelection.ActiveLocalRootPeers" (fromIntegral numberOfActiveLocalRootPeers) + , IntM "peerSelection.ActiveLocalRootPeersDemotions" (fromIntegral numberOfActiveLocalRootPeersDemotions) + + + , IntM "peerSelection.KnownNonRootPeers" (fromIntegral numberOfKnownNonRootPeers) + , IntM "peerSelection.ColdNonRootPeersPromotions" (fromIntegral numberOfColdNonRootPeersPromotions) + , IntM "peerSelection.EstablishedNonRootPeers" (fromIntegral numberOfEstablishedNonRootPeers) + , IntM "peerSelection.WarmNonRootPeersDemotions" (fromIntegral numberOfWarmNonRootPeersDemotions) + , IntM "peerSelection.WarmNonRootPeersPromotions" (fromIntegral numberOfWarmNonRootPeersPromotions) + , IntM "peerSelection.ActiveNonRootPeers" (fromIntegral numberOfActiveNonRootPeers) + , IntM "peerSelection.ActiveNonRootPeersDemotions" (fromIntegral numberOfActiveNonRootPeersDemotions) + + , IntM "peerSelection.KnownBootstrapPeers" (fromIntegral numberOfKnownBootstrapPeers) + , IntM "peerSelection.ColdBootstrapPeersPromotions" (fromIntegral numberOfColdBootstrapPeersPromotions) + , IntM "peerSelection.EstablishedBootstrapPeers" (fromIntegral numberOfEstablishedBootstrapPeers) + , IntM "peerSelection.WarmBootstrapPeersDemotions" (fromIntegral numberOfWarmBootstrapPeersDemotions) + , IntM "peerSelection.WarmBootstrapPeersPromotions" (fromIntegral numberOfWarmBootstrapPeersPromotions) + , IntM "peerSelection.ActiveBootstrapPeers" (fromIntegral numberOfActiveBootstrapPeers) + , IntM "peerSelection.ActiveBootstrapPeersDemotions" (fromIntegral numberOfActiveBootstrapPeersDemotions) ] instance MetaTrace PeerSelectionCounters where @@ -998,13 +1003,53 @@ instance MetaTrace PeerSelectionCounters where documentFor _ = Nothing metricsDocFor (Namespace _ ["Counters"]) = - [ ("Net.PeerSelection.Cold", "Number of cold peers") - , ("Net.PeerSelection.Warm", "Number of warm peers") - , ("Net.PeerSelection.Hot", "Number of hot peers") - , ("Net.PeerSelection.ColdBigLedgerPeers", "Number of cold big ledger peers") - , ("Net.PeerSelection.WarmBigLedgerPeers", "Number of warm big ledger peers") - , ("Net.PeerSelection.HotBigLedgerPeers", "Number of hot big ledger peers") - , ("Net.PeerSelection.LocalRoots", "Numbers of warm & hot local roots") + [ ("peerSelection.Cold", "Number of cold peers") + , ("peerSelection.Warm", "Number of warm peers") + , ("peerSelection.Hot", "Number of hot peers") + , ("peerSelection.ColdBigLedgerPeers", "Number of cold big ledger peers") + , ("peerSelection.WarmBigLedgerPeers", "Number of warm big ledger peers") + , ("peerSelection.HotBigLedgerPeers", "Number of hot big ledger peers") + , ("peerSelection.LocalRoots", "Numbers of warm & hot local roots") + + , ("peerSelection.RootPeers", "Number of root peers") + , ("peerSelection.KnownPeers", "Number of known peers") + , ("peerSelection.ColdPeersPromotions", "Number of cold peers promotions") + , ("peerSelection.EstablishedPeers", "Number of established peers") + , ("peerSelection.WarmPeersDemotions", "Number of warm peers demotions") + , ("peerSelection.WarmPeersPromotions", "Number of warm peers promotions") + , ("peerSelection.ActivePeers", "Number of active peers") + , ("peerSelection.ActivePeersDemotions", "Number of active peers demotions") + + , ("peerSelection.KnownBigLedgerPeers", "Number of known big ledger peers") + , ("peerSelection.ColdBigLedgerPeersPromotions", "Number of cold big ledger peers promotions") + , ("peerSelection.EstablishedBigLedgerPeers", "Number of established big ledger peers") + , ("peerSelection.WarmBigLedgerPeersDemotions", "Number of warm big ledger peers demotions") + , ("peerSelection.WarmBigLedgerPeersPromotions", "Number of warm big ledger peers promotions") + , ("peerSelection.ActiveBigLedgerPeers", "Number of active big ledger peers") + , ("peerSelection.ActiveBigLedgerPeersDemotions", "Number of active big ledger peers demotions") + + , ("peerSelection.KnownLocalRootPeers", "Number of known local root peers") + , ("peerSelection.EstablishedLocalRootPeers", "Number of established local root peers") + , ("peerSelection.WarmLocalRootPeersPromotions", "Number of warm local root peers promotions") + , ("peerSelection.ActiveLocalRootPeers", "Number of active local root peers") + , ("peerSelection.ActiveLocalRootPeersDemotions", "Number of active local root peers demotions") + + , ("peerSelection.KnownNonRootPeers", "Number of known non root peers") + , ("peerSelection.ColdNonRootPeersPromotions", "Number of cold non root peers promotions") + , ("peerSelection.EstablishedNonRootPeers", "Number of established non root peers") + , ("peerSelection.WarmNonRootPeersDemotions", "Number of warm non root peers demotions") + , ("peerSelection.WarmNonRootPeersPromotions", "Number of warm non root peers promotions") + , ("peerSelection.ActiveNonRootPeers", "Number of active non root peers") + , ("peerSelection.ActiveNonRootPeersDemotions", "Number of active non root peers demotions") + + , ("peerSelection.KnownBootstrapPeers", "Number of known bootstrap peers") + , ("peerSelection.ColdBootstrapPeersPromotions", "Number of cold bootstrap peers promotions") + , ("peerSelection.EstablishedBootstrapPeers", "Number of established bootstrap peers") + , ("peerSelection.WarmBootstrapPeersDemotions", "Number of warm bootstrap peers demotions") + , ("peerSelection.WarmBootstrapPeersPromotions", "Number of warm bootstrap peers promotions") + , ("peerSelection.ActiveBootstrapPeers", "Number of active bootstrap peers") + , ("peerSelection.ActiveBootstrapPeersDemotions", "Number of active bootstrap peers demotions") + ] metricsDocFor _ = [] @@ -1026,7 +1071,7 @@ instance LogFormatting ChurnCounters where ] asMetrics (ChurnCounter action c) = [ IntM - ("Net.Churn." <> pack (show action)) + ("peerSelection.churn." <> pack (show action)) (fromIntegral c) ] @@ -1040,19 +1085,19 @@ instance MetaTrace ChurnCounters where "churn counters" documentFor _ = Nothing - metricsDocFor (Namespace _ ["Counters"]) = - [ ("Net.Churn.DecreasedActivePeers", "number of decreased active peers") - , ("Net.Churn.IncreasedActivePeers", "number of increased active peers") - , ("Net.Churn.DecreasedActiveBigLedgerPeers", "number of decreased active big ledger peers") - , ("Net.Churn.IncreasedActiveBigLedgerPeers", "number of increased active big ledger peers") - , ("Net.Churn.DecreasedEstablishedPeers", "number of decreased established peers") - , ("Net.Churn.IncreasedEstablishedPeers", "number of increased established peers") - , ("Net.Churn.IncreasedEstablishedBigLedgerPeers", "number of increased established big ledger peers") - , ("Net.Churn.DecreasedEstablishedBigLedgerPeers", "number of decreased established big ledger peers") - , ("Net.Churn.DecreasedKnownPeers", "number of decreased known peers") - , ("Net.Churn.IncreasedKnownPeers", "number of increased known peers") - , ("Net.Churn.DecreasedKnownBigLedgerPeers", "number of decreased known big ledger peers") - , ("Net.Churn.IncreasedKnownBigLedgerPeers", "number of increased known big ledger peers") + metricsDocFor (Namespace _ ["ChurnCounters"]) = + [ ("peerSelection.churn.DecreasedActivePeers", "number of decreased active peers") + , ("peerSelection.churn.IncreasedActivePeers", "number of increased active peers") + , ("peerSelection.churn.DecreasedActiveBigLedgerPeers", "number of decreased active big ledger peers") + , ("peerSelection.churn.IncreasedActiveBigLedgerPeers", "number of increased active big ledger peers") + , ("peerSelection.churn.DecreasedEstablishedPeers", "number of decreased established peers") + , ("peerSelection.churn.IncreasedEstablishedPeers", "number of increased established peers") + , ("peerSelection.churn.IncreasedEstablishedBigLedgerPeers", "number of increased established big ledger peers") + , ("peerSelection.churn.DecreasedEstablishedBigLedgerPeers", "number of decreased established big ledger peers") + , ("peerSelection.churn.DecreasedKnownPeers", "number of decreased known peers") + , ("peerSelection.churn.IncreasedKnownPeers", "number of increased known peers") + , ("peerSelection.churn.DecreasedKnownBigLedgerPeers", "number of decreased known big ledger peers") + , ("peerSelection.churn.IncreasedKnownBigLedgerPeers", "number of increased known big ledger peers") ] metricsDocFor _ = [] @@ -1255,19 +1300,19 @@ instance (Show addr, Show versionNumber, Show agreedOptions, LogFormatting addr, forHuman = pack . show asMetrics (TrConnectionManagerCounters ConnectionManagerCounters {..}) = [ IntM - "Net.ConnectionManager.FullDuplexConns" + "connectionManager.fullDuplexConns" (fromIntegral fullDuplexConns) , IntM - "Net.ConnectionManager.DuplexConns" + "connectionManager.duplexConns" (fromIntegral duplexConns) , IntM - "Net.ConnectionManager.UnidirectionalConns" + "connectionManager.unidirectionalConns" (fromIntegral unidirectionalConns) , IntM - "Net.ConnectionManager.InboundConns" + "connectionManager.inboundConns" (fromIntegral inboundConns) , IntM - "Net.ConnectionManager.OutboundConns" + "connectionManager.outboundConns" (fromIntegral outboundConns) ] asMetrics _ = [] @@ -1386,11 +1431,11 @@ instance MetaTrace (ConnectionManagerTrace addr documentFor _ = Nothing metricsDocFor (Namespace _ ["ConnectionManagerCounters"]) = - [("Net.ConnectionManager.FullDuplexConns","") - ,("Net.ConnectionManager.DuplexConns","") - ,("Net.ConnectionManager.UnidirectionalConns","") - ,("Net.ConnectionManager.InboundConns","") - ,("Net.ConnectionManager.OutboundConns","") + [("connectionManager.fullDuplexConns","") + ,("connectionManager.duplexConns","") + ,("connectionManager.unidirectionalConns","") + ,("connectionManager.inboundConns","") + ,("connectionManager.outboundConns","") ] metricsDocFor _ = [] @@ -1519,16 +1564,16 @@ instance LogFormatting (InboundGovernorTrace SockAddr) where forHuman = pack . show asMetrics (TrInboundGovernorCounters InboundGovernorCounters {..}) = [ IntM - "Net.InboundGovernor.Idle" + "inboundGovernor.idle" (fromIntegral idlePeersRemote) , IntM - "Net.InboundGovernor.Cold" + "inboundGovernor.cold" (fromIntegral coldPeersRemote) , IntM - "Net.InboundGovernor.Warm" + "inboundGovernor.warm" (fromIntegral warmPeersRemote) , IntM - "Net.InboundGovernor.Hot" + "inboundGovernor.hot" (fromIntegral hotPeersRemote) ] asMetrics _ = [] @@ -1538,16 +1583,16 @@ instance LogFormatting (InboundGovernorTrace LocalAddress) where forHuman = pack . show asMetrics (TrInboundGovernorCounters InboundGovernorCounters {..}) = [ IntM - "Net.LocalInboundGovernor.Idle" + "localInboundGovernor.idle" (fromIntegral idlePeersRemote) , IntM - "Net.LocalInboundGovernor.Cold" + "localInboundGovernor.cold" (fromIntegral coldPeersRemote) , IntM - "Net.LocalInboundGovernor.Warm" + "localInboundGovernor.warm" (fromIntegral warmPeersRemote) , IntM - "Net.LocalInboundGovernor.Hot" + "localInboundGovernor.hot" (fromIntegral hotPeersRemote) ] asMetrics _ = [] @@ -1720,26 +1765,32 @@ instance MetaTrace (InboundGovernorTrace addr) where documentFor (Namespace _ ["Inactive"]) = Just "" documentFor _ = Nothing - metricsDocFor (Namespace [] ["InboundGovernorCounters"]) = - [("Net.InboundGovernor.Idle","") - ,("Net.InboundGovernor.Cold","") - ,("Net.InboundGovernor.Warm","") - ,("Net.InboundGovernor.Hot","") - ] - metricsDocFor (Namespace ons ["InboundGovernorCounters"]) = - if last ons == "Local" - then - [("Net.LocalInboundGovernor.Idle","") - ,("Net.LocalInboundGovernor.Cold","") - ,("Net.LocalInboundGovernor.Warm","") - ,("Net.LocalInboundGovernor.Hot","") - ] - else - [("Net.InboundGovernor.Idle","") - ,("Net.InboundGovernor.Cold","") - ,("Net.InboundGovernor.Warm","") - ,("Net.InboundGovernor.Hot","") - ] + metricsDocFor (Namespace ons ["InboundGovernorCounters"]) + | null ons -- docu generation + = + [("localInboundGovernor.idle","") + ,("localInboundGovernor.cold","") + ,("localInboundGovernor.warm","") + ,("localInboundGovernor.hot","") + ,("inboundGovernor.Idle","") + ,("inboundGovernor.Cold","") + ,("inboundGovernor.Warm","") + ,("inboundGovernor.Hot","") + ] + | last ons == "Local" + = + [("localInboundGovernor.idle","") + ,("localInboundGovernor.cold","") + ,("localInboundGovernor.warm","") + ,("localInboundGovernor.hot","") + ] + | otherwise + = + [("inboundGovernor.Idle","") + ,("inboundGovernor.Cold","") + ,("inboundGovernor.Warm","") + ,("inboundGovernor.Hot","") + ] metricsDocFor _ = [] allNamespaces = [ diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Peer.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Peer.hs index f105e58c51b..0175ead4890 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Peer.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Peer.hs @@ -134,7 +134,7 @@ instance LogFormatting [PeerT blk] where [ "peers" .= toJSON (List.foldl' (\acc x -> forMachine dtal x : acc) [] xs) ] forHuman peers = Text.concat $ List.intersperse ", " (map ppPeer peers) - asMetrics peers = [IntM "Net.PeersFromNodeKernel" (fromIntegral (length peers))] + asMetrics peers = [IntM "peersFromNodeKernel" (fromIntegral (length peers))] instance LogFormatting (PeerT blk) where forMachine _dtal (PeerT cid _af status inflight) = @@ -160,6 +160,6 @@ instance MetaTrace [PeerT blk] where documentFor _ns = Nothing metricsDocFor (Namespace _ ["PeersFromNodeKernel"]) = - [("Net.PeersFromNodeKernel","")] + [("peersFromNodeKernel","")] metricsDocFor _ns = [] allNamespaces = [ Namespace [] ["PeersFromNodeKernel"]] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs index 4275319979b..6854cab8dee 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs @@ -285,6 +285,8 @@ instance ( Show (BlockNodeToNodeVersion blk) DisabledBlockForging -> 0 NotEffective -> 0 )] + asMetrics (BICommon BasicInfoCommon {..}) = + [ PrometheusM "basicInfo" [("nodeStartTime", (pack . show) biNodeStartTime)]] asMetrics _ = [] instance MetaTrace (StartupTrace blk) where @@ -409,6 +411,8 @@ instance MetaTrace (StartupTrace blk) where metricsDocFor (Namespace _ ["BlockForgingUpdate"]) = [("forging_enabled","Can this node forge blocks? (Is it provided with block forging credentials) 0 = no, 1 = yes")] + metricsDocFor (Namespace _ ["Common"]) = + [("systemStartTime","The UTC time this node was started.")] metricsDocFor _ = [] From 91e3a4ed61128feef6449f8efcd4dbb0480c5ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Nicklisch-Franken?= Date: Wed, 10 Jul 2024 14:51:04 +0200 Subject: [PATCH 3/7] trace-resources: renaming --- .../src/Cardano/Logging/Resources/Types.hs | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/trace-resources/src/Cardano/Logging/Resources/Types.hs b/trace-resources/src/Cardano/Logging/Resources/Types.hs index 1dc07a5e440..d11efb634b6 100644 --- a/trace-resources/src/Cardano/Logging/Resources/Types.hs +++ b/trace-resources/src/Cardano/Logging/Resources/Types.hs @@ -119,21 +119,21 @@ instance LogFormatting ResourceStats where ] asMetrics rs = - [ IntM "Resources.Stat.Cputicks" (fromIntegral $ rCentiCpu rs) - , IntM "Resources.RTS.Gcticks" (fromIntegral $ rCentiGC rs) - , IntM "Resources.RTS.Mutticks" (fromIntegral $ rCentiMut rs) - , IntM "Resources.RTS.GcMajorNum" (fromIntegral $ rGcsMajor rs) - , IntM "Resources.RTS.GcMinorNum" (fromIntegral $ rGcsMinor rs) - , IntM "Resources.RTS.Alloc" (fromIntegral $ rAlloc rs) - , IntM "Resources.RTS.GcLiveBytes" (fromIntegral $ rLive rs) - , IntM "Resources.RTS.Heap" (fromIntegral $ rHeap rs) - , IntM "Resources.Mem.Resident" (fromIntegral $ rRSS rs) - , IntM "Resources.Stat.BlkIOticks" (fromIntegral $ rCentiBlkIO rs) - , IntM "Resources.State.NetRd" (fromIntegral $ rNetRd rs) - , IntM "Resources.State.NetWr" (fromIntegral $ rNetWr rs) - , IntM "Resources.State.FsRd" (fromIntegral $ rFsRd rs) - , IntM "Resources.State.FsWr" (fromIntegral $ rFsWr rs) - , IntM "Resources.RTS.Stat.Threads" (fromIntegral $ rThreads rs) + [ IntM "Stat.cputicks" (fromIntegral $ rCentiCpu rs) + , IntM "RTS.gcticks" (fromIntegral $ rCentiGC rs) + , IntM "RTS.mutticks" (fromIntegral $ rCentiMut rs) + , IntM "RTS.gcMajorNum" (fromIntegral $ rGcsMajor rs) + , IntM "RTS.gcMinorNum" (fromIntegral $ rGcsMinor rs) + , IntM "RTS.alloc" (fromIntegral $ rAlloc rs) + , IntM "RTS.gcLiveBytes" (fromIntegral $ rLive rs) + , IntM "RTS.gcHeapBytes" (fromIntegral $ rHeap rs) + , IntM "Mem.resident" (fromIntegral $ rRSS rs) + , IntM "Stat.blkIOticks" (fromIntegral $ rCentiBlkIO rs) + , IntM "Stat.netRd" (fromIntegral $ rNetRd rs) + , IntM "Stat.netWr" (fromIntegral $ rNetWr rs) + , IntM "Stat.fsRd" (fromIntegral $ rFsRd rs) + , IntM "Stat.fsWr" (fromIntegral $ rFsWr rs) + , IntM "RTS.threads" (fromIntegral $ rThreads rs) ] instance MetaTrace ResourceStats where @@ -144,19 +144,20 @@ instance MetaTrace ResourceStats where documentFor (Namespace _ ["Resources"]) = Just "" documentFor _ns = Nothing metricsDocFor (Namespace _ ["Resources"]) = - [("Resources.Stat.Cputicks", "Kernel-reported CPU ticks (1/100th of a second), since process start") - ,("Resources.Mem.Resident", "Kernel-reported RSS (resident set size)") - ,("Resources.RTS.GcLiveBytes", "RTS-reported live bytes") - ,("Resources.RTS.GcMajorNum", "Major GCs") - ,("Resources.RTS.GcMinorNum", "Minor GCs") - ,("Resources.RTS.Gcticks", "RTS-reported CPU ticks spent on GC") - ,("Resources.RTS.Mutticks", "RTS-reported CPU ticks spent on mutator") - ,("Resources.State.NetRd", "IP packet bytes read") - ,("Resources.State.NetWr", "IP packet bytes written") - ,("Resources.State.FsRd", "FS bytes read") - ,("Resources.State.FsWr", "FS bytes written") - ,("Resources.RTS.Threads","RTS green thread count") - ] + [("Stat.cputicks", "Kernel-reported CPU ticks (1/100th of a second), since process start") + ,("RTS.gcticks", "RTS-reported CPU ticks spent on GC") + ,("RTS.mutticks", "RTS-reported CPU ticks spent on mutator") + ,("RTS.gcMajorNum", "Major GCs") + ,("RTS.gcMinorNum", "Minor GCs") + ,("RTS.alloc", "RTS-reported bytes allocated") + ,("RTS.gcLiveBytes", "RTS-reported live bytes") + ,("RTS.gcHeapBytes", "RTS-reported heap bytes") + ,("Mem.resident", "Kernel-reported RSS (resident set size)") + ,("Stat.netRd", "IP packet bytes read") + ,("Stat.netWr", "IP packet bytes written") + ,("Stat.fsRd", "FS bytes read") + ,("Stat.fsWr", "FS bytes written") + ,("RTS.threads","RTS green thread count")] metricsDocFor _ns = [] allNamespaces = [ Namespace [] ["Resources"]] From d5226730645cf5c517cbcffb36dfec5508bb9f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Nicklisch-Franken?= Date: Wed, 10 Jul 2024 14:52:23 +0200 Subject: [PATCH 4/7] cardano-tracer: renamed resources --- .../Tracer/Handlers/RTView/Update/Resources.hs | 16 ++++++++-------- cardano-tracer/src/Cardano/Tracer/MetaTrace.hs | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Resources.hs b/cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Resources.hs index 7cf114103ec..d5b50071f3d 100644 --- a/cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Resources.hs +++ b/cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Resources.hs @@ -29,14 +29,14 @@ updateResourcesHistory -> IO () updateResourcesHistory nodeId (ResHistory rHistory) lastResources metricName metricValue now = case metricName of - "Resources.Stat.Cputicks" -> updateCPUUsage - "Resources.Mem.Resident" -> updateRSSMemory - "Resources.RTS.GcLiveBytes" -> updateGCLiveMemory - "Resources.RTS.GcMajorNum" -> updateGCMajorNum - "Resources.RTS.GcMinorNum" -> updateGCMinorNum - "Resources.RTS.Gcticks" -> updateCPUTimeGC - "Resources.RTS.Mutticks" -> updateCPUTimeApp - "Resources.RTS.Stat.Threads" -> updateThreadsNum + "Stat.cputicks" -> updateCPUUsage + "Mem.resident" -> updateRSSMemory + "RTS.gcLiveBytes" -> updateGCLiveMemory + "RTS.gcMajorNum" -> updateGCMajorNum + "RTS.gcMinorNum" -> updateGCMinorNum + "RTS.gcticks" -> updateCPUTimeGC + "RTS.mutticks" -> updateCPUTimeApp + "Stat.threads" -> updateThreadsNum _ -> return () where updateCPUUsage = diff --git a/cardano-tracer/src/Cardano/Tracer/MetaTrace.hs b/cardano-tracer/src/Cardano/Tracer/MetaTrace.hs index 4fadf6de9da..9abd834affc 100644 --- a/cardano-tracer/src/Cardano/Tracer/MetaTrace.hs +++ b/cardano-tracer/src/Cardano/Tracer/MetaTrace.hs @@ -302,6 +302,7 @@ mkTracerTracer defSeverity = do , tcNodeName = Nothing , tcPeerFrequency = Nothing , tcResourceFrequency = Nothing + , tcMetricsPrefix = Nothing , tcOptions = Map.fromList [ ([], [ConfSeverity defSeverity]) , (["Tracer"], [ConfDetail DMaximum]) From 4ba83d60da20f65fbef7e704a058ade239667b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Nicklisch-Franken?= Date: Wed, 24 Jul 2024 17:08:31 +0200 Subject: [PATCH 5/7] tx-generator: new configuration filed --- .../src/Cardano/Benchmarking/Tracer.hs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Tracer.hs b/bench/tx-generator/src/Cardano/Benchmarking/Tracer.hs index 277bca80102..f52fe4db709 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Tracer.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Tracer.hs @@ -25,33 +25,31 @@ module Cardano.Benchmarking.Tracer ) where -import GHC.Generics +import Cardano.Api + +import Cardano.Benchmarking.LogTypes +import Cardano.Benchmarking.Types +import Cardano.Benchmarking.Version as Version +import Cardano.Logging +import Cardano.Node.Startup +import Ouroboros.Network.IOManager (IOManager) +import Control.Monad (forM, guard) import Data.Aeson as A import qualified Data.Aeson.KeyMap as KeyMap import Data.Kind -import qualified Data.Map.Strict as Map - -import Control.Monad (forM, guard) import Data.List (find) +import qualified Data.Map.Strict as Map import Data.Maybe (fromMaybe) import Data.Proxy import Data.Text (Text) import qualified Data.Text as Text import Data.Time.Clock +import GHC.Generics -import Ouroboros.Network.IOManager (IOManager) import Trace.Forward.Utils.DataPoint import Trace.Forward.Utils.TraceObject -import Cardano.Api -import Cardano.Logging -import Cardano.Node.Startup - -import Cardano.Benchmarking.LogTypes -import Cardano.Benchmarking.Types -import Cardano.Benchmarking.Version as Version - pattern TracerNameBench :: Text pattern TracerNameBench = "Benchmark" pattern TracerNameSubmit :: Text @@ -178,6 +176,7 @@ initialTraceConfig = TraceConfig { , tcNodeName = Nothing , tcPeerFrequency = Just 2000 -- Every 2 seconds , tcResourceFrequency = Just 1000 -- Every second + , tcMetricsPrefix = Nothing } where setMaxDetail :: Text -> ([Text], [ConfigOption]) From e33308a701997245c5247c101c0290bd8054a104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Nicklisch-Franken?= Date: Mon, 2 Sep 2024 12:48:30 +0200 Subject: [PATCH 6/7] Review changes Fixes for KES metrics and adoption of node version of trace-dispatcher cardano-node: calculate currentKESPeriod differently --- cardano-node/ChangeLog.md | 7 +-- cardano-node/cardano-node.cabal | 2 +- .../Tracing/Tracers/ForgingThreadStats.hs | 2 +- .../Cardano/Node/Tracing/Tracers/KESInfo.hs | 50 ++++++++++--------- trace-dispatcher/CHANGELOG.md | 5 ++ trace-dispatcher/doc/trace-dispatcher.md | 16 ++++-- trace-dispatcher/trace-dispatcher.cabal | 2 +- trace-resources/CHANGELOG.md | 4 ++ trace-resources/trace-resources.cabal | 2 +- 9 files changed, 55 insertions(+), 35 deletions(-) diff --git a/cardano-node/ChangeLog.md b/cardano-node/ChangeLog.md index 747cf56d41c..7e3aff8ac10 100644 --- a/cardano-node/ChangeLog.md +++ b/cardano-node/ChangeLog.md @@ -3,20 +3,21 @@ ## Next version - Use p2p network stack by default, warn when using the legacy network stack. -- Deprecate some CLI flags corresponding to low-level consensus options. They are - still accepted but a warning is emitted on startup on stderr suggesting to set +- Deprecate some CLI flags corresponding to low-level consensus options. They are + still accepted but a warning is emitted on startup on stderr suggesting to set them in the configuration file instead: - `--mempool-capacity-override` and `--no-mempool-capacity-override` can be set in the configuration file via the key `MempoolCapacityBytesOverride`. - `--snapshot-interval` can be set in the configuration file via the key `SnapshotInterval`. - `--num-of-disk-snapshots` can be set in the configuration file via the key `NumOfDiskSnapshots`. +- Use metric names of old-tracing in new-tracing as well, and fix some metrics in new tracing. + ## 8.2.1 -- August 2023 - prevent SIGHUP from killing node during ledger replay - upgrade cardano-cli to 8.4.1.0 - upgrade cardano-api to 8.10.2.0 - ## 8.2.0 -- July 2023 ### node changes diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 58ec0c06fe3..3b538359bf6 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -206,7 +206,7 @@ library , strict-sop-core , strict-stm , time - , trace-dispatcher ^>= 2.5.8 + , trace-dispatcher ^>= 2.6.0 , trace-forward ^>= 2.2.6 , trace-resources ^>= 0.2.2 , tracer-transformers diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs index 549059190d8..21841012203 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/ForgingThreadStats.hs @@ -79,7 +79,7 @@ instance MetaTrace ForgeThreadStats where "How many times was this node slot leader?") ,("blocksForged", "How many blocks did this node forge?") - ,("lotsMissed", + ,("slotsMissed", "How many slots did this node miss?") ] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs index e75b07cd37e..4693843e18d 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/KESInfo.hs @@ -59,22 +59,23 @@ deriving newtype instance ToJSON KESPeriod instance LogFormatting HotKey.KESInfo where forMachine _dtal forgeStateInfo = - let maxKesEvos = endKesPeriod - startKesPeriod - oCertExpiryKesPeriod = startKesPeriod + maxKesEvos - kesPeriodsUntilExpiry = max 0 (oCertExpiryKesPeriod - currKesPeriod) + let currKesPeriod' = currKesPeriod + startKesPeriod + maxKesEvos = endKesPeriod - startKesPeriod + expiryKesPeriod = startKesPeriod + maxKesEvos + kesPeriodsUntilExpiry = max 0 (expiryKesPeriod - currKesPeriod') in if kesPeriodsUntilExpiry > 7 then mconcat [ "kind" .= String "KESInfo" , "startPeriod" .= startKesPeriod - , "endPeriod" .= currKesPeriod + , "endPeriod" .= currKesPeriod' , "evolution" .= endKesPeriod ] else mconcat [ "kind" .= String "ExpiryLogMessage" , "keyExpiresIn" .= kesPeriodsUntilExpiry , "startPeriod" .= startKesPeriod - , "endPeriod" .= currKesPeriod + , "endPeriod" .= currKesPeriod' , "evolution" .= endKesPeriod ] where @@ -85,15 +86,17 @@ instance LogFormatting HotKey.KESInfo where } = forgeStateInfo forHuman forgeStateInfo = - let maxKesEvos = endKesPeriod - startKesPeriod - oCertExpiryKesPeriod = startKesPeriod + maxKesEvos - kesPeriodsUntilExpiry = max 0 (oCertExpiryKesPeriod - currKesPeriod) + let currKesPeriod' = currKesPeriod + startKesPeriod + maxKesEvos = endKesPeriod - startKesPeriod + expiryKesPeriod = startKesPeriod + maxKesEvos + kesPeriodsUntilExpiry = max 0 (expiryKesPeriod - currKesPeriod') in if kesPeriodsUntilExpiry > 7 then "KES info startPeriod " <> (Text.pack . show) startKesPeriod - <> " currPeriod " <> (Text.pack . show) currKesPeriod + <> " currPeriod " <> (Text.pack . show) currKesPeriod' <> " endPeriod " <> (Text.pack . show) endKesPeriod - <> (Text.pack . show) kesPeriodsUntilExpiry - <> " KES periods." + <> ", " + <> (Text.pack . show) kesPeriodsUntilExpiry + <> " KES periods until expiry." else "Operational key will expire in " <> (Text.pack . show) kesPeriodsUntilExpiry <> " KES periods." @@ -105,17 +108,15 @@ instance LogFormatting HotKey.KESInfo where } = forgeStateInfo asMetrics forgeStateInfo = - let maxKesEvos = endKesPeriod - startKesPeriod - oCertExpiryKesPeriod = startKesPeriod + maxKesEvos + let currKesPeriod' = currKesPeriod + startKesPeriod + maxKesEvos = endKesPeriod - startKesPeriod + expiryKesPeriod = startKesPeriod + maxKesEvos + kesPeriodsUntilExpiry = max 0 (expiryKesPeriod - currKesPeriod') in [ - IntM "operationalCertificateStartKESPeriod" - (fromIntegral startKesPeriod) - , IntM "operationalCertificateExpiryKESPeriod" - (fromIntegral (startKesPeriod + maxKesEvos)) - , IntM "currentKESPeriod" - (fromIntegral currKesPeriod) - , IntM "remainingKESPeriods" - (fromIntegral (max 0 (oCertExpiryKesPeriod - currKesPeriod))) + IntM "operationalCertificateStartKESPeriod" (fromIntegral startKesPeriod) + , IntM "operationalCertificateExpiryKESPeriod" (fromIntegral expiryKesPeriod) + , IntM "currentKESPeriod" (fromIntegral currKesPeriod') + , IntM "remainingKESPeriods" (fromIntegral kesPeriodsUntilExpiry) ] where HotKey.KESInfo @@ -129,9 +130,10 @@ instance MetaTrace HotKey.KESInfo where namespaceFor HotKey.KESInfo {} = Namespace [] ["StateInfo"] severityFor (Namespace _ _) (Just forgeStateInfo) = Just $ - let maxKesEvos = endKesPeriod - startKesPeriod - oCertExpiryKesPeriod = startKesPeriod + maxKesEvos - kesPeriodsUntilExpiry = max 0 (oCertExpiryKesPeriod - currKesPeriod) + let currKesPeriod' = currKesPeriod + startKesPeriod + maxKesEvos = endKesPeriod - startKesPeriod + expiryKesPeriod = startKesPeriod + maxKesEvos + kesPeriodsUntilExpiry = max 0 (expiryKesPeriod - currKesPeriod') in if kesPeriodsUntilExpiry > 7 then Info else if kesPeriodsUntilExpiry <= 1 diff --git a/trace-dispatcher/CHANGELOG.md b/trace-dispatcher/CHANGELOG.md index 26987a038a5..52abc9f311f 100644 --- a/trace-dispatcher/CHANGELOG.md +++ b/trace-dispatcher/CHANGELOG.md @@ -1,5 +1,10 @@ # Revision history for trace-dispatcher +## 2.6.0 + +* With a metrics prefix that can be set in the configuration (tcMetricsPrefix) + Metrics gets a type postfix (_int,_real, _counter) + ## 2.5.7 * With a prometheus metric with key label pairs. The value will always be "1" diff --git a/trace-dispatcher/doc/trace-dispatcher.md b/trace-dispatcher/doc/trace-dispatcher.md index 12a64d4e611..db020f4605b 100644 --- a/trace-dispatcher/doc/trace-dispatcher.md +++ b/trace-dispatcher/doc/trace-dispatcher.md @@ -263,6 +263,10 @@ class MetaTrace a where Metrics are seamlessly incorporated into the system through regular trace messages implementing the `asMetrics` function within the `LogFormatting` typeclass. Unlike other trace components, metrics are not subjected to filtering and are consistently provided. This occurs as long as the `EKGBackend` is configured for the message. The `EKGBackend` then forwards these metrics to `cardano-tracer` for additional processing. Subsequently, they are dispatched as Prometheus metrics, extending their utility and visibility. +It is essential to implement the metricsDoc function of the MetaTrace typeclass, as this information is utilized to optimize system performance. + +The configuration option TraceOptionMetricsPrefix can be used to prepend a prefix to any trace message. For example, the prefix could be "cardano.node". + ## Frequency Limiting in Trace Filtering Frequency filtering is an integral aspect of trace filtering, offering an optional mechanism to limit the observable frequency of individual trace messages. @@ -331,6 +335,9 @@ TraceOptionForwarder: # Configure the forwarder # Frequency of Peer messages set to two seconds TraceOptionPeerFrequency: 2000 + +# Any metrics emittted will get this prefix +TraceOptionMetricsPrefix: "cardano.node" ``` The same in JSON looks like this: @@ -362,7 +369,8 @@ The same in JSON looks like this: }, "mode": "Initiator" }, - "TraceOptionPeerFrequency": 2000 + "TraceOptionPeerFrequency": 2000, + "TraceOptionMetricsPrefix": "cardano.node" } ``` @@ -383,11 +391,11 @@ implement some advanced functionality. Presently, the process of adding a new tracer involves making changes in three specific modules. However, we anticipate that this requirement will be simplified once the old tracing system is phased out. The current modules where modifications are needed to add a new tracer are: -- **Cardano.Node.Tracing.Tracers** +- __Cardano.Node.Tracing.Tracers__ -- **Cardano.Node.Tracing.Documentation** +- __Cardano.Node.Tracing.Documentation__ -- **Cardano.Node.Tracing.Consistency** +- __Cardano.Node.Tracing.Consistency__ ## Message Filtering based on Severity diff --git a/trace-dispatcher/trace-dispatcher.cabal b/trace-dispatcher/trace-dispatcher.cabal index 55719509d8f..bcee3acd626 100644 --- a/trace-dispatcher/trace-dispatcher.cabal +++ b/trace-dispatcher/trace-dispatcher.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: trace-dispatcher -version: 2.5.8 +version: 2.6.0 synopsis: Tracers for Cardano description: Package for development of simple and efficient tracers based on the arrow based contra-tracer package diff --git a/trace-resources/CHANGELOG.md b/trace-resources/CHANGELOG.md index 66a5b636a80..685641e048a 100644 --- a/trace-resources/CHANGELOG.md +++ b/trace-resources/CHANGELOG.md @@ -1,5 +1,9 @@ # Revision history for trace-resources +## 0,2,3 + +* New names for metrics + ## 0.2.1.0 -- Nov 2023 * Optimized resource record creation on Linux diff --git a/trace-resources/trace-resources.cabal b/trace-resources/trace-resources.cabal index 80b07411f02..8147a1cabdd 100644 --- a/trace-resources/trace-resources.cabal +++ b/trace-resources/trace-resources.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: trace-resources -version: 0.2.2.0 +version: 0.2.3 synopsis: Package for tracing resources for linux, mac and windows description: Package for tracing resources for linux, mac and windows. category: Cardano, From e7315433d31a893fc840fbc128768c7d5124446d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Nicklisch-Franken?= Date: Mon, 2 Sep 2024 18:23:18 +0200 Subject: [PATCH 7/7] trace-dispatcher: Review fix --- trace-dispatcher/doc/trace-dispatcher.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trace-dispatcher/doc/trace-dispatcher.md b/trace-dispatcher/doc/trace-dispatcher.md index db020f4605b..120d4c52bd8 100644 --- a/trace-dispatcher/doc/trace-dispatcher.md +++ b/trace-dispatcher/doc/trace-dispatcher.md @@ -265,7 +265,7 @@ Metrics are seamlessly incorporated into the system through regular trace messag It is essential to implement the metricsDoc function of the MetaTrace typeclass, as this information is utilized to optimize system performance. -The configuration option TraceOptionMetricsPrefix can be used to prepend a prefix to any trace message. For example, the prefix could be "cardano.node". +The configuration option TraceOptionMetricsPrefix can be used to prepend a prefix to any metrics name. For example, the prefix could be "cardano.node". ## Frequency Limiting in Trace Filtering