-
Notifications
You must be signed in to change notification settings - Fork 7
cardano node and DataPoints: demo
This document provides a step-by-step example of how to work with demo-acceptor.
As you know, trace-forward library provides a new mini-protocol for working with DataPoints. And demo-acceptor is a small application allowing to ask for arbitrary DataPoint. This application is mostly for demonstration/testing if the node provides a particular DataPoint or not. If so - its value will be printed out to stdout once per second.
Since DataPoints are provided by the new tracing infrastructure, please make sure it's enabled in the node's configuration. Open the configuration file and set UseTraceDispatcher to true. Also, make sure that TraceOptionForwarder section contains valid values, for example:
"TraceOptionForwarder": {
"address": {"filePath": "/tmp/forwarder.sock"},
"mode" : "Initiator",
"queueSize" : 1000,
"verbosity" : "Maximum"
}
Since demo-acceptor is a part of cardano-tracer project, run this command in order to build it:
$ cabal build cardano-tracer
Also, you can build it directly:
$ cabal build exe:demo-acceptor
As a result, demo-acceptor will be built.
Now you can run demo-acceptor (it is assumed that you are in the directory with demo-acceptor in it):
$ ./demo-acceptor /tmp/forwarder.sock Responder NodeInfo
where:
-
/tmp/forwarder.sockis the path to the local socket. Please make sure it equals the path inTraceOptionForwarder.address.filePathfrom the node's configuration. -
Responderis a network mode fordemo-acceptor. Currently, it'sResponder, soTraceOptionForwarder.modefrom the node's configuration must beInitiator. -
NodeInfois the name ofDataPointwe want to ask.
After you ran demo-acceptor and cardano-node, you will see such output for NodeInfo:
DataPoint, name: NodeInfo, raw value: {"niName":"nixos","niCommit":"36bbbae36026dc8dc370b598b061f67ed97008b9","niStartTime":"2022-03-15T18:11:14.412855063Z","niVersion":"1.33.0","niSystemStartTime":"2017-09-23T21:44:51Z","niProtocol":"Byron; Shelley"}
...
And this is an example of output for NodeState:
DataPoint, name: NodeState, raw value: {"contents":{"tag":"StartedOpeningImmutableDB"},"tag":"NodeOpeningDbs"}
DataPoint, name: NodeState, raw value: {"contents":{"tag":"StartedOpeningVolatileDB"},"tag":"NodeOpeningDbs"}
DataPoint, name: NodeState, raw value: {"contents":"InitChainStartedSelection","tag":"NodeInitChainSelection"}
DataPoint, name: NodeState, raw value: {"contents":"InitChainSelected","tag":"NodeInitChainSelection"}
DataPoint, name: NodeState, raw value: {"contents":"InitChainSelected","tag":"NodeInitChainSelection"}
DataPoint, name: NodeState, raw value: {"contents":[26,20668,0],"tag":"NodeAddBlock"}
DataPoint, name: NodeState, raw value: {"contents":[26,21014,0],"tag":"NodeAddBlock"}
...
As you can see, demo-acceptor is displaying received DataPoint as a raw ByteString. This was made for simplicity: in this case, demo-acceptor shouldn't know an actual Haskell type of DapaPoint, so it can ask for any DataPoint provided by cardano-node.
The cardano-node wiki has moved. Please go to (https://github.com/input-output-hk/cardano-node-wiki/wiki) and look for the page there.