@@ -20,6 +20,7 @@ module Cardano.Node.Tracing.Documentation
2020import Control.Exception (SomeException )
2121import Data.Aeson.Types (ToJSON )
2222import Data.Proxy (Proxy (.. ))
23+ import qualified Data.Text as T
2324import qualified Data.Text.IO as T
2425import GHC.Generics (Generic )
2526import Network.Mux (MuxTrace (.. ), WithMuxBearer (.. ))
@@ -193,52 +194,60 @@ docTracers configFileName outputFileName _ _ _ = do
193194 configReflection <- emptyConfigReflection
194195
195196 -- NodeInfo tracer
196- nodeInfoTr <- mkDataPointTracer
197+ nodeInfoDp <- mkDataPointTracer
197198 trDataPoint
198- configureTracers configReflection trConfig [nodeInfoTr ]
199- nodeInfoTrDoc <- documentTracer (nodeInfoTr :: Trace IO NodeInfo )
199+ configureTracers configReflection trConfig [nodeInfoDp ]
200+ nodeInfoDpDoc <- documentTracer (nodeInfoDp :: Trace IO NodeInfo )
200201
201- nodeStartupInfoTr <- mkDataPointTracer
202+ nodeStartupInfoDp <- mkDataPointTracer
202203 trDataPoint
203- configureTracers configReflection trConfig [nodeStartupInfoTr ]
204- nodeStartupInfoTrDoc <- documentTracer
205- (nodeStartupInfoTr :: Trace IO NodeStartupInfo )
204+ configureTracers configReflection trConfig [nodeStartupInfoDp ]
205+ nodeStartupInfoDpDoc <- documentTracer
206+ (nodeStartupInfoDp :: Trace IO NodeStartupInfo )
206207
207208 -- State tracer
208209 stateTr <- mkCardanoTracer
209210 trBase trForward mbTrEKG
210211 [" NodeState" ]
211212 configureTracers configReflection trConfig [stateTr]
212213 stateTrDoc <- documentTracer (stateTr :: Trace IO SR. NodeState )
214+ let stateNS = map (nsGetComplete . nsReplacePrefix [" NodeState" ])
215+ (allNamespaces :: [Namespace SR. NodeState ])
213216
214217 -- Peers tracer
215-
216218 peersTr <- mkCardanoTracer
217219 trBase trForward mbTrEKG
218220 [" Net" , " Peers" , " List" ]
219221 configureTracers configReflection trConfig [peersTr]
220222 peersTrDoc <- documentTracer (peersTr :: Trace IO [PeerT blk ])
223+ let peersNS = map (nsGetComplete . nsReplacePrefix [" Net" , " Peers" , " List" ])
224+ (allNamespaces :: [Namespace [PeerT blk ]])
221225
222226 -- Resource tracer
223227 resourcesTr <- mkCardanoTracer
224228 trBase trForward mbTrEKG
225229 []
226230 configureTracers configReflection trConfig [resourcesTr]
227231 resourcesTrDoc <- documentTracer (resourcesTr :: Trace IO ResourceStats )
232+ let resourcesNS = map nsGetComplete
233+ (allNamespaces :: [Namespace ResourceStats ])
228234
229235 -- Startup tracer
230236 startupTr <- mkCardanoTracer
231237 trBase trForward mbTrEKG
232238 [" Startup" ]
233239 configureTracers configReflection trConfig [startupTr]
234240 startupTrDoc <- documentTracer (startupTr :: Trace IO (StartupTrace blk ))
241+ let startupNS = map (nsGetComplete . nsReplacePrefix [" Startup" ])
242+ (allNamespaces :: [Namespace (StartupTrace blk )])
235243
236244 shutdownTr <- mkCardanoTracer
237245 trBase trForward mbTrEKG
238246 [" Shutdown" ]
239247 configureTracers configReflection trConfig [shutdownTr]
240248 shutdownTrDoc <- documentTracer (shutdownTr :: Trace IO ShutdownTrace )
241-
249+ let shutdownNS = map (nsGetComplete . nsReplacePrefix [" Shutdown" ])
250+ (allNamespaces :: [Namespace ShutdownTrace ])
242251
243252 chainDBTr <- mkCardanoTracer'
244253 trBase trForward mbTrEKG
@@ -247,12 +256,16 @@ docTracers configFileName outputFileName _ _ _ = do
247256 configureTracers configReflection trConfig [chainDBTr]
248257 chainDBTrDoc <- documentTracer (chainDBTr ::
249258 Trace IO (ChainDB. TraceEvent blk))
259+ let chainDBNS = map (nsGetComplete . nsReplacePrefix [" ChainDB" ])
260+ (allNamespaces :: [Namespace (ChainDB. TraceEvent blk )])
250261
251262 replayBlockTr <- mkCardanoTracer
252263 trBase trForward mbTrEKG
253264 [" ChainDB" , " ReplayBlock" ]
254265 configureTracers configReflection trConfig [replayBlockTr]
255266 replayBlockTrDoc <- documentTracer (replayBlockTr :: Trace IO ReplayBlockStats )
267+ let replayBlockNS = map (nsGetComplete . nsReplacePrefix [" ChainDB" , " ReplayBlock" ])
268+ (allNamespaces :: [Namespace ReplayBlockStats ])
256269
257270-- Consensus tracers
258271
@@ -264,20 +277,30 @@ docTracers configFileName outputFileName _ _ _ = do
264277 (Trace IO (BlockFetch. TraceLabelPeer
265278 (ConnectionId RemoteAddress )
266279 (TraceChainSyncClientEvent blk))))
280+ let chainSyncClientNS = map
281+ (nsGetComplete . nsReplacePrefix [" ChainSync" , " Client" ])
282+ (allNamespaces :: [Namespace (BlockFetch. TraceLabelPeer
283+ (ConnectionId RemoteAddress )
284+ (TraceChainSyncClientEvent blk))])
267285
268286 chainSyncServerHeaderTr <- mkCardanoTracer
269287 trBase trForward mbTrEKG
270288 [" ChainSync" , " ServerHeader" ]
271289 configureTracers configReflection trConfig [chainSyncServerHeaderTr]
272290 chainSyncServerHeaderTrDoc <- documentTracer (chainSyncServerHeaderTr ::
273291 (Trace IO (TraceChainSyncServerEvent blk)))
292+ let chainSyncServerHeaderNS = map (nsGetComplete . nsReplacePrefix [" ChainSync" , " ServerHeader" ])
293+ (allNamespaces :: [Namespace (TraceChainSyncServerEvent blk )])
274294
275295 chainSyncServerBlockTr <- mkCardanoTracer
276296 trBase trForward mbTrEKG
277297 [" ChainSync" , " ServerBlock" ]
278298 configureTracers configReflection trConfig [chainSyncServerBlockTr]
279299 chainSyncServerBlockTrDoc <- documentTracer (chainSyncServerBlockTr ::
280300 (Trace IO (TraceChainSyncServerEvent blk)))
301+ let chainSyncServerBlockNS = map (nsGetComplete . nsReplacePrefix [" ChainSync" , " ServerBlock" ])
302+ (allNamespaces :: [Namespace (TraceChainSyncServerEvent blk )])
303+
281304
282305 blockFetchDecisionTr <- mkCardanoTracer
283306 trBase trForward mbTrEKG
@@ -287,6 +310,10 @@ docTracers configFileName outputFileName _ _ _ = do
287310 Trace IO [BlockFetch. TraceLabelPeer
288311 remotePeer
289312 (FetchDecision [Point (Header blk)])])
313+ let blockFetchDecisionNS = map (nsGetComplete . nsReplacePrefix [" BlockFetch" , " Decision" ])
314+ (allNamespaces :: [Namespace [BlockFetch. TraceLabelPeer
315+ remotePeer
316+ (FetchDecision [Point (Header blk)])]])
290317
291318 blockFetchClientTr <- mkCardanoTracer
292319 trBase trForward mbTrEKG
@@ -296,6 +323,10 @@ docTracers configFileName outputFileName _ _ _ = do
296323 Trace IO (BlockFetch. TraceLabelPeer
297324 remotePeer
298325 (BlockFetch. TraceFetchClientState (Header blk))))
326+ let blockFetchClientNS = map (nsGetComplete . nsReplacePrefix [" BlockFetch" , " Client" ])
327+ (allNamespaces :: [Namespace (BlockFetch. TraceLabelPeer
328+ remotePeer
329+ (BlockFetch. TraceFetchClientState (Header blk)))])
299330
300331 -- TODO Yup
301332 -- blockFetchClientMetricsTr <- do
@@ -311,13 +342,17 @@ docTracers configFileName outputFileName _ _ _ = do
311342 configureTracers configReflection trConfig [blockFetchServerTr]
312343 blockFetchServerTrDoc <- documentTracer (blockFetchServerTr ::
313344 Trace IO (TraceBlockFetchServerEvent blk))
345+ let blockFetchServerNS = map (nsGetComplete . nsReplacePrefix [" BlockFetch" , " Server" ])
346+ (allNamespaces :: [Namespace (TraceBlockFetchServerEvent blk )])
314347
315348 forgeKESInfoTr <- mkCardanoTracer
316349 trBase trForward mbTrEKG
317350 [" Forge" , " KESInfo" ]
318351 configureTracers configReflection trConfig [forgeKESInfoTr]
319352 forgeKESInfoTrDoc <- documentTracer (forgeKESInfoTr ::
320353 Trace IO (Consensus. TraceLabelCreds HotKey. KESInfo ))
354+ let forgeKESInfoNS = map (nsGetComplete . nsReplacePrefix [" Forge" , " KESInfo" ])
355+ (allNamespaces :: [Namespace (Consensus. TraceLabelCreds HotKey. KESInfo )])
321356
322357 txInboundTr <- mkCardanoTracer
323358 trBase trForward mbTrEKG
@@ -327,6 +362,10 @@ docTracers configFileName outputFileName _ _ _ = do
327362 Trace IO (BlockFetch. TraceLabelPeer
328363 remotePeer
329364 (TraceTxSubmissionInbound (GenTxId blk) (GenTx blk))))
365+ let txInboundNS = map (nsGetComplete . nsReplacePrefix [" TxSubmission" , " TxInbound" ])
366+ (allNamespaces :: [Namespace (BlockFetch. TraceLabelPeer
367+ remotePeer
368+ (TraceTxSubmissionInbound (GenTxId blk) (GenTx blk)))])
330369
331370 txOutboundTr <- mkCardanoTracer
332371 trBase trForward mbTrEKG
@@ -336,20 +375,30 @@ docTracers configFileName outputFileName _ _ _ = do
336375 Trace IO (BlockFetch. TraceLabelPeer
337376 remotePeer
338377 (TraceTxSubmissionOutbound (GenTxId blk) (GenTx blk))))
378+ let txOutboundNS = map (nsGetComplete . nsReplacePrefix [" TxSubmission" , " TxOutbound" ])
379+ (allNamespaces :: [Namespace (BlockFetch. TraceLabelPeer
380+ remotePeer
381+ (TraceTxSubmissionOutbound (GenTxId blk) (GenTx blk)))])
339382
340383 localTxSubmissionServerTr <- mkCardanoTracer
341384 trBase trForward mbTrEKG
342385 [" TxSubmission" , " LocalServer" ]
343386 configureTracers configReflection trConfig [localTxSubmissionServerTr]
344387 localTxSubmissionServerTrDoc <- documentTracer (localTxSubmissionServerTr ::
345388 Trace IO (TraceLocalTxSubmissionServerEvent blk))
389+ let localTxSubmissionServerNS = map (nsGetComplete . nsReplacePrefix
390+ [" TxSubmission" , " LocalServer" ])
391+ (allNamespaces :: [Namespace
392+ (TraceLocalTxSubmissionServerEvent blk)])
346393
347394 mempoolTr <- mkCardanoTracer
348395 trBase trForward mbTrEKG
349396 [" Mempool" ]
350397 configureTracers configReflection trConfig [mempoolTr]
351398 mempoolTrDoc <- documentTracer (mempoolTr ::
352399 Trace IO (TraceEventMempool blk))
400+ let mempoolNS = map (nsGetComplete . nsReplacePrefix [" Mempool" ])
401+ (allNamespaces :: [Namespace (TraceEventMempool blk )])
353402
354403 forgeTr <- mkCardanoTracer
355404 trBase trForward mbTrEKG
@@ -679,9 +728,76 @@ docTracers configFileName outputFileName _ _ _ = do
679728 dtAcceptPolicyTrDoc <- documentTracer (dtAcceptPolicyTr ::
680729 Trace IO NtN. AcceptConnectionsPolicyTrace )
681730
682- let bl = nodeInfoTrDoc
731+ let allNamespaces' :: [[T. Text ]] =
732+ stateNS
733+ <> peersNS
734+ <> resourcesNS
735+ <> startupNS
736+ <> shutdownNS
737+ <> chainDBNS
738+ <> replayBlockNS
739+ -- -- Consensus
740+ <> chainSyncClientNS
741+ <> chainSyncServerHeaderNS
742+ <> chainSyncServerBlockNS
743+ <> blockFetchDecisionNS
744+ <> blockFetchClientNS
745+ <> blockFetchServerNS
746+ -- <> forgeKESInfoNS
747+ -- <> txInboundNS
748+ -- <> txOutboundNS
749+ -- <> localTxSubmissionServerNS
750+ -- <> mempoolNS
751+ -- <> forgeNS
752+ -- -- <> forgeThreadStatsNS
753+ -- <> blockchainTimeNS
754+ -- -- NodeToClient
755+ -- <> keepAliveClientNS
756+ -- <> chainSyncNS
757+ -- <> txMonitorNS
758+ -- <> txSubmissionNS
759+ -- <> stateQueryNS
760+ -- -- Node to Node
761+ -- <> chainSyncNodeNS
762+ -- <> chainSyncSerialisedNS
763+ -- <> blockFetchNS
764+ -- <> blockFetchSerialisedNS
765+ -- <> txSubmission2NS
766+ -- -- Diffusion
767+ -- <> dtMuxNS
768+ -- <> dtLocalMuxNS
769+ -- <> dtHandshakeNS
770+ -- <> dtLocalHandshakeNS
771+ -- <> dtDiffusionInitializationNS
772+ -- <> dtLedgerPeersNS
773+ -- -- DiffusionNSacersExNSa P2P
774+ -- <> localRootPeersNS
775+ -- <> publicRootPeersNS
776+ -- <> peerSelectionNS
777+ -- <> debugPeerSelectionNS
778+ -- <> debugPeerSelectionResponderNS
779+ -- <> peerSelectionCountersNS
780+ -- <> peerSelectionActionsNS
781+ -- <> connectionManagerNS
782+ -- <> connectionManagerNSansitionsNS
783+ -- <> serverNS
784+ -- <> inboundGovernorNS
785+ -- <> inboundGovernorNSansitionsNS
786+ -- <> localConnectionManagerNS
787+ -- <> localServerNS
788+ -- <> localInboundGovernorNS
789+ -- -- DiffusionNSacersExNSa nonP2P
790+ -- <> dtIpSubscriptionNS
791+ -- <> dtDnsSubscriptionNS
792+ -- <> dtDnsResolverNS
793+ -- <> dtErrorPolicyNS
794+ -- <> dtLocalErrorPolicyNS
795+ -- <> dtAcceptPolicyNS
796+
797+
798+ let bl = nodeInfoDpDoc
799+ <> nodeStartupInfoDpDoc
683800 <> stateTrDoc
684- <> nodeStartupInfoTrDoc
685801 <> resourcesTrDoc
686802 <> startupTrDoc
687803 <> shutdownTrDoc
0 commit comments