Skip to content
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

Expose p2p mesh gauge metric #8769

Open
tbenr opened this issue Oct 22, 2024 · 1 comment
Open

Expose p2p mesh gauge metric #8769

tbenr opened this issue Oct 22, 2024 · 1 comment

Comments

@tbenr
Copy link
Contributor

tbenr commented Oct 22, 2024

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)

@Nashatyrev
Copy link
Contributor

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: libp2p/jvm-libp2p#393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@Nashatyrev @tbenr and others