codex-storage / nim-codex

Decentralized Durability Engine
https://codex.storage
Apache License 2.0
68 stars 25 forks source link

Show extended peer information in the logs #756

Open veaceslavdoina opened 7 months ago

veaceslavdoina commented 7 months ago
We would like to get more insights about Codex peers available in the network, like Name Example Comment
App version v1.0.0
Node ID 16Uiu2HAmTzsvpoeFAW2A9vE82cfyrRuqeREAJ34zCo6zugMPrkJk
Node type Bootstrap, Storage, Validator
Agent string My node name Set via --agent-string

In that way we should be able to parse Codex logs and get some information about available peers, nodes types, app versions, etc.

Now we can use a following log line to get a peer information which replied to the ping

TRC 2024-03-30 06:40:34.699+00:00 Respond message packet topics="discv5" tid=1 dstId=ae*0b00a0 address=228.5.25.40:34560 kind=pong

We can extend it or use a separate line with all required information, like other P2P apps do.

Examples **[IPFS Kubo](https://docs.ipfs.tech/reference/kubo/cli/#ipfs)** ```shell docker run \ --rm \ -e IPFS_LOGGING=debug \ -p 4001:4001 \ -p 4001:4001/udp \ ipfs/kubo:v0.27.0 ``` ```shell ``` **[Geth](https://geth.ethereum.org/docs/fundamentals/command-line-options)** ```shell docker run \ --rm \ --entrypoint sh \ ethereum/client-go:v1.13.14 \ -c "\ geth \ --nat=extip:49.13.132.150 \ --port=4001 \ --discovery.port=4001 \ --verbosity=4 \ --mainnet \ --maxpeers=5000" ``` ```shell ... DEBUG[03-26|13:05:07.563] Adding p2p peer peercount=1 id=6b36f791352f15eb conn=dyndial addr=157.90.35.166:30303 name=Geth/v1.13.14-stable... ... DEBUG[03-26|13:05:17.215] Adding p2p peer peercount=2 id=f5611d6f1edfb4a9 conn=dyndial addr=5.9.109.240:30303 name=Geth/v1.11.5-stable/... ... DEBUG[03-26|13:05:18.921] Adding p2p peer peercount=3 id=e1a2b667698b72b8 conn=dyndial addr=35.178.8.147:32668 name=Geth/v1.3.0-unstable... ``` **[Nimbus](https://nimbus.guide/options.html)** ```shell docker run \ --rm \ --entrypoint bash \ statusim/nimbus-eth2:multiarch-v24.2.2 \ -c "\ /home/user/nimbus_beacon_node \ --nat=extip:49.13.132.150 \ --tcp-port=4001 \ --udp-port=4001 \ --log-level=DEBUG \ --network=mainnet \ --max-peers=5000 \ --hard-max-peers=5000" ``` ```shell ... DBG 2024-03-26 13:09:05.225+00:00 identify: decoded message topics="libp2p identify" conn=16U*itagBd:6602c8f1d56a808e56b0a336 pubkey=some(s...f564)) addresses=/ip4/0.0.0.0/tcp/9000/p2p/16Uiu2HAm7ym7KWgGXJnSb6mSk98JmN7j9tkzo5YU3BRstxitagBd protocols=/ipfs/ping/1.0.0,/meshsub/1.1.0,/meshsub/1.0.0 observable_address=some(/ip4/49.13.132.150/tcp/36622) proto_version=ipfs/0.1.0 agent_version=teku/teku/v24.2.0/linux-x86_64/-eclipseadoptium-openjdk64bitservervm-java-17 signedPeerRecord=None ... ```
gmega commented 1 month ago

Is this still current, @veaceslavdoina?

veaceslavdoina commented 1 month ago

It is more like a feature request and the idea is to get more insights about our networks, it was discussed in the Discord.

Since that issue was created I've found something related

cskiraly commented 1 month ago

We can add some more logging, like e.g. periodic logging of peer sets and known nodes. I'm already adding it at the DHT level (can't link yet, not yet pushed).

veaceslavdoina commented 1 month ago

It would be good to have it at the higher level of logging (and maybe a separate topic?), like DEBUG, because now we can see that only on TRACE as it is mentioned in the first post.

It also can be useful to have a dedicated and clear/simple message about the peer and all information we know about it so far. So we can parse and collect it.

veaceslavdoina commented 1 month ago

And some other tools - https://probelab.io/tools.