Skip to content

Commit 8063de9

Browse files
authored
Merge pull request #5437 from input-output-hk/jutaro/optimizeMuxTracer
Optimize Mux tracer
2 parents 54a42da + ffac5a9 commit 8063de9

File tree

17 files changed

+342
-37
lines changed

17 files changed

+342
-37
lines changed

cardano-node/cardano-node.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ library
160160
, ekg
161161
, ekg-core
162162
, filepath
163+
, formatting
163164
, generic-data
164165
, hostname
165166
, io-classes >= 0.3

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ import Ouroboros.Consensus.Util.Enclose
8383

8484
instance (LogFormatting adr, Show adr) => LogFormatting (ConnectionId adr) where
8585
forMachine _dtal (ConnectionId local' remote) =
86-
mconcat [ "connectionId" .= String (forHuman local'
86+
mconcat [ "connectionId" .= String (showT local'
8787
<> " "
88-
<> forHuman remote)
88+
<> showT remote)
8989
]
9090
forHuman (ConnectionId local' remote) =
91-
"ConnectionId " <> forHuman local' <> " " <> forHuman remote
91+
"ConnectionId " <> showT local' <> " " <> showT remote
9292

9393
--------------------------------------------------------------------------------
9494
-- TraceLabelCreds peer a

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

Lines changed: 289 additions & 5 deletions
Large diffs are not rendered by default.

cardano-tracer/cardano-tracer.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ test-suite cardano-tracer-test
280280
type: exitcode-stdio-1.0
281281
default-extensions: OverloadedStrings
282282

283+
if os(windows)
284+
buildable: False
285+
283286
hs-source-dirs: test
284287

285288
main-is: cardano-tracer-test.hs

cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Notifications/Send.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import qualified Data.Text as T
1616
import Data.Time.Clock (UTCTime)
1717
import Data.Time.Format (defaultTimeLocale, formatTime)
1818

19+
import Cardano.Logging (showT)
20+
1921
import Cardano.Tracer.Handlers.RTView.Notifications.Email
2022
import Cardano.Tracer.Handlers.RTView.Notifications.Types
2123
import Cardano.Tracer.Types

cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/EKG.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ import qualified Data.Map.Strict as M
1212
import Data.Text (intercalate, isPrefixOf)
1313
import Graphics.UI.Threepenny.Core (UI, liftIO)
1414

15+
import Cardano.Logging (showT)
16+
1517
import Cardano.Tracer.Environment
1618
import Cardano.Tracer.Handlers.Metrics.Utils
1719
import Cardano.Tracer.Handlers.RTView.UI.Utils
1820
import Cardano.Tracer.Types
19-
import Cardano.Tracer.Utils
2021

2122
updateEKGMetrics :: TracerEnv -> UI ()
2223
updateEKGMetrics TracerEnv{teAcceptedMetrics} = do

cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Logs.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Data.Time.Format (defaultTimeLocale, formatTime)
1717
import qualified Graphics.UI.Threepenny as UI
1818
import Graphics.UI.Threepenny.Core
1919

20-
import Cardano.Logging (SeverityS (..))
20+
import Cardano.Logging (SeverityS (..), showT)
2121

2222
import Cardano.Tracer.Environment
2323
import Cardano.Tracer.Handlers.RTView.State.TraceObjects

cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Nodes.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import Graphics.UI.Threepenny.Core
3535
import Text.Printf (printf)
3636
import Text.Read (readMaybe)
3737

38+
import Cardano.Logging (showT)
39+
3840
import Cardano.Tracer.Configuration
3941
import Cardano.Tracer.Environment
4042
import Cardano.Tracer.Handlers.Metrics.Utils

cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Peers.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{-# LANGUAGE OverloadedStrings #-}
21
{-# LANGUAGE NamedFieldPuns #-}
2+
{-# LANGUAGE OverloadedStrings #-}
33
{-# LANGUAGE ScopedTypeVariables #-}
44

55
module Cardano.Tracer.Handlers.RTView.Update.Peers
@@ -18,6 +18,8 @@ import qualified Data.Text as T
1818
import qualified Graphics.UI.Threepenny as UI
1919
import Graphics.UI.Threepenny.Core
2020

21+
import Cardano.Logging (showT)
22+
2123
import Cardano.Node.Tracing.Peers
2224

2325
import Cardano.Tracer.Environment
@@ -27,7 +29,6 @@ import Cardano.Tracer.Handlers.RTView.UI.Utils
2729
import Cardano.Tracer.Handlers.RTView.Update.Utils
2830
import Cardano.Tracer.Handlers.RTView.Utils
2931
import Cardano.Tracer.Types
30-
import Cardano.Tracer.Utils
3132

3233
updateNodesPeers
3334
:: TracerEnv

cardano-tracer/src/Cardano/Tracer/Utils.hs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ module Cardano.Tracer.Utils
2929
, nl
3030
, runInLoop
3131
, showProblemIfAny
32-
, showT
3332
) where
3433

3534
#if MIN_VERSION_base(4,18,0)
@@ -54,6 +53,7 @@ import qualified Data.Map.Strict as M
5453
import qualified Data.Set as S
5554
import qualified Data.Text as T
5655
import Data.Tuple.Extra (uncurry3)
56+
5757
import System.IO (hFlush, stdout)
5858
import System.Mem.Weak (deRefWeak)
5959
import qualified System.Signal as S
@@ -208,9 +208,6 @@ nl = "\n"
208208
nl = "\r\n"
209209
#endif
210210

211-
showT :: Show a => a -> T.Text
212-
showT = T.pack . show
213-
214211
-- | If 'cardano-tracer' process is going to die (by receiving some system signal),
215212
-- we want to do something before it stops.
216213
beforeProgramStops :: IO () -> IO ()

0 commit comments

Comments
 (0)