Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,11 @@ instance MetaTrace (FetchDecision [Point header]) where
namespaceFor (Left _) = Namespace [] ["Decline"]
namespaceFor (Right _) = Namespace [] ["Accept"]

severityFor (Namespace _ ["Decline"]) (Just (Left FetchDeclineChainIntersectionTooDeep)) = Just Debug
severityFor (Namespace _ ["Decline"]) (Just (Left FetchDeclineChainNotPlausible)) = Just Notice
severityFor (Namespace _ ["Decline"]) (Just (Left FetchDeclineAlreadyFetched)) = Just Debug
severityFor (Namespace _ ["Decline"]) (Just (Left FetchDeclineInFlightThisPeer)) = Just Debug
severityFor (Namespace _ ["Decline"]) (Just (Left FetchDeclineInFlightOtherPeer)) = Just Debug
severityFor (Namespace _ ["Decline"]) _ = Just Info
severityFor (Namespace _ ["Accept"]) _ = Just Info
severityFor _ _ = Nothing
Expand Down
90 changes: 52 additions & 38 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ module Cardano.Node.Tracing.Tracers.P2P
() where

import Cardano.Logging
import Cardano.Network.Diffusion (TraceChurnMode (..))
import Cardano.Network.Diffusion.Types
import qualified Cardano.Network.PeerSelection.ExtraRootPeers as Cardano.PublicRootPeers
import qualified Cardano.Network.PeerSelection.Governor.PeerSelectionState as Cardano
import qualified Cardano.Network.PeerSelection.Governor.Types as Cardano
import Cardano.Network.PeerSelection.PeerTrustable (PeerTrustable)
import Cardano.Node.Configuration.TopologyP2P ()
import Cardano.Node.Tracing.Tracers.NodeToNode ()
import Cardano.Tracing.OrphanInstances.Network ()
Expand All @@ -39,7 +37,6 @@ import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (.
peerSelectionStateToCounters)
import Ouroboros.Network.PeerSelection.Governor.Types (DemotionTimeoutException)
import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..))
import Ouroboros.Network.PeerSelection.RelayAccessPoint (RelayAccessPoint)
import Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions (DNSTrace (..))
import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers
(TraceLocalRootPeers (..))
Expand Down Expand Up @@ -91,12 +88,7 @@ instance LogFormatting NtN.RemoteAddress where
-- LocalRootPeers Tracer
--------------------------------------------------------------------------------

instance
( ToJSONKey ntnAddr
, ToJSON ntnAddr
, ToJSONKey RelayAccessPoint
, Show ntnAddr
) => LogFormatting (TraceLocalRootPeers PeerTrustable ntnAddr) where
instance LogFormatting CardanoTraceLocalRootPeers where
forMachine _dtal (TraceLocalRootDomains groups) =
mconcat [ "kind" .= String "LocalRootDomains"
, "localRootDomains" .= toJSON groups
Expand Down Expand Up @@ -215,7 +207,7 @@ instance MetaTrace TracePublicRootPeers where
-- PeerSelection Tracer
--------------------------------------------------------------------------------

instance LogFormatting (TracePeerSelection Cardano.DebugPeerSelectionState PeerTrustable (Cardano.PublicRootPeers.ExtraPeers SockAddr) SockAddr) where
instance LogFormatting CardanoTracePeerSelection where
forMachine _dtal (TraceLocalRootPeersChanged lrp lrp') =
mconcat [ "kind" .= String "LocalRootPeersChanged"
, "previous" .= toJSON lrp
Expand Down Expand Up @@ -889,7 +881,7 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers Soc
-- DebugPeerSelection Tracer
--------------------------------------------------------------------------------

instance LogFormatting (DebugPeerSelection Cardano.ExtraState PeerTrustable (Cardano.PublicRootPeers.ExtraPeers SockAddr) SockAddr) where
instance LogFormatting CardanoDebugPeerSelection where
forMachine dtal@DNormal (TraceGovernorState blockedAt wakeupAfter
st@PeerSelectionState { targets }) =
mconcat [ "kind" .= String "DebugPeerSelection"
Expand Down Expand Up @@ -1256,9 +1248,8 @@ instance MetaTrace (PeerSelectionActionsTrace SockAddr lAddr) where
-- Connection Manager Tracer
--------------------------------------------------------------------------------

instance (Show addr, Show versionNumber, Show agreedOptions, LogFormatting addr,
ToJSON addr, ToJSON versionNumber, ToJSON agreedOptions)
=> LogFormatting (ConnectionManager.Trace addr (ConnectionHandlerTrace versionNumber agreedOptions)) where
instance (Show addr, LogFormatting addr, ToJSON addr, LogFormatting handler, Show handler)
=> LogFormatting (ConnectionManager.Trace addr handler) where
forMachine dtal (TrIncludeConnection prov peerAddr) =
mconcat $ reverse
[ "kind" .= String "IncludeConnection"
Expand Down Expand Up @@ -1307,11 +1298,11 @@ instance (Show addr, Show versionNumber, Show agreedOptions, LogFormatting addr,
, "provenance" .= String (pack . show $ prov)
, "remoteAddress" .= forMachine dtal remoteAddress
]
forMachine dtal (TrConnectionHandler connId a) =
forMachine dtal (TrConnectionHandler connId handler) =
mconcat
[ "kind" .= String "ConnectionHandler"
, "connectionId" .= toJSON connId
, "connectionHandler" .= forMachine dtal a
, "connectionHandler" .= forMachine dtal handler
]
forMachine _dtal TrShutdown =
mconcat
Expand Down Expand Up @@ -1450,15 +1441,15 @@ instance (Show versionNumber, ToJSON versionNumber, ToJSON agreedOptions)
, "command" .= show cerr
]

instance MetaTrace (ConnectionManager.Trace addr
(ConnectionHandlerTrace versionNumber agreedOptions)) where
instance MetaTrace handler => MetaTrace (ConnectionManager.Trace addr handler) where
namespaceFor TrIncludeConnection {} = Namespace [] ["IncludeConnection"]
namespaceFor TrReleaseConnection {} = Namespace [] ["UnregisterConnection"]
namespaceFor TrConnect {} = Namespace [] ["Connect"]
namespaceFor TrConnectError {} = Namespace [] ["ConnectError"]
namespaceFor TrTerminatingConnection {} = Namespace [] ["TerminatingConnection"]
namespaceFor TrTerminatedConnection {} = Namespace [] ["TerminatedConnection"]
namespaceFor TrConnectionHandler {} = Namespace [] ["ConnectionHandler"]
namespaceFor (TrConnectionHandler _ hdl) =
nsPrependInner "ConnectionHandler" (namespaceFor hdl)
namespaceFor TrShutdown {} = Namespace [] ["Shutdown"]
namespaceFor TrConnectionExists {} = Namespace [] ["ConnectionExists"]
namespaceFor TrForbiddenConnection {} = Namespace [] ["ForbiddenConnection"]
Expand All @@ -1480,28 +1471,20 @@ instance MetaTrace (ConnectionManager.Trace addr
severityFor (Namespace _ ["ConnectError"]) _ = Just Info
severityFor (Namespace _ ["TerminatingConnection"]) _ = Just Debug
severityFor (Namespace _ ["TerminatedConnection"]) _ = Just Debug
severityFor (Namespace _ ["ConnectionHandler"])
(Just (TrConnectionHandler _ ev')) = Just $
case ev' of
TrHandshakeSuccess {} -> Info
TrHandshakeQuery {} -> Info
TrHandshakeClientError {} -> Notice
TrHandshakeServerError {} -> Info
TrConnectionHandlerError _ _ ShutdownNode -> Critical
TrConnectionHandlerError _ _ ShutdownPeer -> Info
severityFor (Namespace _ ["ConnectionHandler"]) _ = Just Info
severityFor (Namespace out ("ConnectionHandler" : tl)) (Just (TrConnectionHandler _ hdl)) =
severityFor (Namespace out tl) (Just hdl)
severityFor (Namespace _ ("ConnectionHandler" : _)) Nothing = Just Info
severityFor (Namespace _ ["Shutdown"]) _ = Just Info
severityFor (Namespace _ ["ConnectionExists"]) _ = Just Info
severityFor (Namespace _ ["ForbiddenConnection"]) _ = Just Info
severityFor (Namespace _ ["ImpossibleConnection"]) _ = Just Info
severityFor (Namespace _ ["ConnectionFailure"]) _ = Just Info
severityFor (Namespace _ ["ConnectionNotFound"]) _ = Just Debug
severityFor (Namespace _ ["ForbiddenOperation"]) _ = Just Info
severityFor (Namespace _ ["PruneConnections"]) _ = Just Notice
severityFor (Namespace _ ["ConnectionCleanup"]) _ = Just Debug
severityFor (Namespace _ ["ConnectionTimeWait"]) _ = Just Debug
severityFor (Namespace _ ["ConnectionTimeWaitDone"]) _ = Just Info
severityFor (Namespace _ ["ConnectionManagerCounters"]) _ = Just Debug
severityFor (Namespace _ ["ConnectionManagerCounters"]) _ = Just Info
severityFor (Namespace _ ["State"]) _ = Just Info
severityFor (Namespace _ ["UnexpectedlyFalseAssertion"]) _ = Just Error
severityFor _ _ = Nothing
Expand All @@ -1512,11 +1495,11 @@ instance MetaTrace (ConnectionManager.Trace addr
documentFor (Namespace _ ["ConnectError"]) = Just ""
documentFor (Namespace _ ["TerminatingConnection"]) = Just ""
documentFor (Namespace _ ["TerminatedConnection"]) = Just ""
documentFor (Namespace _ ["ConnectionHandler"]) = Just ""
documentFor (Namespace out ("ConnectionHandler" : tl)) =
documentFor (Namespace out tl :: Namespace handler)
documentFor (Namespace _ ["Shutdown"]) = Just ""
documentFor (Namespace _ ["ConnectionExists"]) = Just ""
documentFor (Namespace _ ["ForbiddenConnection"]) = Just ""
documentFor (Namespace _ ["ImpossibleConnection"]) = Just ""
documentFor (Namespace _ ["ConnectionFailure"]) = Just ""
documentFor (Namespace _ ["ConnectionNotFound"]) = Just ""
documentFor (Namespace _ ["ForbiddenOperation"]) = Just ""
Expand Down Expand Up @@ -1546,11 +1529,9 @@ instance MetaTrace (ConnectionManager.Trace addr
, Namespace [] ["ConnectError"]
, Namespace [] ["TerminatingConnection"]
, Namespace [] ["TerminatedConnection"]
, Namespace [] ["ConnectionHandler"]
, Namespace [] ["Shutdown"]
, Namespace [] ["ConnectionExists"]
, Namespace [] ["ForbiddenConnection"]
, Namespace [] ["ImpossibleConnection"]
, Namespace [] ["ConnectionFailure"]
, Namespace [] ["ConnectionNotFound"]
, Namespace [] ["ForbiddenOperation"]
Expand All @@ -1560,8 +1541,41 @@ instance MetaTrace (ConnectionManager.Trace addr
, Namespace [] ["ConnectionTimeWaitDone"]
, Namespace [] ["ConnectionManagerCounters"]
, Namespace [] ["State"]
, Namespace [] ["UnexpectedlyFalseAssertion"]
]
, Namespace [] ["UnexpectedlyFalseAssertion"]]
++ map (nsPrependInner "ConnectionHandler")
(allNamespaces :: [Namespace handler])


instance MetaTrace (ConnectionHandlerTrace versionNumber agreedOptions) where
namespaceFor TrHandshakeSuccess {} = Namespace [] ["HandshakeSuccess"]
namespaceFor TrHandshakeQuery {} = Namespace [] ["HandshakeQuery"]
namespaceFor TrHandshakeClientError {} = Namespace [] ["HandshakeClientError"]
namespaceFor TrHandshakeServerError {} = Namespace [] ["HandshakeServerError"]
namespaceFor TrConnectionHandlerError {} = Namespace [] ["Error"]

severityFor (Namespace _ ["HandshakeSuccess"]) _ = Just Info
severityFor (Namespace _ ["HandshakeQuery"]) _ = Just Info
severityFor (Namespace _ ["HandshakeClientError"]) _ = Just Notice
severityFor (Namespace _ ["HandshakeServerError"]) _ = Just Info
severityFor (Namespace _ ["Error"]) (Just (TrConnectionHandlerError _ _ ShutdownNode)) = Just Critical
severityFor (Namespace _ ["Error"]) (Just (TrConnectionHandlerError _ _ ShutdownPeer)) = Just Info
severityFor (Namespace _ ["Error"]) Nothing = Just Info
severityFor _ _ = Nothing

documentFor (Namespace _ ["HandshakeSuccess"]) = Just ""
documentFor (Namespace _ ["HandshakeQuery"]) = Just ""
documentFor (Namespace _ ["HandshakeClientError"]) = Just ""
documentFor (Namespace _ ["HandshakeServerError"]) = Just ""
documentFor (Namespace _ ["Error"]) = Just ""
documentFor _ = Nothing

allNamespaces = [
Namespace [] ["HandshakeSuccess"]
, Namespace [] ["HandshakeQuery"]
, Namespace [] ["HandshakeClientError"]
, Namespace [] ["HandshakeServerError"]
, Namespace [] ["Error"]
]

--------------------------------------------------------------------------------
-- Connection Manager Transition Tracer
Expand Down
Loading