From ef9a9cd9960979cb11f544905f2e7240ad8531fb Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Thu, 11 Aug 2022 15:43:40 +0800 Subject: [PATCH] cardano-node: on startup, trace the configuration through the tracing system --- cardano-node/src/Cardano/Node/Run.hs | 2 ++ cardano-node/src/Cardano/Node/Startup.hs | 3 +++ cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index 22f323f5471..33468a7b6d7 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -326,6 +326,8 @@ handleSimpleNode handleSimpleNode runP p2pMode tracers nc onKernel = do logStartupWarnings + traceWith (startupTracer tracers) (StartupConfig nc) + traceWith (startupTracer tracers) =<< StartupTime <$> getCurrentTime diff --git a/cardano-node/src/Cardano/Node/Startup.hs b/cardano-node/src/Cardano/Node/Startup.hs index 3ed9d36f2e6..ae7c206181b 100644 --- a/cardano-node/src/Cardano/Node/Startup.hs +++ b/cardano-node/src/Cardano/Node/Startup.hs @@ -45,6 +45,7 @@ import Ouroboros.Network.Subscription.Ip (IPSubscriptionTarget (..)) import Cardano.Api.Protocol.Types (BlockType (..), protocolInfo) import Cardano.Logging +import Cardano.Node.Configuration.POM (NodeConfiguration) import Cardano.Node.Configuration.Socket import Cardano.Node.Protocol.Types (Protocol (..), SomeConsensusProtocol (..)) @@ -69,6 +70,8 @@ data StartupTrace blk = | StartupTime UTCTime + | StartupConfig NodeConfiguration + | StartupNetworkMagic NetworkMagic | StartupSocketConfigError SocketConfigError diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs index e4b23d2e2d8..77b51477ea1 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs @@ -126,6 +126,7 @@ namesStartupInfo = \case StartupInfo {} -> ["Info"] StartupP2PInfo {} -> ["P2PInfo"] StartupTime {} -> ["Time"] + StartupConfig {} -> ["Config"] StartupNetworkMagic {} -> ["NetworkMagic"] StartupSocketConfigError {} -> ["SocketConfigError"] StartupDBValidation {} -> ["DBValidation"] @@ -187,6 +188,10 @@ instance ( Show (BlockNodeToNodeVersion blk) $ time ) ] + forMachine _dtal (StartupConfig nc) = + mconcat [ "kind" .= String "StartupConfig" + , "config" .= String (showT nc) + ] forMachine _dtal (StartupNetworkMagic networkMagic) = mconcat [ "kind" .= String "StartupNetworkMagic" , "networkMagic" .= String (showT . unNetworkMagic @@ -294,6 +299,8 @@ ppStartupInfoTrace (StartupTime time) = . utcTimeToPOSIXSeconds $ time ) +ppStartupInfoTrace (StartupConfig nc) = + "config: " <> (showT nc) ppStartupInfoTrace (StartupNetworkMagic networkMagic) = "network magic: " <> showT (unNetworkMagic networkMagic)