From 94686077f7c4bcf8bba4d7642bd1f999f2162d93 Mon Sep 17 00:00:00 2001 From: Alexander Diemand Date: Tue, 10 Mar 2020 17:53:11 +0100 Subject: [PATCH] CAD-722 correct context name of internal metrics Signed-off-by: Alexander Diemand --- cardano-node/src/Cardano/Node/TUI/LiveView.hs | 55 ++++++++++--------- cardano-node/src/Cardano/Tracing/Tracers.hs | 6 -- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/cardano-node/src/Cardano/Node/TUI/LiveView.hs b/cardano-node/src/Cardano/Node/TUI/LiveView.hs index 53a335a97b4..9d4f5e10b1c 100644 --- a/cardano-node/src/Cardano/Node/TUI/LiveView.hs +++ b/cardano-node/src/Cardano/Node/TUI/LiveView.hs @@ -405,32 +405,40 @@ instance IsEffectuator (LiveViewBackend blk) Text where , lvsUpTime = diffUTCTime (tstamp meta) (lvsStartTime lvs) } - _ -> pure () + LogValue "txsInMempool" (PureI txsInMempool) -> + modifyMVar_ (getbe lvbe) $ \lvs -> do + let lvsMempool' = fromIntegral txsInMempool :: Word64 + percentage = fromIntegral lvsMempool' / fromIntegral (lvsMempoolCapacity lvs) :: Float - checkForUnexpectedThunks ["Cardano node metrics dispatch LiveViewBackend"] lvbe + -- Check for unexpected thunks + checkForUnexpectedThunks ["txsInMempool LiveViewBackend"] lvs - LogObject _ _ (LogValue "txsInMempool" (PureI txsInMempool)) -> - modifyMVar_ (getbe lvbe) $ \lvs -> do - let lvsMempool' = fromIntegral txsInMempool :: Word64 - percentage = fromIntegral lvsMempool' / fromIntegral (lvsMempoolCapacity lvs) :: Float + return $ lvs { lvsMempool = lvsMempool' + , lvsMempoolPerc = percentage + } + LogValue "mempoolBytes" (PureI mempoolBytes) -> + modifyMVar_ (getbe lvbe) $ \lvs -> do + let lvsMempoolBytes' = fromIntegral mempoolBytes :: Word64 + percentage = fromIntegral lvsMempoolBytes' / fromIntegral (lvsMempoolCapacityBytes lvs) :: Float - -- Check for unexpected thunks - checkForUnexpectedThunks ["txsInMempool LiveViewBackend"] lvs + -- Check for unexpected thunks + checkForUnexpectedThunks ["mempoolBytes LiveViewBackend"] lvs - return $ lvs { lvsMempool = lvsMempool' - , lvsMempoolPerc = percentage - } - LogObject _ _ (LogValue "mempoolBytes" (PureI mempoolBytes)) -> - modifyMVar_ (getbe lvbe) $ \lvs -> do - let lvsMempoolBytes' = fromIntegral mempoolBytes :: Word64 - percentage = fromIntegral lvsMempoolBytes' / fromIntegral (lvsMempoolCapacityBytes lvs) :: Float + return $ lvs { lvsMempoolBytes = lvsMempoolBytes' + , lvsMempoolBytesPerc = percentage + } + LogValue "txsProcessed" (PureI txsProcessed) -> + modifyMVar_ (getbe lvbe) $ \lvs -> do - -- Check for unexpected thunks - checkForUnexpectedThunks ["mempoolBytes LiveViewBackend"] lvs + -- Check for unexpected thunks + checkForUnexpectedThunks ["txsProcessed LiveViewBackend"] lvs + + return $ lvs { lvsTransactions = lvsTransactions lvs + fromIntegral txsProcessed } + + _ -> pure () + + checkForUnexpectedThunks ["Cardano node metrics dispatch LiveViewBackend"] lvbe - return $ lvs { lvsMempoolBytes = lvsMempoolBytes' - , lvsMempoolBytesPerc = percentage - } LogObject _ _ (LogValue "density" (PureD density)) -> modifyMVar_ (getbe lvbe) $ \lvs -> do @@ -447,13 +455,6 @@ instance IsEffectuator (LiveViewBackend blk) Text where checkForUnexpectedThunks ["connectedPeers LiveViewBackend"] lvs return $ lvs { lvsPeersConnected = fromIntegral npeers } - LogObject _ _ (LogValue "txsProcessed" (PureI txsProcessed)) -> - modifyMVar_ (getbe lvbe) $ \lvs -> do - - -- Check for unexpected thunks - checkForUnexpectedThunks ["txsProcessed LiveViewBackend"] lvs - - return $ lvs { lvsTransactions = lvsTransactions lvs + fromIntegral txsProcessed } LogObject _ _ (LogValue "blockNum" (PureI slotnum)) -> modifyMVar_ (getbe lvbe) $ \lvs -> do diff --git a/cardano-node/src/Cardano/Tracing/Tracers.hs b/cardano-node/src/Cardano/Tracing/Tracers.hs index 44d2b4ce84a..f9c3f882906 100644 --- a/cardano-node/src/Cardano/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Tracing/Tracers.hs @@ -322,14 +322,8 @@ mkTracers traceOptions tracer = do logValue3 = LogValue "mempoolBytes" $ PureI $ fromIntegral (msNumBytes tot) meta <- mkLOMeta Critical Confidential - - traceNamedObject tr (meta, logValue1) traceNamedObject tr' (meta, logValue1) - - traceNamedObject tr (meta, logValue2) traceNamedObject tr' (meta, logValue2) - - traceNamedObject tr (meta, logValue3) traceNamedObject tr' (meta, logValue3) mempoolTracer :: Tracer IO (TraceEventMempool blk)