Skip to content

Commit 532cdad

Browse files
authored
Merge pull request #6244 from IntersectMBO/coot/fixed-tcpinfo-trace
Fixed TCPInfo trace
2 parents 48d52da + 383d169 commit 532cdad

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

cardano-node/cardano-node.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ library
182182
, io-classes >= 1.5
183183
, iohk-monitoring ^>= 0.2
184184
, microlens
185+
, network-mux
185186
, iproute
186187
, lobemo-backend-aggregation
187188
, lobemo-backend-ekg ^>= 0.2

cardano-node/src/Cardano/Node/Tracing/Tracers/Diffusion.hs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module Cardano.Node.Tracing.Tracers.Diffusion
1818
import Cardano.Logging
1919
import Cardano.Node.Configuration.TopologyP2P ()
2020

21+
#ifdef linux_HOST_OS
22+
import Network.Mux.TCPInfo (StructTCPInfo (..))
23+
#endif
2124
import qualified Ouroboros.Network.Diffusion.Common as Common
2225
import qualified Ouroboros.Network.NodeToNode as NtN
2326
import Ouroboros.Network.PeerSelection.LedgerPeers (NumberOfPeers (..), PoolStake (..),
@@ -234,21 +237,21 @@ instance LogFormatting Mux.Trace where
234237
[ "kind" .= String "Mux.TraceStopped"
235238
, "msg" .= String "Mux stoppped"
236239
]
237-
#ifdef os_HOST_linux
240+
#ifdef linux_HOST_OS
238241
forMachine _dtal (Mux.TraceTCPInfo StructTCPInfo
239242
{ tcpi_snd_mss, tcpi_rcv_mss, tcpi_lost, tcpi_retrans
240243
, tcpi_rtt, tcpi_rttvar, tcpi_snd_cwnd }
241-
len) =
244+
len) = mconcat
242245
[ "kind" .= String "Mux.TraceTCPInfo"
243246
, "msg" .= String "TCPInfo"
244-
, "rtt" .= String (show (fromIntegral tcpi_rtt :: Word))
245-
, "rttvar" .= String (show (fromIntegral tcpi_rttvar :: Word))
246-
, "snd_cwnd" .= String (show (fromIntegral tcpi_snd_cwnd :: Word))
247-
, "snd_mss" .= String (show (fromIntegral tcpi_snd_mss :: Word))
248-
, "rcv_mss" .= String (show (fromIntegral tcpi_rcv_mss :: Word))
249-
, "lost" .= String (show (fromIntegral tcpi_lost :: Word))
250-
, "retrans" .= String (show (fromIntegral tcpi_retrans :: Word))
251-
, "length" .= String (showT len)
247+
, "rtt" .= (fromIntegral tcpi_rtt :: Word)
248+
, "rttvar" .= (fromIntegral tcpi_rttvar :: Word)
249+
, "snd_cwnd" .= (fromIntegral tcpi_snd_cwnd :: Word)
250+
, "snd_mss" .= (fromIntegral tcpi_snd_mss :: Word)
251+
, "rcv_mss" .= (fromIntegral tcpi_rcv_mss :: Word)
252+
, "lost" .= (fromIntegral tcpi_lost :: Word)
253+
, "retrans" .= (fromIntegral tcpi_retrans :: Word)
254+
, "length" .= len
252255
]
253256
#else
254257
forMachine _dtal (Mux.TraceTCPInfo _ len) = mconcat
@@ -326,17 +329,20 @@ instance LogFormatting Mux.Trace where
326329
sformat ("Terminating (" % shown % ") in " % shown) mid dir
327330
forHuman Mux.TraceStopping = "Mux stopping"
328331
forHuman Mux.TraceStopped = "Mux stoppped"
329-
#ifdef os_HOST_linux
332+
#ifdef linux_HOST_OS
330333
forHuman (Mux.TraceTCPInfo StructTCPInfo
331334
{ tcpi_snd_mss, tcpi_rcv_mss, tcpi_lost, tcpi_retrans
332335
, tcpi_rtt, tcpi_rttvar, tcpi_snd_cwnd }
333336
len) =
334-
sformat ("TCPInfo rtt % int % " rttvar " % ínt % " cwnd " % int %
335-
" smss " % int % " rmss " % int % " lost " % int %
336-
" retrans " % int % " len " %int)
337-
(fromIntegral tcpi_rtt :: Word) (fromIntegral tcpi_rttvar :: Word)
338-
(fromIntegral tcpi_snd_cwnd :: Word) (fromIntegral tcpi_snd_mss :: Word)
339-
(fromIntegral tcpi_rcv_mss :: Word) (fromIntegral tcpi_lost :: Word)
337+
sformat ("TCPInfo rtt " % int % " rttvar " % int % " snd_cwnd " % int %
338+
" snd_mss " % int % " rcv_mss " % int % " lost " % int %
339+
" retrans " % int % " len " % int)
340+
(fromIntegral tcpi_rtt :: Word)
341+
(fromIntegral tcpi_rttvar :: Word)
342+
(fromIntegral tcpi_snd_cwnd :: Word)
343+
(fromIntegral tcpi_snd_mss :: Word)
344+
(fromIntegral tcpi_rcv_mss :: Word)
345+
(fromIntegral tcpi_lost :: Word)
340346
(fromIntegral tcpi_retrans :: Word)
341347
len
342348
#else

0 commit comments

Comments
 (0)