Skip to content

Commit

Permalink
Merge #659
Browse files Browse the repository at this point in the history
659: CAD-722 correct context name of internal metrics r=deepfire a=CodiePP

Issue
-----------

- correct the context name of internal metrics that they are routed to the right backends and do not appear in the logs.

- This PR **does not result** in breaking changes to upstream dependencies.

Checklist
---------
- [x] This PR contains all the work required to resolve the linked issue.

- [ ] The work contained has sufficient documentation to describe what it does and how to do it.

- [ ] The work has sufficient tests and/or testing.

- [x] I have committed clear and descriptive commits. Be considerate as somebody else will have to read these.

- [x] I have added the appropriate labels to this PR.


Co-authored-by: Alexander Diemand <[email protected]>
  • Loading branch information
iohk-bors[bot] and CodiePP authored Mar 11, 2020
2 parents 6ac7c5d + 9468607 commit 26a5410
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 33 deletions.
55 changes: 28 additions & 27 deletions cardano-node/src/Cardano/Node/TUI/LiveView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
6 changes: 0 additions & 6 deletions cardano-node/src/Cardano/Tracing/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 26a5410

Please sign in to comment.