pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
114 stars 28 forks source link

More detailed network traffic statistics. #329

Closed the-real-vortex-v closed 2 years ago

the-real-vortex-v commented 2 years ago

I'd like to get some more resolution of network bandwidth statistics. Currently there's only total incoming and total outgoing listed in the chart. I'd like to see some more stats like: RPC (in and out), RPC private (in/out), node only related traffic.

Is your feature request related to a problem? Please describe. Currently when we look at node bandwidth we can't see if it's being used for sending pocketnet data to a client or if it's inter node only data. When the nodes sync up with each other we quite often see lots of data being sent. We have no real way to see if that's going to clients or if it's just internode communication.

Describe the solution you'd like A clear and concise description of what you want to happen. I'd like some more stats dumped to the log files (with a debug flag). I'd like some more color codes in the graph. Dark blue,green,red,purple or whatever colors may work (this should be configurable via the config file).

Describe alternatives you've considered I don't particularly want to run a traffic sniffer to do all of this as there's no easy way to know what's internode data with out investigating this.

Additional context This could be useful to see at a glance if our nodes are stuck in an update loop as used to happen with V18 and V19 nodes quite frequently. Many node operators used to send 2 or 3 times more data when resyncing up than the entire block chain contained and the sync would never finish because some nodes where just faulty.

andyoknen commented 2 years ago

Hmm, these thoughts coincide with mine lately. In fact, there is a part of the described functionality in the logging levels, which I want to put into a separate API method. Logging "stat" and "statdetal"

curl --location --request POST '127.0.0.1:37271/' \
--header 'Authorization: Basic dGVzdDp0ZXN0' \
--header 'Content-Type: application/json' \
--data-raw '{"method":"logging","params":["+stat","+statdetail"]}'

This logging level adds minute-by-minute statistics to the log file. To regulate the accumulation time of statistics, use the configuration argument "statdepth" = 60 seconds by default