package engine import ( "time" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/metrics" ) type MetricRegister interface { AddListContainersDuration(d time.Duration) AddEstimateContainerSizeDuration(d time.Duration) AddDeleteDuration(d time.Duration) AddExistsDuration(d time.Duration) AddGetDuration(d time.Duration) AddHeadDuration(d time.Duration) AddInhumeDuration(d time.Duration) AddPutDuration(d time.Duration) AddRangeDuration(d time.Duration) AddSearchDuration(d time.Duration) AddListObjectsDuration(d time.Duration) SetObjectCounter(shardID, objectType string, v uint64) AddToObjectCounter(shardID, objectType string, delta int) SetReadonly(shardID string, readonly bool) AddToContainerSize(cnrID string, size int64) AddToPayloadCounter(shardID string, size int64) IncErrorCounter(shardID string) ClearErrorCounter(shardID string) DeleteErrorCounter(shardID string) WriteCache() metrics.WriteCacheMetrics GC() metrics.GCMetrics } func elapsed(addFunc func(d time.Duration)) func() { t := time.Now() return func() { addFunc(time.Since(t)) } } type gcMetrics struct { storage metrics.GCMetrics shardID string } func (m *gcMetrics) AddRunDuration(d time.Duration, success bool) { m.storage.AddRunDuration(m.shardID, d, success) } func (m *gcMetrics) AddDeletedCount(deleted, failed uint64) { m.storage.AddDeletedCount(m.shardID, deleted, failed) } func (m *gcMetrics) AddExpiredObjectCollectionDuration(d time.Duration, success bool, objectType string) { m.storage.AddExpiredObjectCollectionDuration(m.shardID, d, success, objectType) } func (m *gcMetrics) AddInhumedObjectCount(count uint64, objectType string) { m.storage.AddInhumedObjectCount(m.shardID, count, objectType) }