Client p2p: Pretty print p2p stat
What
Pretty prints p2p stat
Why
Because who wouldn't want this:
How
p2p full stat is currently available through ./octez-admin-client p2p stat
- The first commit moves the printing part from the client to an RPC definition in p2p_services
- The second commit adds colours and emphasis when creating a string to print
- The third commit adds the possibility to disable colours (with
-cor--no-color) - The fourth commit is an utility commit that move some code blocks to their own function that will be reused in the fifth commit
- Finally, the fifth commit creates an RPC that returns the full stats as a JSON
The RPC is not available when on insecure connection (secure ACL policy enabled)
Manually testing the MR
- Start a node:
./octez-node run --data-dir <your_data_dir> --allow-all-rpc localhost:8732 --rpc-addr localhost:8732 - In a second terminal, request stats with either
./octez-admin-client p2p stat./octez-admin-client p2p stat -c./octez-admin-client p2p stat --no-color./octez-client rpc get /network/full_stat
If you start it with
./octez-node run --data-dir <your_data_dir> --rpc-addr 0.0.0.0:8732
You should receive:
./octez-admin-client rpc get /network/full_stat
Fatal error:
[HTTP 403] Access denied to: http://localhost:8732
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Mattias
