Skip to content

Commit ffcd020

Browse files
committed
cardano-node: ledger metrics without thread delay and fixes
1 parent 3d161ac commit ffcd020

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ import Ouroboros.Network.TxSubmission.Inbound hiding (txId)
6969
import Ouroboros.Network.TxSubmission.Outbound
7070

7171
import Control.Monad (guard)
72-
import Control.Monad.Class.MonadTime.SI (Time (..))
7372
import Data.Aeson (ToJSON, Value (..), toJSON, (.=))
7473
import qualified Data.Aeson as Aeson
7574
import Data.Foldable (Foldable (toList))

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import Control.Monad.STM (atomically, retry)
3535
import "contra-tracer" Control.Tracer (Tracer, traceWith)
3636
import Data.Aeson (Value (Number, String), toJSON, (.=))
3737
import Data.Text as Text
38-
import GHC.Conc (labelThread, myThreadId, unsafeIOToSTM)
38+
import GHC.Conc (labelThread, myThreadId)
3939

4040
startLedgerMetricsTracer
4141
:: forall blk
@@ -75,9 +75,7 @@ startLedgerMetricsTracer tr everyNThSlot nodeKernelData = do
7575
mSlot <- getCurrentSlot (getBlockchainTime nk)
7676
case mSlot of
7777
CurrentSlot s' | SJust s' /= prev -> return s'
78-
_ -> do
79-
unsafeIOToSTM ( threadDelay $ 1 * 1000)
80-
retry
78+
_ -> retry
8179
) nodeKernelData
8280

8381
data LedgerMetrics =

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import Control.Concurrent (threadDelay)
1010
import Control.Concurrent.Async (async)
1111
import Control.Monad (forM_, forever)
1212
import Control.Monad.Class.MonadAsync (link)
13-
import GHC.Conc (labelThread, myThreadId)
1413
import "contra-tracer" Control.Tracer
14+
import GHC.Conc (labelThread, myThreadId)
1515

1616
-- | Starts a background thread to periodically trace resource statistics.
1717
-- The thread reads resource stats and traces them using the given tracer.
1818
-- It is linked to the parent thread to ensure proper error propagation.
19-
startResourceTracer :: Tracer IO ResourceStats -> Int -> IO ()
2019
startResourceTracer
2120
:: Tracer IO ResourceStats
2221
-> Int

0 commit comments

Comments
 (0)