Skip to content

Commit

Permalink
CAD-1262: Remove 'Forks created' metric.
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Shevchenko committed Jun 22, 2020
1 parent a1dd8eb commit e87d75e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
11 changes: 0 additions & 11 deletions cardano-node/src/Cardano/Node/TUI/LiveView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ data LiveViewState blk a = LiveViewState
, lvsNodeCannotLead :: !Word64
, lvsLeaderNum :: !Word64
, lvsSlotsMissedNum :: !Word64
, lvsCreatedForksNum :: !Word64
, lvsTransactions :: !Word64
, lvsPeersConnected :: !Word64
, lvsMempool :: !Word64
Expand Down Expand Up @@ -412,13 +411,6 @@ instance IsEffectuator (LiveViewBackend blk) Text where

return $ lvs { lvsSlotsMissedNum = fromIntegral missedSlotsNum }

LogValue "forksCreatedNum" (PureI createdForksNum) ->
modifyMVar_ (getbe lvbe) $ \lvs -> do

checkForUnexpectedThunks ["forksCreatedNum LiveViewBackend"] lvs

return $ lvs { lvsCreatedForksNum = fromIntegral createdForksNum }

_ -> pure ()

checkForUnexpectedThunks ["Cardano node metrics dispatch LiveViewBackend"] lvbe
Expand Down Expand Up @@ -512,7 +504,6 @@ initLiveViewState = do
, lvsNodeCannotLead = 0
, lvsLeaderNum = 0
, lvsSlotsMissedNum = 0
, lvsCreatedForksNum = 0
, lvsTransactions = 0
, lvsPeersConnected = 0
, lvsMempool = 0
Expand Down Expand Up @@ -949,7 +940,6 @@ nodeInfoLabels =
, txt "slots lead:"
, txt "slots missed:"
, txt "cannot lead:"
, txt "forks created:"
, padTop (T.Pad 1) $ txt "TXs processed:"
, padTop (T.Pad 1) $ txt "peers:"
]
Expand All @@ -970,7 +960,6 @@ nodeInfoValues lvs =
, str (show . lvsLeaderNum $ lvs)
, str (show . lvsSlotsMissedNum $ lvs)
, str (show . lvsNodeCannotLead $ lvs)
, str (show . lvsCreatedForksNum $ lvs)
, padTop (T.Pad 1) $ str (show . lvsTransactions $ lvs)
, padTop (T.Pad 1) $ str (show . lvsPeersConnected $ lvs)
]
Expand Down
25 changes: 3 additions & 22 deletions cardano-node/src/Cardano/Tracing/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,10 @@ data BlockchainCounters = BlockchainCounters
, bcNodeCannotLeadNum :: !Word64
, bcNodeIsLeaderNum :: !Word64
, bcSlotsMissedNum :: !Word64
, bcForksCreatedNum :: !Word64
}

initialBlockchainCounters :: BlockchainCounters
initialBlockchainCounters = BlockchainCounters 0 0 0 0 0 0
initialBlockchainCounters = BlockchainCounters 0 0 0 0 0

-- | Smart constructor of 'NodeTraces'.
--
Expand Down Expand Up @@ -294,7 +293,7 @@ mkTracers protoInfo traceConf' tracer bcCounters = do
let tVerb = traceVerbosity traceConf
in pure Tracers
{ chainDBTracer = tracerOnOff' (traceChainDB traceConf) $
annotateSeverity . teeTraceChainTip traceConf' bcCounters elidedChainDB $ appendName "ChainDB" tracer
annotateSeverity . teeTraceChainTip traceConf' elidedChainDB $ appendName "ChainDB" tracer
, consensusTracers
= mkConsensusTracers' protoInfo elidedFetchDecision blockForgeOutcomeExtractor forgeTracers tracer (TracingOn traceConf) bcCounters
, nodeToClientTracers = nodeToClientTracers' (TracingOn traceConf) tracer
Expand Down Expand Up @@ -336,17 +335,15 @@ teeTraceChainTip
, ToObject (Header blk)
)
=> TraceOptions
-> IORef BlockchainCounters
-> MVar (Maybe (WithSeverity (ChainDB.TraceEvent blk)), Integer)
-> Trace IO Text
-> Tracer IO (WithSeverity (ChainDB.TraceEvent blk))
teeTraceChainTip tconf bChainCounters elided tr =
teeTraceChainTip tconf elided tr =
case tconf of
TracingOff -> nullTracer
TracingOn tSelect ->
Tracer $ \ev -> do
traceWith (teeTraceChainTip' tr) ev
traceWith (notifyForkIsCreated bChainCounters tr) ev
traceWith (teeTraceChainTipElide (traceVerbosity tSelect) elided tr) ev

teeTraceChainTipElide
Expand Down Expand Up @@ -390,22 +387,6 @@ teeTraceChainTip' tr =
_ -> pure ()
_ -> pure ()

notifyForkIsCreated
:: IORef BlockchainCounters
-> Trace IO Text
-> Tracer IO (WithSeverity (ChainDB.TraceEvent blk))
notifyForkIsCreated bcCounters tr =
Tracer $ \(WithSeverity _ ev') ->
case ev' of
ChainDB.TraceAddBlockEvent ev -> case ev of
ChainDB.SwitchedToAFork {} -> do
updatesForksCreated <- atomicModifyIORef' bcCounters (\cnts -> let nc = bcForksCreatedNum cnts + 1
in (cnts { bcForksCreatedNum = nc }, nc)
)
traceCounter "forksCreatedNum" updatesForksCreated tr
_ -> pure ()
_ -> pure ()

--------------------------------------------------------------------------------
-- Consensus Tracers
--------------------------------------------------------------------------------
Expand Down

0 comments on commit e87d75e

Please sign in to comment.