Skip to content

Commit

Permalink
Added tracer and ekg metrics
Browse files Browse the repository at this point in the history
Renamed numberConns
  • Loading branch information
bolt12 authored and coot committed May 13, 2021
1 parent 0ca6e5a commit 8efa7e1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
21 changes: 11 additions & 10 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs
Expand Up @@ -442,16 +442,17 @@ instance HasPrivacyAnnotation (InboundGovernorTrace addr)
instance HasSeverityAnnotation (InboundGovernorTrace addr) where
getSeverityAnnotation ev =
case ev of
InboundGovernor.TrNewConnection {} -> Debug
InboundGovernor.TrResponderRestarted {} -> Debug
InboundGovernor.TrResponderStartFailure {} -> Error
InboundGovernor.TrResponderErrored {} -> Info
InboundGovernor.TrResponderTerminated {} -> Debug
InboundGovernor.TrPromotedToWarmRemote {} -> Info
InboundGovernor.TrDemotedToColdRemote {} -> Info
InboundGovernor.TrWaitIdleRemote {} -> Debug
InboundGovernor.TrMuxCleanExit {} -> Debug
InboundGovernor.TrMuxErrored {} -> Info
InboundGovernor.TrNewConnection {} -> Debug
InboundGovernor.TrResponderRestarted {} -> Debug
InboundGovernor.TrResponderStartFailure {} -> Error
InboundGovernor.TrResponderErrored {} -> Info
InboundGovernor.TrResponderTerminated {} -> Debug
InboundGovernor.TrPromotedToWarmRemote {} -> Info
InboundGovernor.TrDemotedToColdRemote {} -> Info
InboundGovernor.TrWaitIdleRemote {} -> Debug
InboundGovernor.TrMuxCleanExit {} -> Debug
InboundGovernor.TrMuxErrored {} -> Info
InboundGovernor.TrInboundGovernorCounters {} -> Info

--
-- | instances of @Transformable@
Expand Down
15 changes: 13 additions & 2 deletions cardano-node/src/Cardano/Tracing/Tracers.hs
Expand Up @@ -85,6 +85,8 @@ import Ouroboros.Network.Diffusion ( DiffusionTracers (..)
, ConnectionManagerTrace (..)
, PeerSelectionCounters (..)
, ConnectionManagerCounters (..)
, InboundGovernorTrace (..)
, InboundGovernorCounters (..)
)
import qualified Ouroboros.Network.Diffusion as Diffusion

Expand Down Expand Up @@ -314,6 +316,7 @@ mkTracers blockConfig tOpts@(TracingOn trSel) tr nodeKern ekgDirect = do
dtServerTracer =
tracerOnOff (traceServer trSel) verb "Server" tr,
dtInboundGovernorTracer =
traceInboundGovernorTraceMetrics ekgDirect $
tracerOnOff (traceInboundGovernor trSel) verb "InboundGovernor" tr,
dtLedgerPeersTracer =
tracerOnOff (traceLedgerPeers trSel) verb "LedgerPeers" tr,
Expand Down Expand Up @@ -1215,20 +1218,28 @@ traceConnectionManagerTraceMetrics (Just ekgDirect) _ = Tracer cmtTracer
cmtTracer :: (ConnectionManagerTrace peerAddr handlerTrace) -> IO ()
cmtTracer (TrConnectionManagerCounters
(ConnectionManagerCounters
numberConns
nConnsPruning
duplexConns
uniConns
incomingConns
outgoingConns
)
) = do
sendEKGDirectInt ekgDirect "cardano.node.metrics.connectionManager.numberConns" numberConns
sendEKGDirectInt ekgDirect "cardano.node.metrics.connectionManager.nConnsPruningg" nConnsPruning
sendEKGDirectInt ekgDirect "cardano.node.metrics.connectionManager.duplexConns" duplexConns
sendEKGDirectInt ekgDirect "cardano.node.metrics.connectionManager.uniConns" uniConns
sendEKGDirectInt ekgDirect "cardano.node.metrics.connectionManager.incomingConns" incomingConns
sendEKGDirectInt ekgDirect "cardano.node.metrics.connectionManager.outgoingConns" outgoingConns
cmtTracer _ = return ()

traceInboundGovernorTraceMetrics :: Maybe EKGDirect -> Tracer IO (InboundGovernorTrace peerAddr) -> Tracer IO (InboundGovernorTrace peerAddr)
traceInboundGovernorTraceMetrics Nothing tracer = tracer
traceInboundGovernorTraceMetrics (Just ekgDirect) _ = Tracer pscTracer
where
pscTracer :: InboundGovernorTrace peerAddr -> IO ()
pscTracer (TrInboundGovernorCounters (InboundGovernorCounters hotPeersRemote)) = do
sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.hotRemote" hotPeersRemote
pscTracer _ = return ()


tracePeerSelectionCountersMetrics :: Maybe EKGDirect -> Tracer IO PeerSelectionCounters -> Tracer IO PeerSelectionCounters
Expand Down

0 comments on commit 8efa7e1

Please sign in to comment.