-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Denis Shevchenko
committed
May 20, 2022
1 parent
25a0803
commit 9c97b64
Showing
60 changed files
with
6,366 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Cardano.Tracer.Handlers.CheckMode | ||
( runChecker | ||
) where | ||
|
||
import Control.Concurrent.STM.TVar | ||
import Control.Monad (forever, forM_, when) | ||
import qualified Data.Map.Strict as M | ||
import Debug.Trace (traceIO) | ||
import System.Time.Extra (sleep) | ||
|
||
import Cardano.Tracer.Handlers.Metrics.Utils | ||
import Cardano.Tracer.Handlers.RTView.State.TraceObjects | ||
import Cardano.Tracer.Types | ||
|
||
-- | When 'cardano-tracer' is launched with '--check-mode' flag, it | ||
-- prints out all 'EKG.Metrics' and 'TraceObject's it receives from | ||
-- the node(s). We use it for debug purposes. | ||
runChecker | ||
:: Bool | ||
-> AcceptedMetrics | ||
-> SavedTraceObjects | ||
-> IO () | ||
runChecker itIsCheckMode acceptedMetrics savedTO = | ||
when itIsCheckMode doRunChecker | ||
where | ||
doRunChecker = forever $ do | ||
allMetrics <- M.toList <$> readTVarIO acceptedMetrics | ||
forM_ allMetrics $ \(nodeId, (ekgStore, _)) -> do | ||
metrics <- getListOfMetrics ekgStore | ||
traceIO "-----------------------" | ||
traceIO $ "All metrics from " <> show nodeId <> ": " <> show metrics | ||
traceIO "-----------------------" | ||
|
||
allTraceObjects <- M.toList <$> readTVarIO savedTO | ||
forM_ allTraceObjects $ \(nodeId, savedForNode) -> do | ||
traceIO "***********************" | ||
traceIO $ "All trace objects from " <> show nodeId <> ": " <> show savedForNode | ||
traceIO "***********************" | ||
|
||
sleep 1.0 |
Oops, something went wrong.