Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handshake and LocalHandshake Tracers #664

Merged
merged 2 commits into from
Mar 11, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,18 @@ TraceLocalErrorPolicy: True
# Trace block forging.
TraceForge: True

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: False

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: False

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: False

Expand Down
6 changes: 6 additions & 0 deletions benchmarking/cluster3nodes/configuration/log-config-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,18 @@ TraceLocalErrorPolicy: True
# Trace block forging.
TraceForge: True

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: False

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: True

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: True

Expand Down
6 changes: 6 additions & 0 deletions benchmarking/cluster3nodes/configuration/log-config-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,18 @@ TraceLocalErrorPolicy: True
# Trace block forging.
TraceForge: True

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: False

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: True

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: True

Expand Down
6 changes: 6 additions & 0 deletions benchmarking/cluster3nodes/configuration/log-config-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,18 @@ TraceLocalErrorPolicy: True
# Trace block forging.
TraceForge: True

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: False

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: True

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,18 @@ TraceLocalErrorPolicy: True
# Trace block forging.
TraceForge: False

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: False

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: False

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,18 @@ TraceLocalErrorPolicy: True
# Trace block forging.
TraceForge: False

# Trace Handshake protocol messages.
TraceHandshake: False

# Trace IP Subscription messages.
TraceIpSubscription: False

# Trace local ChainSync protocol messages.
TraceLocalChainSyncProtocol: False

# Trace local Handshake protocol messages.
TraceLocalHandshake: False

# Trace local TxSubmission protocol messages.
TraceLocalTxSubmissionProtocol: False

Expand Down
52 changes: 26 additions & 26 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -187,92 +187,92 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-network

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: io-sim

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-network-testing

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-consensus

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-consensus/ouroboros-consensus-mock

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-consensus-byron

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-consensus-cardano

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: typed-protocols

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: typed-protocols-examples

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: ouroboros-network-framework

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: network-mux

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: io-sim-classes

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 8a19e9cd6e6f8a02147cd96c4f633ac903d833b1
--sha256: 1fdm458a99lg0r3gxzzbv4fiahhcb3dgm8g6z1vklq3v3lfdrqh1
tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409
--sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6
subdir: Win32-network

source-repository-package
Expand Down
4 changes: 4 additions & 0 deletions cardano-config/src/Cardano/Config/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ instance FromJSON NodeConfiguration where
<*> v .:? "TraceDNSSubscription" .!= True
<*> v .:? "TraceErrorPolicy" .!= True
<*> v .:? "TraceForge" .!= True
<*> v .:? "TraceHandshake" .!= False
<*> v .:? "TraceIpSubscription" .!= True
<*> v .:? "TraceLocalChainSyncProtocol" .!= False
<*> v .:? "TraceLocalErrorPolicy" .!= True
<*> v .:? "TraceLocalHandshake" .!= False
<*> v .:? "TraceLocalTxSubmissionProtocol" .!= False
<*> v .:? "TraceLocalTxSubmissionServer" .!= False
<*> v .:? "TraceLocalStateQueryProtocol" .!= False
Expand Down Expand Up @@ -326,9 +328,11 @@ data TraceOptions = TraceOptions
, traceDnsSubscription :: !Bool
, traceErrorPolicy :: !Bool
, traceForge :: !Bool
, traceHandshake :: !Bool
, traceIpSubscription :: !Bool
, traceLocalChainSyncProtocol :: !Bool
, traceLocalErrorPolicy :: !Bool
, traceLocalHandshake :: !Bool
, traceLocalTxSubmissionProtocol :: !Bool
, traceLocalTxSubmissionServer :: !Bool
, traceLocalStateQueryProtocol :: !Bool
Expand Down
30 changes: 30 additions & 0 deletions cardano-config/src/Cardano/Tracing/ToObjectOrphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ import Ouroboros.Network.BlockFetch.ClientState
(TraceFetchClientState (..), TraceLabelPeer (..))
import Ouroboros.Network.BlockFetch.Decision (FetchDecision)
import Ouroboros.Network.Codec (AnyMessage (..))
import qualified Ouroboros.Network.NodeToClient as NtC
import qualified Ouroboros.Network.NodeToNode as NtN
import Ouroboros.Network.NodeToNode
(WithAddr(..), ErrorPolicyTrace(..), TraceSendRecv (..))
import Ouroboros.Network.Protocol.TxSubmission.Type
Expand Down Expand Up @@ -227,6 +229,14 @@ instance DefineSeverity (WithMuxBearer peer MuxTrace) where
MuxTraceRecvDeltaQObservation {} -> Debug
MuxTraceRecvDeltaQSample {} -> Info

instance DefinePrivacyAnnotation NtN.HandshakeTr
instance DefineSeverity NtN.HandshakeTr where
defineSeverity _ = Info

instance DefinePrivacyAnnotation NtC.HandshakeTr
instance DefineSeverity NtC.HandshakeTr where
defineSeverity _ = Info

instance DefinePrivacyAnnotation (WithTip blk (ChainDB.TraceEvent blk))
instance DefineSeverity (WithTip blk (ChainDB.TraceEvent blk)) where
defineSeverity (WithTip _tip ev) = defineSeverity ev
Expand Down Expand Up @@ -465,6 +475,14 @@ instance (Show peer)
=> Transformable Text IO (WithMuxBearer peer MuxTrace) where
trTransformer = defaultTextTransformer

-- transform @NtN.HandshakeTrace@
instance Transformable Text IO NtN.HandshakeTr where
trTransformer = defaultTextTransformer

-- transform @NtC.HandshakeTrace@
instance Transformable Text IO NtC.HandshakeTr where
trTransformer = defaultTextTransformer

-- transform @TraceEvent@
instance (Condense (HeaderHash blk), LedgerSupportsProtocol blk)
=> Transformable Text IO (WithTip blk (ChainDB.TraceEvent blk)) where
Expand Down Expand Up @@ -655,6 +673,18 @@ instance (Show peer)
, "bearer" .= show b
, "event" .= show ev ]

instance ToObject NtN.HandshakeTr where
toObject _verb (WithMuxBearer b ev) =
mkObject [ "kind" .= String "HandshakeTrace"
, "bearer" .= show b
, "event" .= show ev ]

instance ToObject NtC.HandshakeTr where
toObject _verb (WithMuxBearer b ev) =
mkObject [ "kind" .= String "LocalHandshakeTrace"
, "bearer" .= show b
, "event" .= show ev ]

instance (Condense (HeaderHash blk), LedgerSupportsProtocol blk)
=> ToObject (WithTip blk (ChainDB.TraceEvent blk)) where
-- example: turn off any tracing of @TraceEvent@s when minimal verbosity level is set
Expand Down
6 changes: 3 additions & 3 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ handleSimpleNode p trace nodeTracers npm onKernel = do
customiseChainDbArgs runValid args
| runValid
= args
{ ChainDB.cdbImmValidation = ValidateAllEpochs
{ ChainDB.cdbImmValidation = ValidateAllChunks
, ChainDB.cdbVolValidation = ValidateAll
}
| otherwise
Expand All @@ -255,8 +255,8 @@ handleSimpleNode p trace nodeTracers npm onKernel = do
, dtLocalErrorPolicyTracer = localErrorPolicyTracer nodeTracers'
, dtMuxTracer = muxTracer nodeTracers'
, dtMuxLocalTracer = nullTracer
, dtHandshakeTracer = nullTracer
, dtHandshakeLocalTracer = nullTracer
, dtHandshakeTracer = handshakeTracer nodeTracers'
, dtHandshakeLocalTracer = localHandshakeTracer nodeTracers'
}

createTracers
Expand Down
21 changes: 18 additions & 3 deletions cardano-node/src/Cardano/Tracing/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ import Ouroboros.Network.Block (Point, BlockNo(..),
blockNo, unBlockNo, unSlotNo)
import Ouroboros.Network.BlockFetch.Decision (FetchDecision)
import Ouroboros.Network.BlockFetch.ClientState (TraceLabelPeer (..))
import Ouroboros.Network.NodeToNode (WithAddr, ErrorPolicyTrace)
import qualified Ouroboros.Network.NodeToClient as NtC
import qualified Ouroboros.Network.NodeToNode as NtN
import Ouroboros.Network.Point (fromWithOrigin)
import Ouroboros.Network.Subscription

Expand Down Expand Up @@ -88,11 +89,13 @@ data Tracers peer localPeer blk = Tracers
-- | Trace the DNS resolver
, dnsResolverTracer :: Tracer IO (WithDomainName DnsTrace)
-- | Trace error policy resolution
, errorPolicyTracer :: Tracer IO (WithAddr Socket.SockAddr ErrorPolicyTrace)
, errorPolicyTracer :: Tracer IO (NtN.WithAddr Socket.SockAddr NtN.ErrorPolicyTrace)
-- | Trace local error policy resolution
, localErrorPolicyTracer :: Tracer IO (WithAddr Socket.SockAddr ErrorPolicyTrace)
, localErrorPolicyTracer :: Tracer IO (NtN.WithAddr Socket.SockAddr NtN.ErrorPolicyTrace)
-- | Trace the Mux
, muxTracer :: Tracer IO (WithMuxBearer peer MuxTrace)
, handshakeTracer :: Tracer IO NtN.HandshakeTr
, localHandshakeTracer :: Tracer IO NtC.HandshakeTr
}

data ForgeTracers = ForgeTracers
Expand All @@ -119,6 +122,8 @@ nullTracers = Tracers
, errorPolicyTracer = nullTracer
, localErrorPolicyTracer = nullTracer
, muxTracer = nullTracer
, handshakeTracer = nullTracer
, localHandshakeTracer = nullTracer
}


Expand Down Expand Up @@ -231,6 +236,16 @@ mkTracers traceOptions tracer = do
$ annotateSeverity
$ toLogObject' StructuredLogging tracingVerbosity
$ appendName "Mux" tracer
, handshakeTracer
= tracerOnOff (traceHandshake traceOptions)
$ annotateSeverity
$ toLogObject' StructuredLogging tracingVerbosity
$ appendName "Handshake" tracer
, localHandshakeTracer
= tracerOnOff (traceLocalHandshake traceOptions)
$ annotateSeverity
$ toLogObject' StructuredLogging tracingVerbosity
$ appendName "LocalHandshake" tracer
}
where
-- Turn on/off a tracer depending on what was parsed from the command line.
Expand Down
Loading