Heyy folks,
opened 07:40AM - 17 Jul 22 UTC
difficulty:easy
help wanted
getting-started
## Description
In order to answer questions like:
- Do most of the connect… ions to remote peers use IPv4 or IPv6? TCP, Quic or WebRTC? ...
- What protocols do remote peers support? IPv4 or IPv6? TCP, Quic or WebRTC?
I think we should expose metrics like:
```
libp2p_swarm_connections_incoming{address_stack="/ip4/tcp/"} 42
libp2p_swarm_connections_incoming{address_stack="/ip4/udp/quic/"} 42
```
and
```
# HELP: Number of connected nodes supporting a specific listen address stack, with "unrecognized\" for each peer supporting one or more unrecognized protocols.
libp2p_identify_listen_addresses{address_stack="/ip4/tcp/"} 42
```
## Requirements
1. A way to strip a `Multiaddr` of the variable parts (e.g. concrete IP or concrete port) to prevent a cardinality explosion. See example implementation https://github.com/mxinden/kademlia-exporter/blob/7c6ced0c857152f8798a54d89648c54f65d47817/src/exporter/node_store.rs#L318-L358
## Open questions
## Are you planning to do it yourself in a pull request?
Not any time soon. Happy to help contributors.
I am working on this issue and I have a few questions:
Should I make it as an implementation for a struct and print it out as a console log?
if I make it like a console, should I implement a counter for the number of nodes connected, is it tracked elsewhere?
I have figured out that I should use Gauge
from Prometheus Client, apart from this I have been asked to increment/decrement based on SwarmEvent
. I am unable to find the reference to SwarmEvent, It’ll be useful if you can mention it here!
I suggest we move this discussion the the corresponding GitHub issue on rust-libp2p.
1 Like