package metrics import ( "time" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/badgerstore" metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/metrics" ) func NewBadgerStoreMetrics(path string, m metrics_impl.BadgerStoreMetrics) badgerstore.Metrics { return &badgerStoreMetrics{ path: path, m: m, } } type badgerStoreMetrics struct { path, shardID string m metrics_impl.BadgerStoreMetrics } // Close implements badgerstore.Metrics. func (m *badgerStoreMetrics) Close() { m.m.Close(m.shardID, m.path) } // Delete implements badgerstore.Metrics. func (m *badgerStoreMetrics) Delete(d time.Duration, success bool) { m.m.MethodDuration(m.shardID, m.path, "Delete", d, success) } // Exists implements badgerstore.Metrics. func (m *badgerStoreMetrics) Exists(d time.Duration, success bool) { m.m.MethodDuration(m.shardID, m.path, "Exists", d, success) } // Get implements badgerstore.Metrics. func (m *badgerStoreMetrics) Get(d time.Duration, size int, success bool) { m.m.MethodDuration(m.shardID, m.path, "Get", d, success) if success { m.m.AddGet(m.shardID, m.path, size) } } // GetRange implements badgerstore.Metrics. func (m *badgerStoreMetrics) GetRange(d time.Duration, size int, success bool) { m.m.MethodDuration(m.shardID, m.path, "GetRange", d, success) if success { m.m.AddGet(m.shardID, m.path, size) } } // Iterate implements badgerstore.Metrics. func (m *badgerStoreMetrics) Iterate(d time.Duration, success bool) { m.m.MethodDuration(m.shardID, m.path, "Iterate", d, success) } // Put implements badgerstore.Metrics. func (m *badgerStoreMetrics) Put(d time.Duration, size int, success bool) { m.m.MethodDuration(m.shardID, m.path, "Put", d, success) if success { m.m.AddPut(m.shardID, m.path, size) } } // SetMode implements badgerstore.Metrics. func (m *badgerStoreMetrics) SetMode(readOnly bool) { m.m.SetMode(m.shardID, m.path, readOnly) } // SetParentID implements badgerstore.Metrics. func (m *badgerStoreMetrics) SetParentID(parentID string) { m.shardID = parentID }