Skip to content

Commit 382acab

Browse files
committed
dmq: added handshake tracers
1 parent b76d530 commit 382acab

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

decentralized-message-queue/app/Main.hs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
module Main where
44

55
import Control.Monad (void)
6-
import Control.Tracer (Tracer (..), traceWith)
6+
import Control.Tracer (Tracer (..), nullTracer, traceWith)
77

88
import Data.Aeson (ToJSON)
99
import Data.Act
10+
import Data.Functor.Contravariant ((>$<))
1011
import Data.Void (Void)
11-
import Debug.Trace (traceShowM)
1212
import Options.Applicative
1313
import System.Random (newStdGen, split)
1414

@@ -47,8 +47,10 @@ runDMQ commandLineConfig = do
4747
-- combine default configuration, configuration file and command line
4848
-- options
4949
let dmqConfig@Configuration {
50-
dmqcPrettyLog = I prettyLog,
51-
dmqcTopologyFile = I topologyFile
50+
dmqcPrettyLog = I prettyLog,
51+
dmqcTopologyFile = I topologyFile,
52+
dmqcHandshakeTracer = I handshakeTracer,
53+
dmqcLocalHandshakeTracer = I localHandshakeTracer
5254
} = config' <> commandLineConfig
5355
`act`
5456
defaultConfiguration
@@ -78,8 +80,12 @@ runDMQ commandLineConfig = do
7880
dmqLimitsAndTimeouts
7981
defaultSigDecisionPolicy
8082
dmqDiffusionArguments =
81-
diffusionArguments debugTracer
82-
debugTracer
83+
diffusionArguments (if handshakeTracer
84+
then WithEventType "Handshake" >$< tracer
85+
else nullTracer)
86+
(if localHandshakeTracer
87+
then WithEventType "Handshake" >$< tracer
88+
else nullTracer)
8389
dmqDiffusionApplications =
8490
diffusionApplications nodeKernel
8591
dmqConfig
@@ -92,6 +98,3 @@ runDMQ commandLineConfig = do
9298
(dmqDiffusionTracers dmqConfig tracer)
9399
dmqDiffusionConfiguration
94100
dmqDiffusionApplications
95-
96-
debugTracer :: (Show a, Applicative m) => Tracer m a
97-
debugTracer = Tracer traceShowM

decentralized-message-queue/src/DMQ/Configuration.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ defaultConfiguration = Configuration {
210210
dmqcMuxTracer = I False,
211211
dmqcChannelTracer = I False,
212212
dmqcBearerTracer = I False,
213-
dmqcHandshakeTracer = I False,
213+
dmqcHandshakeTracer = I True,
214214
dmqcLocalMuxTracer = I True,
215215
dmqcLocalChannelTracer = I False,
216216
dmqcLocalBearerTracer = I False,
217-
dmqcLocalHandshakeTracer = I False,
217+
dmqcLocalHandshakeTracer = I True,
218218
dmqcDiffusionTracer = I True,
219219
dmqcTraceLocalRootPeersTracer = I False,
220220
dmqcTracePublicRootPeersTracer = I False,
@@ -223,7 +223,7 @@ defaultConfiguration = Configuration {
223223
dmqcTraceChurnCounters = I False,
224224
dmqcDebugPeerSelectionInitiatorTracer = I False,
225225
dmqcDebugPeerSelectionInitiatorResponderTracer = I False,
226-
dmqcTracePeerSelectionCounters = I False,
226+
dmqcTracePeerSelectionCounters = I True,
227227
dmqcPeerSelectionActionsTracer = I False,
228228
dmqcConnectionManagerTracer = I True,
229229
dmqcConnectionManagerTransitionTracer = I False,

0 commit comments

Comments
 (0)