blocked memory reservation metrics

This commit is contained in:
vyzo
2022-02-12 13:59:46 +02:00
parent 019fe3da54
commit 8a85c1fbce
3 changed files with 60 additions and 33 deletions

View File

@@ -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)
}