go-libp2p-resource-manager/metrics.go

20 lines
628 B
Go
Raw Permalink Normal View History

2022-02-12 00:24:53 +08:00
package rcmgr
import (
2022-08-18 20:21:11 +08:00
rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager"
2022-02-12 00:24:53 +08:00
)
// MetricsReporter is an interface for collecting metrics from resource manager actions
2022-08-18 20:21:11 +08:00
// Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.MetricsReporter instead
type MetricsReporter = rcmgr.MetricsReporter
2022-02-12 00:24:53 +08:00
type metrics struct {
reporter MetricsReporter
}
// WithMetrics is a resource manager option to enable metrics collection
2022-08-18 20:21:11 +08:00
// Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.WithMetrics instead
2022-02-12 00:24:53 +08:00
func WithMetrics(reporter MetricsReporter) Option {
2022-08-18 20:21:11 +08:00
return rcmgr.WithMetrics(reporter)
2022-02-12 19:59:46 +08:00
}