Skip to content

Commit

Permalink
Merge #4295
Browse files Browse the repository at this point in the history
4295: cardano-node:  on startup, trace the configuration through the tracing system r=deepfire a=deepfire

cardano-node:  on startup, trace the configuration through the tracing system

Co-authored-by: Kosyrev Serge <[email protected]>
  • Loading branch information
iohk-bors[bot] and deepfire authored Aug 11, 2022
2 parents 8ebc700 + b8e7b23 commit 628c5f3
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 628c5f3

Please sign in to comment.