From 0b109c32e4d3547b570f398ed5a8edcfe8f04648 Mon Sep 17 00:00:00 2001 From: Moby von Briesen Date: Tue, 9 Jun 2020 16:58:48 -0400 Subject: [PATCH] storagenode/piecestore/usedserials: add monkit metric for serials that are randomly deleted This will give storagenode operators a better idea of whether the memory allocated to the usedserials store is sufficient. Change-Id: I5c30f2e39473a573f43409511ad9e2e32680479c --- monkit.lock | 1 + storagenode/piecestore/usedserials/table.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/monkit.lock b/monkit.lock index f26e92cef..13c2ad570 100644 --- a/monkit.lock +++ b/monkit.lock @@ -98,3 +98,4 @@ storj.io/storj/satellite/satellitedb."unknown_audit_reputation_beta" FloatVal storj.io/storj/storage/filestore."open_file_in_trash" Meter storj.io/storj/storagenode/contact."satellite_contact_request" Meter storj.io/storj/storagenode/gracefulexit."satellite_gracefulexit_request" Meter +storj.io/storj/storagenode/piecestore/usedserials."delete_random_serial" Meter diff --git a/storagenode/piecestore/usedserials/table.go b/storagenode/piecestore/usedserials/table.go index 77117a220..f9263ee74 100644 --- a/storagenode/piecestore/usedserials/table.go +++ b/storagenode/piecestore/usedserials/table.go @@ -10,6 +10,7 @@ import ( "sync" "time" + "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "storj.io/common/memory" @@ -21,6 +22,8 @@ var ( ErrSerials = errs.Class("used serials store error") // ErrSerialAlreadyExists defines an error class for duplicate usedserials. ErrSerialAlreadyExists = errs.Class("used serial already exists in store") + + mon = monkit.Package() ) const ( @@ -198,6 +201,7 @@ func (table *Table) Count() int { // deleteRandomSerial deletes a random item. // It expects the mutex to be locked before being called. func (table *Table) deleteRandomSerial() error { + mon.Meter("delete_random_serial").Mark(1) //locked for _, satMap := range table.serials { for expirationHour, serialList := range satMap { if len(serialList.partialSerials) > 0 {