Skip to content

Commit c2df8fb

Browse files
committed
trace-forward: remove connectedQueueSize and disconnectedQueueSize, only queueSize
1 parent 0e8f507 commit c2df8fb

File tree

6 files changed

+24
-27
lines changed

6 files changed

+24
-27
lines changed

cardano-tracer/test/Cardano/Tracer/Test/Forwarder.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ launchForwardersSimple' ts iomgr mode howToConnect connSize disconnSize =
177177
tfConfig =
178178
TOF.ForwarderConfiguration
179179
{ TOF.forwarderTracer = nullTracer -- contramap show stdoutTracer
180-
, TOF.disconnectedQueueSize = disconnSize
181-
, TOF.connectedQueueSize = connSize
180+
-- Having two queue sizes was removed from the "trace-foirward" package.
181+
-- It will be removed from `TraceOptionForwarder` and user configuration.
182+
, TOF.queueSize = max disconnSize connSize
182183
}
183184

184185
dpfConfig :: DPF.ForwarderConfiguration

trace-forward/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# ChangeLog
22

3+
## NEXT - Nov 2025
4+
5+
* Replaced both `disconnectedQueueSize` and `connectedQueueSize` with `queueSize` (See #6361 for details).
6+
37
## 2.3.1 - Oct 2025
8+
49
* Updated to `ekg-forward-1.0`, `ouroboros-network-framework-0.19.2` and `typed-protocols-1.0`.
510

611
## 2.3.0 - Jul 2025

trace-forward/src/Trace/Forward/Configuration/TraceObject.hs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,11 @@ data AcceptorConfiguration lo = AcceptorConfiguration
2828
data ForwarderConfiguration lo = ForwarderConfiguration
2929
{ -- | The tracer that will be used by the forwarder in its network layer.
3030
forwarderTracer :: !(Tracer IO (TraceSendRecv (TraceObjectForward lo)))
31-
-- | The big size of internal queue for tracing items. We use it in
32-
-- the beginning of the session, to avoid queue overflow, because
33-
-- initially there is no connection with acceptor yet, and the
34-
-- number of tracing items after node's start may be very big.
35-
, disconnectedQueueSize :: !Word
36-
-- | The small size of internal queue for tracing items. We use it
37-
-- after the big queue is empty, which means that acceptor is connected
38-
-- and tracing items are already forwarded to it. We switch to small
39-
-- queue to reduce memory usage in the node.
40-
, connectedQueueSize :: !Word
31+
-- | The size of the internal queue for tracing items.
32+
-- Use a size suitable for the beginning of the session, to avoid queue
33+
-- overflows, because initially there is no connection with acceptor yet,
34+
-- and the number of tracing items after the node starts may be very big.
35+
-- At the same time choose a number that reduces memory usage in the node.
36+
, queueSize :: !Word
4137
}
38+

trace-forward/src/Trace/Forward/Forwarding.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ initForwardingDelayed iomgr config magic ekgStore tracerSocketMode = liftIO $ do
111111
Nothing -> EKGF.LocalPipe ""
112112
Just (LocalPipe str, _mode) -> EKGF.LocalPipe str
113113
Just (RemoteSocket host port, _mode) -> EKGF.RemoteSocket host port
114-
connSize = tofConnQueueSize config
115-
disconnSize = tofDisconnQueueSize config
114+
-- Having two queue sizes was removed from the "trace-foirward" package.
115+
-- It will be removed from `TraceOptionForwarder` and the user configuration.
116+
queueSize = max (tofConnQueueSize config) (tofDisconnQueueSize config)
116117
verbosity = tofVerbosity config
117118
maxReconnectDelay = tofMaxReconnectDelay config
118119

@@ -129,9 +130,8 @@ initForwardingDelayed iomgr config magic ekgStore tracerSocketMode = liftIO $ do
129130
tfConfig :: TF.ForwarderConfiguration TraceObject
130131
tfConfig =
131132
TF.ForwarderConfiguration
132-
{ TF.forwarderTracer = mkTracer verbosity
133-
, TF.disconnectedQueueSize = disconnSize
134-
, TF.connectedQueueSize = connSize
133+
{ TF.forwarderTracer = mkTracer verbosity
134+
, TF.queueSize = queueSize
135135
}
136136

137137
dpfConfig :: DPF.ForwarderConfiguration
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
{-# LANGUAGE DataKinds #-}
2-
{-# LANGUAGE GADTs #-}
3-
41
module Trace.Forward.Utils.ForwardSink
52
( ForwardSink (..)
63
) where
74

8-
import Control.Concurrent.STM.TBQueue
5+
import Control.Concurrent.STM.TBQueue
96

107
data ForwardSink lo = ForwardSink
118
{ forwardQueue :: !(TBQueue lo)
12-
, disconnectedSize :: !Word
13-
, connectedSize :: !Word
149
, overflowCallback :: !([lo] -> IO ())
1510
}
11+

trace-forward/src/Trace/Forward/Utils/TraceObject.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ initForwardSink
3838
:: ForwarderConfiguration lo
3939
-> ([lo] -> IO ())
4040
-> IO (ForwardSink lo)
41-
initForwardSink ForwarderConfiguration{disconnectedQueueSize, connectedQueueSize} callback = do
41+
initForwardSink ForwarderConfiguration{queueSize} callback = do
4242
-- Initially we always create a big queue, because during node's start
4343
-- the number of tracing items may be very big.
44-
queue <- atomically $ newTBQueue (fromIntegral disconnectedQueueSize)
44+
queue <- atomically $ newTBQueue (fromIntegral queueSize)
4545
return $ ForwardSink
4646
{ forwardQueue = queue
47-
, disconnectedSize = disconnectedQueueSize
48-
, connectedSize = connectedQueueSize
4947
, overflowCallback = callback
5048
}
5149

0 commit comments

Comments
 (0)