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
Showing
8 changed files
with
399 additions
and
251 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
27 changes: 27 additions & 0 deletions
27
cardano-node/src/Cardano/TraceDispatcher/Common/Formatting.hs
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,27 @@ | ||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module Cardano.TraceDispatcher.Common.Formatting | ||
( | ||
) where | ||
|
||
import Data.Aeson ((.=)) | ||
import Text.Show | ||
|
||
import Cardano.Logging | ||
import Cardano.Prelude hiding (Show, show) | ||
|
||
import Cardano.TraceDispatcher.Render (showT) | ||
|
||
import qualified Ouroboros.Network.BlockFetch.ClientState as BlockFetch | ||
|
||
|
||
instance | ||
( Show peer | ||
, LogFormatting a) | ||
=> LogFormatting (BlockFetch.TraceLabelPeer peer a) where | ||
forMachine dtal (BlockFetch.TraceLabelPeer peerid a) = | ||
mkObject [ "peer" .= showT peerid ] <> forMachine dtal a | ||
|
||
forHuman (BlockFetch.TraceLabelPeer peerid m) = "Peer is " <> showT peerid <> ". " <> forHuman m | ||
|
||
asMetrics (BlockFetch.TraceLabelPeer _peerid m) = asMetrics m |
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
52 changes: 46 additions & 6 deletions
52
cardano-node/src/Cardano/TraceDispatcher/Network/Combinators.hs
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 |
---|---|---|
@@ -1,25 +1,65 @@ | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE PolyKinds #-} | ||
|
||
module Cardano.TraceDispatcher.Network.Combinators | ||
( | ||
severityTChainSync | ||
, namesTChainSync | ||
, namesForTChainSync | ||
|
||
) where | ||
|
||
|
||
import Cardano.Logging | ||
import Cardano.Prelude | ||
|
||
import Ouroboros.Network.Block (Serialised, Tip, Point) | ||
|
||
import Ouroboros.Network.Block (Point, Serialised, Tip) | ||
import qualified Ouroboros.Network.BlockFetch.ClientState as BlockFetch | ||
import Ouroboros.Network.Codec (AnyMessageAndAgency (..)) | ||
import Ouroboros.Network.Driver.Simple (TraceSendRecv (..)) | ||
import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync) | ||
import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync (..), | ||
Message (..)) | ||
|
||
|
||
severityTChainSync :: BlockFetch.TraceLabelPeer peer (TraceSendRecv | ||
(ChainSync (Serialised blk) (Point blk) (Tip blk))) -> SeverityS | ||
severityTChainSync _ = undefined | ||
severityTChainSync (BlockFetch.TraceLabelPeer _ v) = severityTChainSync' v | ||
where | ||
severityTChainSync' (TraceSendMsg msg) = severityTChainSync'' msg | ||
severityTChainSync' (TraceRecvMsg msg) = severityTChainSync'' msg | ||
|
||
severityTChainSync'' (AnyMessageAndAgency _agency msg) = severityTChainSync''' msg | ||
|
||
severityTChainSync''' :: Message | ||
(ChainSync header point tip) from to | ||
-> SeverityS | ||
severityTChainSync''' MsgRequestNext {} = Info | ||
severityTChainSync''' MsgAwaitReply {} = Info | ||
severityTChainSync''' MsgRollForward {} = Info | ||
severityTChainSync''' MsgRollBackward {} = Info | ||
severityTChainSync''' MsgFindIntersect {} = Info | ||
severityTChainSync''' MsgIntersectFound {} = Info | ||
severityTChainSync''' MsgIntersectNotFound {} = Info | ||
severityTChainSync''' MsgDone {} = Info | ||
|
||
namesTChainSync :: BlockFetch.TraceLabelPeer peer (TraceSendRecv | ||
namesForTChainSync :: BlockFetch.TraceLabelPeer peer (TraceSendRecv | ||
(ChainSync (Serialised blk) (Point blk) (Tip blk))) -> [Text] | ||
namesTChainSync _ = undefined | ||
namesForTChainSync (BlockFetch.TraceLabelPeer _ v) = namesTChainSync v | ||
where | ||
|
||
namesTChainSync (TraceSendMsg msg) = "Send" : namesTChainSync' msg | ||
namesTChainSync (TraceRecvMsg msg) = "Recieve" : namesTChainSync' msg | ||
|
||
namesTChainSync' (AnyMessageAndAgency _agency msg) = namesTChainSync'' msg | ||
|
||
namesTChainSync'' :: Message | ||
(ChainSync header point tip) from to | ||
-> [Text] | ||
namesTChainSync'' MsgRequestNext {} = ["RequestNext"] | ||
namesTChainSync'' MsgAwaitReply {} = ["AwaitReply"] | ||
namesTChainSync'' MsgRollForward {} = ["RollForward"] | ||
namesTChainSync'' MsgRollBackward {} = ["RollBackward"] | ||
namesTChainSync'' MsgFindIntersect {} = ["FindIntersect"] | ||
namesTChainSync'' MsgIntersectFound {} = ["IntersectFound"] | ||
namesTChainSync'' MsgIntersectNotFound {} = ["IntersectNotFound"] | ||
namesTChainSync'' MsgDone {} = ["Done"] |
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
Oops, something went wrong.