libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
309 stars 178 forks source link

feature: Metrics for GossipSub #534

Open MarcoPolo opened 1 year ago

MarcoPolo commented 1 year ago

Metrics such as:

We should also include some grafana dashboards.

This should help node operators identify when their node is running into issues, or when GossipSub is limping along but still working.

vyzo commented 1 year ago

You can easily implement this with a tracer.

So an option to enable metrics, that hooks a tracer into you preferred metrics system is something the library could provide == see how it is handled in lotus.

Changing protocol code to directly hook metrics is not acceptable however.

nisdas commented 1 year ago

In Prysm, we have already implemented something pretty similar using a raw tracer: https://github.com/prysmaticlabs/prysm/blob/develop/beacon-chain/p2p/pubsub_tracer.go . It has been helpful in us identifying interesting spikes of certain control messages in the network for different topics. If a tailored metrics tracer for gossipsub lives inside go-libp2p-pubsub that would be a welcome addition on our end as we would no longer need to maintain the above.

MarcoPolo commented 1 year ago

If you’d consider upstreaming a patch, I’d be happy to review

nisdas commented 1 year ago

Thank you for the offer, I am bit occupied over the next few weeks, but once I get some bandwidth I can open up a PR for this to be upstreamed if no-one has done it yet.

vyzo commented 1 year ago

Please use a metrics subpackage in any pr for this, so that people who don't use the metrics don't incur any extra dependencies.

Just to be clear, I also think it would be a welcome addition to have in tree support for this.