Open MarcoPolo opened 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.
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.
If you’d consider upstreaming a patch, I’d be happy to review
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.
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.
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.