It could be interesting to have a metric(s) to track how many peers are in the p2p mesh of each subscribed topic.
An addition to that could be to track how many peers "left" the mesh and how many peers "joined" the mesh between two sampling periods.
The problem is that currently the mesh is exposed gossipRouter.mesh() and it gives back the underlining mutable Map. Since that is a LinkedHashMap created via:
val mesh: MutableMap<Topic, MutableSet<PeerHandler>> = linkedMapOf()
and is not thread safe we can't safely access it to collect the data we want.
We need a more secure way of accessing the information (it could require a libp2p change)
Yep it would be good to have. I would even go further and log explanation whenever a peer score drops below some threshold(s). Here is the corresponding feature request: https://github.com/libp2p/jvm-libp2p/issues/393
It could be interesting to have a metric(s) to track how many peers are in the p2p mesh of each subscribed topic. An addition to that could be to track how many peers "left" the mesh and how many peers "joined" the mesh between two sampling periods.
The problem is that currently the mesh is exposed
gossipRouter.mesh()
and it gives back the underlining mutable Map. Since that is aLinkedHashMap
created via:and is not thread safe we can't safely access it to collect the data we want.
We need a more secure way of accessing the information (it could require a libp2p change)