go-libp2p
go-libp2p copied to clipboard
Add a way to print resource limits and current consumption
trafficstars
What
It would be useful to have a way to inspect resource manager limits and current consumption in a go-libp2p host. This could help with debugging and monitoring.
How I currently do it
rm := h.Network().ResourceManager()
rm.ViewSystem(
func(rs network.ResourceScope) error {
fmt.Printf("stats: %+v\n", rs.Stat())
if r, ok := rs.(interface{ Limit() rcmgr.Limit }); ok {
fmt.Printf("limits: %+v\n", r.Limit())
}
return nil
},
)