Skip to content
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

Tracing documentation improvements #3500

Merged
merged 6 commits into from Jan 26, 2022
Merged

Tracing documentation improvements #3500

merged 6 commits into from Jan 26, 2022

Conversation

deepfire
Copy link
Contributor

  1. Expose the trace-documentation tracer documentation generator as a cardano-node subcommand and wire into Makefile
  2. Regenerate the tracer documentation
  3. Fix a small mistake in the New Tracing Quickstart document (thanks @coot !).

@newhoggy
Copy link
Contributor

newhoggy commented Jan 16, 2022

Can you add some background information?

For example, an example run, example output, screen capture, documentation or ticket?

1. [Cardano.Node.AcceptPolicy.ConnectionHardLimit](#cardanonodeacceptpolicyconnectionhardlimit)
1. [Cardano.Node.BlockFetch.NodeToNode.Send.BatchDone](#cardanonodeblockfetchnodetonodesendbatchdone)
1. [Cardano.Node.BlockFetch.NodeToNode.Send.Block](#cardanonodeblockfetchnodetonodesendblock)
1. [Cardano.Node.BlockFetch.NodeToNode.Send.ClientDone](#cardanonodeblockfetchnodetonodesendclientdone)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this renumbering it all ones intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@newhoggy, we're relying on Github's markdown auto-numbering.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, but we read markdowns not only on github.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure about having the trace documentation as an additional command in the cardano-node executable. This would make more sense living in cardano-cli under the Miscellanous Commands heading.

Is the plan to re-generate the documentation at doc/new-tracing/tracers_doc_generated.md each time the relevant Documented values change?

@deepfire
Copy link
Contributor Author

Is the plan to re-generate the documentation at doc/new-tracing/tracers_doc_generated.md each time the relevant Documented values change?

Yes, precisely, that's the goal.

@deepfire
Copy link
Contributor Author

I'm not so sure about having the trace documentation as an additional command in the cardano-node executable. This would make more sense living in cardano-cli under the Miscellanous Commands heading.

Then cardano-cli would have to link to cardano-node to get all the tracing instances.

( Show t
, forall result. Show (Query blk result)
docTracers :: forall blk peer remotePeer.
(forall result. Show (Query blk result)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forall result. Show (Query blk result) is unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

( Show t
, forall result. Show (Query blk result)
docTracers :: forall blk peer remotePeer.
(forall result. Show (Query blk result)
, TraceConstraints blk
, LogFormatting (ChainDB.InvalidBlockReason blk)
, LedgerSupportsProtocol blk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LedgerSupportsProtocol blk is unnecessary.

RunNode blk is pulling in 18 unnecessary constraints. I would consider creating a type synonym for the constraints needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jimbo4350, I've removed what I could, and consolidated the constraints a bit.

..but removing the RunNode constraint is very difficult as of now, because of how tangled things are at the moment.
I've spent some hours on it, and it's just not easy at all.

It'll be far easier to deal with it at the point when we'll be removing the legacy system.

Copy link
Contributor

@Jimbo4350 Jimbo4350 Jan 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me help you 😄

diff --git a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs
index 887705e29..44d19cb3b 100644
--- a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs
+++ b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs
@@ -47,11 +47,15 @@ import           Cardano.Node.Handlers.Shutdown (ShutdownTrace)
 import           Cardano.Node.Startup
 import           Cardano.Node.TraceConstraints
 
+import           Ouroboros.Consensus.Block.Forging
 import           Ouroboros.Consensus.BlockchainTime.WallClock.Types (RelativeTime)
 import           Ouroboros.Consensus.BlockchainTime.WallClock.Util (TraceBlockchainTimeEvent (..))
 import           Ouroboros.Consensus.Cardano.Block
-import           Ouroboros.Consensus.Ledger.Query (Query)
-import           Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTxId)
+import           Ouroboros.Consensus.Ledger.Inspect
+import           Ouroboros.Consensus.Ledger.Query (Query, ShowQuery)
+import           Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTxId,
+                   LedgerSupportsMempool)
+import           Ouroboros.Consensus.Ledger.SupportsProtocol
 import           Ouroboros.Consensus.Mempool.API (TraceEventMempool (..))
 import           Ouroboros.Consensus.MiniProtocol.BlockFetch.Server
                    (TraceBlockFetchServerEvent (..))
@@ -59,6 +63,7 @@ import           Ouroboros.Consensus.MiniProtocol.ChainSync.Client (TraceChainSy
 import           Ouroboros.Consensus.MiniProtocol.ChainSync.Server (TraceChainSyncServerEvent)
 import           Ouroboros.Consensus.MiniProtocol.LocalTxSubmission.Server
                    (TraceLocalTxSubmissionServerEvent (..))
+import           Ouroboros.Consensus.Node.NetworkProtocolVersion
 import qualified Ouroboros.Consensus.Node.Run as Consensus
 import qualified Ouroboros.Consensus.Node.Tracers as Consensus
 import qualified Ouroboros.Consensus.Protocol.Ledger.HotKey as HotKey
@@ -85,8 +90,8 @@ import           Ouroboros.Network.PeerSelection.RootPeersDNS (TraceLocalRootPee
                    TracePublicRootPeers (..))
 import           Ouroboros.Network.Protocol.BlockFetch.Type (BlockFetch)
 import           Ouroboros.Network.Protocol.ChainSync.Type (ChainSync)
-import           Ouroboros.Network.Protocol.Handshake.Unversioned (UnversionedProtocolData (..),
-                   UnversionedProtocol (..))
+import           Ouroboros.Network.Protocol.Handshake.Unversioned (UnversionedProtocol (..),
+                   UnversionedProtocolData (..))
 import           Ouroboros.Network.Protocol.LocalStateQuery.Type (LocalStateQuery)
 import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Type as LTS
 import           Ouroboros.Network.Protocol.TxSubmission.Type (TxSubmission)
@@ -152,11 +157,19 @@ runTraceDocumentationCmd TraceDocumentationCmd{..} = do
 -- Can be changed, when old tracers have gone
 docTracers :: forall blk peer remotePeer.
   ( TraceConstraints blk
+  , InspectLedger blk
+  , LedgerSupportsMempool blk
+  , LedgerSupportsProtocol blk
+  , Consensus.SerialiseNodeToNodeConstraints blk
   , LogFormatting peer
   , LogFormatting remotePeer
-  , Consensus.RunNode blk
+  , Show (BlockNodeToClientVersion blk)
+  , Show (BlockNodeToNodeVersion blk)
   , Show remotePeer
   , Show peer
+  , Show (ForgeStateUpdateError blk)
+  , Show (CannotForge blk)
+  , ShowQuery (BlockQuery blk)
   )
   => FilePath
   -> FilePath

What part in particular was difficult for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jimbo4350, applied your patch -- thanks a lot!

@deepfire
Copy link
Contributor Author

This is for #3510

@deepfire deepfire self-assigned this Jan 19, 2022
@deepfire deepfire force-pushed the trace-doc branch 3 times, most recently from 21af766 to 2680968 Compare January 24, 2022 22:54
@Jimbo4350 Jimbo4350 self-requested a review January 25, 2022 11:57
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just squash the last two commits into one.

@deepfire
Copy link
Contributor Author

Thank you @Jimbo4350 !

@deepfire
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jan 25, 2022
3500: Tracing documentation improvements r=deepfire a=deepfire

1. Expose the `trace-documentation` tracer documentation generator as a `cardano-node` subcommand and wire into Makefile
2. Regenerate the tracer documentation
3. Fix a small mistake in the `New Tracing Quickstart` document (thanks `@coot` !).

Co-authored-by: Kosyrev Serge <serge.kosyrev@iohk.io>
Co-authored-by: Yupanqui <jnf@arcor.de>
@Jimbo4350
Copy link
Contributor

bors cancel

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 25, 2022

Canceled.

@Jimbo4350 Jimbo4350 self-requested a review January 25, 2022 13:16
import Cardano.Logging (LogFormatting)
import Cardano.Node.Queries (ConvertTxId, GetKESInfo (..),
HasKESInfo (..), HasKESMetricsData (..), LedgerQueries)
import Cardano.BM.Tracing (ToObject)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style regression here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undone the change to ImportQualifiedPost after discussion with @Jimbo4350

Co-Authored-by: Jordan Millar <jordan.millar@iohk.io>
@deepfire
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jan 26, 2022
3500: Tracing documentation improvements r=deepfire a=deepfire

1. Expose the `trace-documentation` tracer documentation generator as a `cardano-node` subcommand and wire into Makefile
2. Regenerate the tracer documentation
3. Fix a small mistake in the `New Tracing Quickstart` document (thanks `@coot` !).

Co-authored-by: Kosyrev Serge <serge.kosyrev@iohk.io>
Co-authored-by: Yupanqui <jnf@arcor.de>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 26, 2022

This PR was included in a batch that successfully built, but then failed to merge into master. It will not be retried.

Additional information:

{"message":"Waiting on code owner review from denisshevchenko and/or jutaro.","documentation_url":"https://docs.github.com/articles/about-protected-branches"}

@deepfire
Copy link
Contributor Author

Ok, all checks and reviews passed, but some necessary people are absent, so force-merging this.

@deepfire deepfire merged commit 70b9874 into master Jan 26, 2022
@iohk-bors iohk-bors bot deleted the trace-doc branch January 26, 2022 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants