Skip to content

Commit

Permalink
cardano-node: More p2p tracers
Browse files Browse the repository at this point in the history
  • Loading branch information
jutaro authored and deepfire committed Nov 25, 2021
1 parent db7dc33 commit cfc959e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
11 changes: 11 additions & 0 deletions cardano-node/src/Cardano/TraceDispatcher/Network/P2P.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ instance (Show addr, LogFormatting addr, ToJSON addr)
mkObject [ "kind" .= String "ServerError"
, "reason" .= show exception
]
forHuman = pack . show

docServer :: Documented (ServerTrace ntnAddr)
docServer = Documented
Expand Down Expand Up @@ -1204,6 +1205,16 @@ instance (ToJSON addr, Show addr)
mkObject [ "kind" .= String "UnexpectedlyFalseAssertion"
, "remoteSt" .= String (pack . show $ info)
]
forHuman = pack . show
asMetrics (TrInboundGovernorCounters InboundGovernorCounters {..}) =
[ IntM
"cardano.node.inbound-governor.warm"
(fromIntegral warmPeersRemote)
, IntM
"cardano.node.inbound-governor.hot"
(fromIntegral hotPeersRemote)
]
asMetrics _ = []

docInboundGovernor :: Documented (InboundGovernorTrace peerAddr)
docInboundGovernor = Documented
Expand Down
32 changes: 28 additions & 4 deletions cardano-node/src/Cardano/TraceDispatcher/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,27 @@ mkDiffusionTracersExtra trBase trForward mbTrEKG _trDataPoint trConfig EnabledP2
severityInboundGovernor
allPublic
configureTracers trConfig docInboundGovernor [inboundGovernorTr]
localConnectionManagerTr <- mkCardanoTracer
trBase trForward mbTrEKG
"LocalConnectionManager"
namesForConnectionManager
severityConnectionManager
allPublic
configureTracers trConfig docConnectionManager [localConnectionManagerTr]
localServerTr <- mkCardanoTracer
trBase trForward mbTrEKG
"LocalServer"
namesForServer
severityServer
allPublic
configureTracers trConfig docServer [localServerTr]
localInboundGovernorTr <- mkCardanoTracer
trBase trForward mbTrEKG
"LocalInboundGovernor"
namesForInboundGovernor
severityInboundGovernor
allPublic
configureTracers trConfig docInboundGovernor [localInboundGovernorTr]
pure $ Diffusion.P2PTracers P2P.TracersExtra
{ P2P.dtTraceLocalRootPeersTracer = Tracer $
traceWith localRootPeersTr
Expand All @@ -690,10 +711,13 @@ mkDiffusionTracersExtra trBase trForward mbTrEKG _trDataPoint trConfig EnabledP2
, P2P.dtServerTracer = Tracer $
traceWith serverTr
, P2P.dtInboundGovernorTracer = Tracer $
traceWith inboundGovernorTr --withMetrics
, P2P.dtLocalConnectionManagerTracer = undefined
, P2P.dtLocalServerTracer = undefined
, P2P.dtLocalInboundGovernorTracer = undefined
traceWith inboundGovernorTr
, P2P.dtLocalConnectionManagerTracer = Tracer $
traceWith localConnectionManagerTr
, P2P.dtLocalServerTracer = Tracer $
traceWith localServerTr
, P2P.dtLocalInboundGovernorTracer = Tracer $
traceWith localInboundGovernorTr
}

mkDiffusionTracersExtra trBase trForward mbTrEKG _trDataPoint trConfig DisabledP2PMode = do
Expand Down

0 comments on commit cfc959e

Please sign in to comment.