Skip to content

Commit

Permalink
cardano-node: on startup, trace the configuration through the tracing…
Browse files Browse the repository at this point in the history
… system
  • Loading branch information
deepfire committed Aug 11, 2022
1 parent 8ebc700 commit ef9a9cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ handleSimpleNode
handleSimpleNode runP p2pMode tracers nc onKernel = do
logStartupWarnings

traceWith (startupTracer tracers) (StartupConfig nc)

traceWith (startupTracer tracers)
=<< StartupTime <$> getCurrentTime

Expand Down
3 changes: 3 additions & 0 deletions cardano-node/src/Cardano/Node/Startup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 (..))

Expand All @@ -69,6 +70,8 @@ data StartupTrace blk =

| StartupTime UTCTime

| StartupConfig NodeConfiguration

| StartupNetworkMagic NetworkMagic

| StartupSocketConfigError SocketConfigError
Expand Down
7 changes: 7 additions & 0 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ namesStartupInfo = \case
StartupInfo {} -> ["Info"]
StartupP2PInfo {} -> ["P2PInfo"]
StartupTime {} -> ["Time"]
StartupConfig {} -> ["Config"]
StartupNetworkMagic {} -> ["NetworkMagic"]
StartupSocketConfigError {} -> ["SocketConfigError"]
StartupDBValidation {} -> ["DBValidation"]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -294,6 +299,8 @@ ppStartupInfoTrace (StartupTime time) =
. utcTimeToPOSIXSeconds
$ time
)
ppStartupInfoTrace (StartupConfig nc) =
"config: " <> (showT nc)
ppStartupInfoTrace (StartupNetworkMagic networkMagic) =
"network magic: " <> showT (unNetworkMagic networkMagic)

Expand Down

0 comments on commit ef9a9cd

Please sign in to comment.