-
Notifications
You must be signed in to change notification settings - Fork 91
Fmaste/dmq node traces #5233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
fmaste
wants to merge
20
commits into
main
Choose a base branch
from
fmaste/dmq-node-traces
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Fmaste/dmq node traces #5233
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
71fdf5b
Hot connection durations
crocodile-dentist 1d0e44c
changelog
crocodile-dentist 0961d35
Merge pull request #5146 from IntersectMBO/mwojtowicz/track-connectio…
crocodile-dentist c7a45c7
Restore tracking of 'PeerHotDuration' when demoting a peer
crocodile-dentist ccb7ddb
Merge pull request #5168 from IntersectMBO/mwojtowicz/track-connectio…
coot 82df769
Retain original CBOR encoding of {Ledger}RelayAccessPoint
coot 604013c
NodeToClientV_22: support SRV in GetLedgerPeerSnapshot
coot 8300520
ouroboros-network-0.22.1
coot e307020
Merge pull request #5166 from IntersectMBO/coot/release-0.22
coot e79d6af
quickcheck-monoids: fixed a build error
coot 98ee8d1
Fixed quickcheck-monoids
coot 7dadb41
Merge pull request #5170 from IntersectMBO/coot/quickcheck-monoids-fix
coot 198e84e
Default values that depend on node role (BP/Relay)
coot 3bdc028
Merge pull request #5174 from IntersectMBO/coot/bp-defaults-0.22
coot 751aaae
quickcheck-monoids: compatibility with QuickCheck-2.16
coot cb806d0
Merge pull request #5190 from IntersectMBO/coot/quickcheck-2.15
coot ed9f0e3
REMOVE ME
fmaste a3d81a1
network-mux:traces
fmaste 817dbff
ouroboros-network:traces
fmaste 3e27ce8
ouroboros-network-framework:traces
fmaste File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
89 changes: 89 additions & 0 deletions
89
ouroboros-network-framework/traces/Ouroboros/Network/Protocol/Handshake/Traces.hs
This file contains hidden or 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,89 @@ | ||
| {-# LANGUAGE FlexibleInstances #-} | ||
| {-# LANGUAGE GADTs #-} | ||
| {-# LANGUAGE OverloadedStrings #-} | ||
|
|
||
| {-# OPTIONS_GHC -Wno-orphans #-} | ||
|
|
||
| module Ouroboros.Network.Protocol.Handshake.Traces () where | ||
|
|
||
| import Cardano.Logging | ||
|
|
||
| import qualified Ouroboros.Network.Protocol.Handshake.Type as HS | ||
| import Network.TypedProtocol.Codec (AnyMessage (..)) | ||
|
|
||
| import Data.Aeson (Value (String), (.=)) | ||
| import Data.Text (Text, pack) | ||
|
|
||
| -------------------------------------------------------------------------------- | ||
| -- Handshake Tracer | ||
| -------------------------------------------------------------------------------- | ||
|
|
||
| instance (Show term, Show ntcVersion) => | ||
| LogFormatting (AnyMessage (HS.Handshake ntcVersion term)) where | ||
| forMachine _dtal (AnyMessageAndAgency stok msg) = | ||
| mconcat [ "kind" .= String kind | ||
| , "msg" .= (String . showT $ msg) | ||
| , "agency" .= String (pack $ show stok) | ||
| ] | ||
| where | ||
| kind = case msg of | ||
| HS.MsgProposeVersions {} -> "ProposeVersions" | ||
| HS.MsgReplyVersions {} -> "ReplyVersions" | ||
| HS.MsgQueryReply {} -> "QueryReply" | ||
| HS.MsgAcceptVersion {} -> "AcceptVersion" | ||
| HS.MsgRefuse {} -> "Refuse" | ||
|
|
||
| forHuman (AnyMessageAndAgency stok msg) = | ||
| "Handshake (agency, message) = " <> "(" <> showT stok <> "," <> showT msg <> ")" | ||
|
|
||
| instance MetaTrace (AnyMessage (HS.Handshake a b)) where | ||
| namespaceFor (AnyMessage msg) = Namespace [] $ case msg of | ||
| HS.MsgProposeVersions {} -> ["ProposeVersions"] | ||
| HS.MsgReplyVersions {} -> ["ReplyVersions"] | ||
| HS.MsgQueryReply {} -> ["QueryReply"] | ||
| HS.MsgAcceptVersion {} -> ["AcceptVersion"] | ||
| HS.MsgRefuse {} -> ["Refuse"] | ||
|
|
||
| severityFor (Namespace _ [sym]) _ = case sym of | ||
| "ProposeVersions" -> Just Info | ||
| "ReplyVersions" -> Just Info | ||
| "QueryReply" -> Just Info | ||
| "AcceptVersion" -> Just Info | ||
| "Refuse" -> Just Info | ||
| _otherwise -> Nothing | ||
| severityFor _ _ = Nothing | ||
|
|
||
| documentFor (Namespace _ sym) = wrap . mconcat $ case sym of | ||
| ["ProposeVersions"] -> | ||
| [ "Propose versions together with version parameters. It must be" | ||
| , " encoded to a sorted list.." | ||
| ] | ||
| ["ReplyVersions"] -> | ||
| [ "`MsgReplyVersions` received as a response to 'MsgProposeVersions'. It" | ||
| , " is not supported to explicitly send this message. It can only be" | ||
| , " received as a copy of 'MsgProposeVersions' in a simultaneous open" | ||
| , " scenario." | ||
| ] | ||
| ["QueryReply"] -> | ||
| [ "`MsgQueryReply` received as a response to a handshake query in " | ||
| , " 'MsgProposeVersions' and lists the supported versions." | ||
| ] | ||
| ["AcceptVersion"] -> | ||
| [ "The remote end decides which version to use and sends chosen version." | ||
| , "The server is allowed to modify version parameters." | ||
| ] | ||
| ["Refuse"] -> ["It refuses to run any version."] | ||
| _otherwise -> [] :: [Text] | ||
| where | ||
| wrap it = case it of | ||
| "" -> Nothing | ||
| it' -> Just it' | ||
|
|
||
| allNamespaces = [ | ||
| Namespace [] ["ProposeVersions"] | ||
| , Namespace [] ["ReplyVersions"] | ||
| , Namespace [] ["QueryReply"] | ||
| , Namespace [] ["AcceptVersion"] | ||
| , Namespace [] ["Refuse"] | ||
| ] | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
main,ouroboros-network-frameworkwas integrated withouroboros-networkpackage, when you'll be rebasing, it might be a good idea to just put all the instances in a single package inouroboros-network, even in a single module, since here there's just one orphan instance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better place is
cardano-diffusionpackage?