-
Notifications
You must be signed in to change notification settings - Fork 37.7k
cli -netinfo peer connections dashboard updates π β¨ #20764
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
30a5dfb
to
962ec9f
Compare
Concept ACK |
Concept ACK. Is this ready to move out of draft? Would perhaps get more review if out of draft? |
Concept ACK
|
962ec9f
to
f095dd3
Compare
Moved out of draft and ready for review with updated PR description and "how to test" suggestions. The last commit that adds displaying BIP152 high-bandwidth peers can't be backported to rc4, but the other commits, including the user help, could be if desired. New help doc
|
Neat! |
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.
Concept ACK, I tried it out - very nice :)
An idea - you could omit the txn
column during IBD since the node isn't validating (and shouldn't be receiving) txns at all.
The second table should be mentioned in help
imo, and in general just seems really weird to me. We have a column after the "overall totals" and it has a slot for inbound block-relay-only, which doesn't exist afaik? Seems like it would make more sense for block/manual to be rows instead or have a separate table or something.
Thanks for your ideas @glozow!
This is valuable, as I don't have a fresh perspective. I'd like to keep the connection counts in as compact a format as we can, but any ideas welcome. How about this? Edit: updated the screenshot in the PR description to this |
f095dd3
to
8fd58ed
Compare
Updated:
|
Updated help doc
|
Very nice that Santa Claus also came to present a gift to Bitcoin Core ;) π
|
8fd58ed
to
aab4d1a
Compare
Rebased on top of #20829 (the first commit, "netinfo: add user help documentation"). |
aab4d1a
to
6d660c9
Compare
6f2c4fd netinfo: add user help documentation (Jon Atack) Pull request description: This is the help doc commit of #20764 without the rest of the PR or anything new since the 0.21.0 branch-off in order to target giving users a -netinfo help doc for 0.21. - to test the new help ``` $ ./src/bitcoin-cli -netinfo help ``` - to see the updated short help ``` $ ./src/bitcoin-cli -help | grep -A4 netinfo ``` <details><summary><code>-netinfo</code> help doc</summary><p> ``` $ ./src/bitcoin-cli -netinfo help -netinfo level "help" Returns a network peer connections dashboard with information from the remote server. Under the hood, -netinfo fetches the data by calling getpeerinfo and getnetworkinfo. An optional integer argument from 0 to 4 can be passed for different peers listings. Pass "help" to see this detailed help documentation. If more than one argument is passed, only the first one is read and parsed. Suggestion: use with the Linux watch(1) command for a live dashboard; see example below. Arguments: 1. level (integer 0-4, optional) Specify the info level of the peers dashboard (default 0): 0 - Connection counts and local addresses 1 - Like 0 but with a peers listing (without address or version columns) 2 - Like 1 but with an address column 3 - Like 1 but with a version column 4 - Like 1 but with both address and version columns 2. help (string "help", optional) Print this help documentation instead of the dashboard. Result: * The peers listing in levels 1-4 displays all of the peers sorted by direction and minimum ping time: Column Description ------ ----------- <-> Direction "in" - inbound connections are those initiated by the peer "out" - outbound connections are those initiated by us type Type of peer connection "full" - full relay, the default "block" - block relay; like full relay but does not relay transactions or addresses net Network the peer connected through ("ipv4", "ipv6", "onion", "i2p", or "cjdns") mping Minimum observed ping time, in milliseconds (ms) ping Last observed ping time, in milliseconds (ms) send Time since last message sent to the peer, in seconds recv Time since last message received from the peer, in seconds txn Time since last novel transaction received from the peer and accepted into our mempool, in minutes blk Time since last novel block passing initial validity checks received from the peer, in minutes age Duration of connection to the peer, in minutes asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying peer selection (only displayed if the -asmap config option is set) id Peer index, in increasing order of peer connections since node startup address IP address and port of the peer version Peer version and subversion concatenated, e.g. "70016/Satoshi:21.0.0/" * The connection counts table displays the number of peers by direction, network, and the totals for each, as well as a column for block relay peers. * The local addresses table lists each local address broadcast by the node, the port, and the score. Examples: Connection counts and local addresses only > bitcoin-cli -netinfo Compact peers listing > bitcoin-cli -netinfo 1 Full dashboard > bitcoin-cli -netinfo 4 Full live dashboard, adjust --interval or --no-title as needed (Linux) > watch --interval 1 --no-title ./src/bitcoin-cli -netinfo 4 See this help > bitcoin-cli -netinfo help ``` </p></details> ACKs for top commit: laanwj: ACK 6f2c4fd Tree-SHA512: dd49b1ce65546dacfb8ba9f9d57de0eae55560fd05533cf26c0b5d6ec65bf1de789c3287e90a0e2f47707532fab2fe62919a4192a7ffd58ac8eec18293e9aaeb
6f2c4fd netinfo: add user help documentation (Jon Atack) Pull request description: This is the help doc commit of bitcoin#20764 without the rest of the PR or anything new since the 0.21.0 branch-off in order to target giving users a -netinfo help doc for 0.21. - to test the new help ``` $ ./src/bitcoin-cli -netinfo help ``` - to see the updated short help ``` $ ./src/bitcoin-cli -help | grep -A4 netinfo ``` <details><summary><code>-netinfo</code> help doc</summary><p> ``` $ ./src/bitcoin-cli -netinfo help -netinfo level "help" Returns a network peer connections dashboard with information from the remote server. Under the hood, -netinfo fetches the data by calling getpeerinfo and getnetworkinfo. An optional integer argument from 0 to 4 can be passed for different peers listings. Pass "help" to see this detailed help documentation. If more than one argument is passed, only the first one is read and parsed. Suggestion: use with the Linux watch(1) command for a live dashboard; see example below. Arguments: 1. level (integer 0-4, optional) Specify the info level of the peers dashboard (default 0): 0 - Connection counts and local addresses 1 - Like 0 but with a peers listing (without address or version columns) 2 - Like 1 but with an address column 3 - Like 1 but with a version column 4 - Like 1 but with both address and version columns 2. help (string "help", optional) Print this help documentation instead of the dashboard. Result: * The peers listing in levels 1-4 displays all of the peers sorted by direction and minimum ping time: Column Description ------ ----------- <-> Direction "in" - inbound connections are those initiated by the peer "out" - outbound connections are those initiated by us type Type of peer connection "full" - full relay, the default "block" - block relay; like full relay but does not relay transactions or addresses net Network the peer connected through ("ipv4", "ipv6", "onion", "i2p", or "cjdns") mping Minimum observed ping time, in milliseconds (ms) ping Last observed ping time, in milliseconds (ms) send Time since last message sent to the peer, in seconds recv Time since last message received from the peer, in seconds txn Time since last novel transaction received from the peer and accepted into our mempool, in minutes blk Time since last novel block passing initial validity checks received from the peer, in minutes age Duration of connection to the peer, in minutes asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying peer selection (only displayed if the -asmap config option is set) id Peer index, in increasing order of peer connections since node startup address IP address and port of the peer version Peer version and subversion concatenated, e.g. "70016/Satoshi:21.0.0/" * The connection counts table displays the number of peers by direction, network, and the totals for each, as well as a column for block relay peers. * The local addresses table lists each local address broadcast by the node, the port, and the score. Examples: Connection counts and local addresses only > bitcoin-cli -netinfo Compact peers listing > bitcoin-cli -netinfo 1 Full dashboard > bitcoin-cli -netinfo 4 Full live dashboard, adjust --interval or --no-title as needed (Linux) > watch --interval 1 --no-title ./src/bitcoin-cli -netinfo 4 See this help > bitcoin-cli -netinfo help ``` </p></details> ACKs for top commit: laanwj: ACK 6f2c4fd Tree-SHA512: dd49b1ce65546dacfb8ba9f9d57de0eae55560fd05533cf26c0b5d6ec65bf1de789c3287e90a0e2f47707532fab2fe62919a4192a7ffd58ac8eec18293e9aaeb
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.
Concept ACK, not tested
Good job, more information for better adaptations -netinfo
is great
6d660c9
to
0f37bed
Compare
Rebased after the merge of #20829. The diff is now much smaller and this should be ready for final review. |
0f37bed
to
69fa034
Compare
Dropped commit 97127a8 "netinfo: only display outbound block relay peers count." |
Added a commit to support displaying connections to peers via the I2P network. An |
5fc8be4
to
9628f99
Compare
Updated connection type handling to display inbounds without a "full" or "block" type description from fRelayTxes. Will give this a few days and if still no ACKs will close in favor of proposing the changes individually in separate pulls. |
You haven't started splitting this into separate pulls have you @jonatack? If no I will review this tomorrow. Otherwise I will wait for the separate pulls. |
Thanks π leaving as-is for now, one merge is easier than several π π’ |
9628f99
to
a2dd891
Compare
the i2p peer counts column is displayed iff the node is connected to at least one i2p peer, so this doesn't add clutter for users who are not running an i2p service
a2dd891
to
747cb5b
Compare
Updated the last commit to only display block relay peer counts in the outbound row, and simplified it and commit netinfo: display manual peers count by persisting the counts in a member variable instead of in the @laanwj Thanks for reviewing! I apologize for pushing again after. I think this is finally done. |
ACK 747cb5b I really like it (obviously) and I've only done limited testing (no Tor or I2P connections)
Maybe it is just me but I feel as if I'm going to have to look at the help every time to remember what My understanding is a little hazy of BIP 152 selection process too so maybe I personally just wouldn't care about this. I can look it up though! |
Thanks @michaelfolkson for reviewing! The idea is |
never-mind: it is. |
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.
Tested ACK 747cb5b - works nicely. Great that this PR only changes bitcoin-cli.
747cb5b netinfo: display only outbound block relay counts (Jon Atack) 76d198a netinfo: add i2p network (Jon Atack) 9d6aeca netinfo: add bip152 high-bandwidth to/from fields (Jon Atack) 5de7a6c netinfo: display manual peers count (Jon Atack) d3cca3b netinfo: update to use peer connection types (Jon Atack) 62bf5b7 netinfo: add ConnectionTypeForNetinfo member helper function (Jon Atack) Pull request description: Merry Bitcoin Christmas! Ho ho ho π β¨ This PR updates `-netinfo` to: - use the getpeerinfo `connection_type` field (and no longer use getpeerinfo `relaytxes` for block-relay detection) - display manual peers count, if any, in the outbound row - display the block relay counts in the outbound row only - display high-bandwidth BIP152 compact block relay peers (`hb` column, to `.` and from `*`) - add support for displaying I2P network peers, if any are present Testing and review welcome! How to test: - to run the full live dashboard (on Linux): `$ watch --interval 1 --no-title ./src/bitcoin-cli -netinfo 4` - to run the full dashboard: ``$ ./src/bitcoin-cli -netinfo 4`` - to see the help: `$ ./src/bitcoin-cli -netinfo help` - to see the help summary: `$ ./src/bitcoin-cli -help | grep -A4 netinfo` ACKs for top commit: laanwj: re-ACK 747cb5b michaelfolkson: ACK 747cb5b jonasschnelli: Tested ACK 747cb5b - works nicely. Great that this PR only changes bitcoin-cli. Tree-SHA512: 48fe23dddf3005a039190fcbc84167cd25b0a63489617fe14ea5db9a641a829b46b6e8dc7924aab6577d82a13909d157e82f715bd2ed3a8a15071957c35c19f3
7d3343f cli: update -netinfo help doc following the merge of 882ce25 (Jon Atack) ef614bb cli: small -netinfo simplification and performance improvement (Jon Atack) 6b45ef3 cli: improve -netinfo invalid argument error message (Jon Atack) 3732404 cli: warn in help that -netinfo is not intended to be a stable API (Jon Atack) 7afdd72 cli: enable -netinfo help to run without a remote server (Jon Atack) Pull request description: A few updates, some per IRC discussion today at http://www.erisian.com.au/bitcoin-core-dev/log-2021-01-07.html#l-87 with respect to -netinfo: - enable `-netinfo help` to run without a remote server - warn in `-netinfo help` that -netinfo is not intended to be a stable API - improve the -netinfo invalid argument error message - make a performance improvement and simplification I noticed after the merge of #20764 - update the -netinfo help doc following the merge of #21192 ----- How to test manually: π¬ π§ͺ π 1. check out and build this branch locally; if you need help, don't hesitate to refer to https://jonatack.github.io/articles/how-to-review-pull-requests-in-bitcoin-core#pull-down-the-code-locally or https://jonatack.github.io/articles/how-to-compile-bitcoin-core-and-run-the-tests 2. while it is compiling, look at the code changes 3. stop signet (if it is running) with `./src/bitcoin-cli -signet stop` 4. once the build is completed, run `./src/bitcoin-cli -signet -netinfo help` 5. the help should be printed even though the signet server is not running 6. near the top you should see the new warning, "This human-readable interface will change regularly and is not intended to be a stable API" as well as a bit more description about the integer argument values. 7. start signet with `./src/bitcoind -signet` 8. test the improved invalid argument error message if you run `./src/bitcoin-cli -signet -netinfo 256` or `./src/bitcoin-cli -signet -netinfo a` (valid values are from 0 to 255) 9. leave review feedback or `ACK <commit hash>` -- done π» ACKs for top commit: michaelfolkson: Re-ACK 7d3343f pinheadmz: RE-ACK 7d3343f Tree-SHA512: 28c5e9f295ffccba5c2a70faac4987d45f35d4758cf8f10daa767e83212316c4cfc65930e4066f7ad627e9d15b92d43439d1ba9c2f755dfde61885c6a70aa155
Merry Bitcoin Christmas! Ho ho ho π β¨
This PR updates
-netinfo
to:connection_type
field (and no longer use getpeerinforelaytxes
for block-relay detection)hb
column, to.
and from*
)Testing and review welcome! How to test:
$ watch --interval 1 --no-title ./src/bitcoin-cli -netinfo 4
$ ./src/bitcoin-cli -netinfo 4
$ ./src/bitcoin-cli -netinfo help
$ ./src/bitcoin-cli -help | grep -A4 netinfo