mirror of
https://github.com/libp2p/go-libp2p-resource-manager.git
synced 2026-08-22 11:33:28 +08:00
blocked memory reservation metrics
This commit is contained in:
10
metrics.go
10
metrics.go
@@ -22,6 +22,8 @@ type MetricsReporter interface {
|
||||
BlockService(svc string)
|
||||
// BlockedServicePeer is invoekd when setting the service for a stream is blocked at the per service peer scope
|
||||
BlockServicePeer(svc string, p peer.ID)
|
||||
// BlockMemory is invoked when a memory reservation fails
|
||||
BlockMemory(size int)
|
||||
}
|
||||
|
||||
type metrics struct {
|
||||
@@ -91,3 +93,11 @@ func (m *metrics) BlockServicePeer(svc string, p peer.ID) {
|
||||
|
||||
m.reporter.BlockServicePeer(svc, p)
|
||||
}
|
||||
|
||||
func (m *metrics) BlockMemory(size int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
|
||||
m.reporter.BlockMemory(size)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user