From 326f2017ed5c40b33667ad7422cc4d1cc1a29334 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 15 Aug 2023 16:53:38 +0300 Subject: [PATCH 1/3] [#602] blobovnicza: Init before using Fix blobovnicza size: after restart size metric resets. Signed-off-by: Dmitrii Stepanov --- .../blobovnicza/control.go | 34 +++++++++---------- .../blobstor/blobovniczatree/control.go | 3 ++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pkg/local_object_storage/blobovnicza/control.go b/pkg/local_object_storage/blobovnicza/control.go index da4c870bd..79bad91e2 100644 --- a/pkg/local_object_storage/blobovnicza/control.go +++ b/pkg/local_object_storage/blobovnicza/control.go @@ -45,8 +45,6 @@ func (b *Blobovnicza) Open() error { // Init initializes internal database structure. // // If Blobovnicza is already initialized, no action is taken. -// -// Should not be called in read-only configuration. func (b *Blobovnicza) Init() error { b.log.Debug(logs.BlobovniczaInitializing, zap.Uint64("object size limit", b.objSizeLimit), @@ -58,25 +56,27 @@ func (b *Blobovnicza) Init() error { return nil } - err := b.boltDB.Update(func(tx *bbolt.Tx) error { - return b.iterateBucketKeys(func(lower, upper uint64, key []byte) (bool, error) { - // create size range bucket + if !b.boltOptions.ReadOnly { + err := b.boltDB.Update(func(tx *bbolt.Tx) error { + return b.iterateBucketKeys(func(lower, upper uint64, key []byte) (bool, error) { + // create size range bucket - rangeStr := stringifyBounds(lower, upper) - b.log.Debug(logs.BlobovniczaCreatingBucketForSizeRange, - zap.String("range", rangeStr)) + rangeStr := stringifyBounds(lower, upper) + b.log.Debug(logs.BlobovniczaCreatingBucketForSizeRange, + zap.String("range", rangeStr)) - _, err := tx.CreateBucketIfNotExists(key) - if err != nil { - return false, fmt.Errorf("(%T) could not create bucket for bounds %s: %w", - b, rangeStr, err) - } + _, err := tx.CreateBucketIfNotExists(key) + if err != nil { + return false, fmt.Errorf("(%T) could not create bucket for bounds %s: %w", + b, rangeStr, err) + } - return false, nil + return false, nil + }) }) - }) - if err != nil { - return err + if err != nil { + return err + } } info, err := os.Stat(b.path) diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/control.go b/pkg/local_object_storage/blobstor/blobovniczatree/control.go index bc3d7d60c..3a06310f6 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/control.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/control.go @@ -136,5 +136,8 @@ func (b *Blobovniczas) openBlobovniczaNoCache(p string) (*blobovnicza.Blobovnicz if err := blz.Open(); err != nil { return nil, fmt.Errorf("could not open blobovnicza %s: %w", p, err) } + if err := blz.Init(); err != nil { + return nil, fmt.Errorf("could not init blobovnicza %s: %w", p, err) + } return blz, nil } -- 2.45.2 From 5f5dcf0ebc24f883481b12a9a4a2293674f3e27f Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 16 Aug 2023 11:12:19 +0300 Subject: [PATCH 2/3] [#602] blobovnicza: Fix size counter Signed-off-by: Dmitrii Stepanov --- .../blobovnicza/blobovnicza.go | 6 +- .../blobovnicza/control.go | 67 +++++++++++++++---- .../blobovnicza/delete.go | 35 +++++----- .../blobovnicza/iterate.go | 25 ++++--- pkg/local_object_storage/blobovnicza/put.go | 4 +- pkg/local_object_storage/blobovnicza/sizes.go | 11 +-- .../blobovnicza/sizes_test.go | 3 +- 7 files changed, 99 insertions(+), 52 deletions(-) diff --git a/pkg/local_object_storage/blobovnicza/blobovnicza.go b/pkg/local_object_storage/blobovnicza/blobovnicza.go index d5741fba7..22168de22 100644 --- a/pkg/local_object_storage/blobovnicza/blobovnicza.go +++ b/pkg/local_object_storage/blobovnicza/blobovnicza.go @@ -3,6 +3,7 @@ package blobovnicza import ( "io/fs" "os" + "sync" "sync/atomic" "time" @@ -15,9 +16,12 @@ import ( type Blobovnicza struct { cfg - filled atomic.Uint64 + dataSize atomic.Uint64 boltDB *bbolt.DB + + opened bool + controlMtx sync.Mutex } // Option is an option of Blobovnicza's constructor. diff --git a/pkg/local_object_storage/blobovnicza/control.go b/pkg/local_object_storage/blobovnicza/control.go index 79bad91e2..7b5552907 100644 --- a/pkg/local_object_storage/blobovnicza/control.go +++ b/pkg/local_object_storage/blobovnicza/control.go @@ -1,8 +1,8 @@ package blobovnicza import ( + "errors" "fmt" - "os" "path/filepath" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" @@ -14,7 +14,15 @@ import ( // Open opens an internal database at the configured path with the configured permissions. // // If the database file does not exist, it will be created automatically. +// If blobovnizca is already open, does nothing. func (b *Blobovnicza) Open() error { + b.controlMtx.Lock() + defer b.controlMtx.Unlock() + + if b.opened { + return nil + } + b.log.Debug(logs.BlobovniczaCreatingDirectoryForBoltDB, zap.String("path", b.path), zap.Bool("ro", b.boltOptions.ReadOnly), @@ -36,6 +44,7 @@ func (b *Blobovnicza) Open() error { b.boltDB, err = bbolt.Open(b.path, b.perm, b.boltOptions) if err == nil { + b.opened = true b.metrics.IncOpenBlobovnizcaCount() } @@ -45,20 +54,28 @@ func (b *Blobovnicza) Open() error { // Init initializes internal database structure. // // If Blobovnicza is already initialized, no action is taken. +// Blobovnizca must be open, otherwise an error will return. func (b *Blobovnicza) Init() error { + b.controlMtx.Lock() + defer b.controlMtx.Unlock() + + if !b.opened { + return errors.New("blobovnizca is not open") + } + b.log.Debug(logs.BlobovniczaInitializing, zap.Uint64("object size limit", b.objSizeLimit), zap.Uint64("storage size limit", b.fullSizeLimit), ) - if size := b.filled.Load(); size != 0 { + if size := b.dataSize.Load(); size != 0 { b.log.Debug(logs.BlobovniczaAlreadyInitialized, zap.Uint64("size", size)) return nil } if !b.boltOptions.ReadOnly { err := b.boltDB.Update(func(tx *bbolt.Tx) error { - return b.iterateBucketKeys(func(lower, upper uint64, key []byte) (bool, error) { + return b.iterateBucketKeys(true, func(lower, upper uint64, key []byte) (bool, error) { // create size range bucket rangeStr := stringifyBounds(lower, upper) @@ -79,27 +96,49 @@ func (b *Blobovnicza) Init() error { } } - info, err := os.Stat(b.path) + return b.initializeSize() +} + +func (b *Blobovnicza) initializeSize() error { + var size uint64 + err := b.boltDB.View(func(tx *bbolt.Tx) error { + return b.iterateAllBuckets(tx, func(lower, upper uint64, b *bbolt.Bucket) (bool, error) { + size += uint64(b.Stats().KeyN) * upper + return false, nil + }) + }) if err != nil { return fmt.Errorf("can't determine DB size: %w", err) } - - sz := uint64(info.Size()) - b.filled.Store(sz) - b.metrics.AddSize(sz) - return err + b.dataSize.Store(size) + b.metrics.AddSize(size) + return nil } // Close releases all internal database resources. +// +// If blobovnizca is already closed, does nothing. func (b *Blobovnicza) Close() error { + b.controlMtx.Lock() + defer b.controlMtx.Unlock() + + if !b.opened { + return nil + } + b.log.Debug(logs.BlobovniczaClosingBoltDB, zap.String("path", b.path), ) - err := b.boltDB.Close() - if err == nil { - b.metrics.DecOpenBlobovnizcaCount() - b.metrics.SubSize(b.filled.Load()) + if err := b.boltDB.Close(); err != nil { + return err } - return err + + b.metrics.DecOpenBlobovnizcaCount() + b.metrics.SubSize(b.dataSize.Load()) + b.dataSize.Store(0) + + b.opened = false + + return nil } diff --git a/pkg/local_object_storage/blobovnicza/delete.go b/pkg/local_object_storage/blobovnicza/delete.go index 419e073c6..f332173c1 100644 --- a/pkg/local_object_storage/blobovnicza/delete.go +++ b/pkg/local_object_storage/blobovnicza/delete.go @@ -46,33 +46,22 @@ func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, err addrKey := addressKey(prm.addr) found := false + var sizeUpperBound uint64 + var sizeLowerBound uint64 + var dataSize uint64 err := b.boltDB.Update(func(tx *bbolt.Tx) error { - return b.iterateBuckets(tx, func(lower, upper uint64, buck *bbolt.Bucket) (bool, error) { + return b.iterateAllBuckets(tx, func(lower, upper uint64, buck *bbolt.Bucket) (bool, error) { objData := buck.Get(addrKey) if objData == nil { // object is not in bucket => continue iterating return false, nil } - - sz := uint64(len(objData)) - - // remove object from the bucket - err := buck.Delete(addrKey) - - if err == nil { - b.log.Debug(logs.BlobovniczaObjectWasRemovedFromBucket, - zap.String("binary size", stringifyByteSize(sz)), - zap.String("range", stringifyBounds(lower, upper)), - ) - // decrease fullness counter - b.decSize(sz) - } - + dataSize = uint64(len(objData)) + sizeLowerBound = lower + sizeUpperBound = upper found = true - - // stop iteration - return true, err + return true, buck.Delete(addrKey) }) }) @@ -80,5 +69,13 @@ func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, err return DeleteRes{}, new(apistatus.ObjectNotFound) } + if err == nil && found { + b.log.Debug(logs.BlobovniczaObjectWasRemovedFromBucket, + zap.String("binary size", stringifyByteSize(dataSize)), + zap.String("range", stringifyBounds(sizeLowerBound, sizeUpperBound)), + ) + b.decSize(sizeUpperBound) + } + return DeleteRes{}, err } diff --git a/pkg/local_object_storage/blobovnicza/iterate.go b/pkg/local_object_storage/blobovnicza/iterate.go index c2031ea54..b29ccb43c 100644 --- a/pkg/local_object_storage/blobovnicza/iterate.go +++ b/pkg/local_object_storage/blobovnicza/iterate.go @@ -3,6 +3,7 @@ package blobovnicza import ( "context" "fmt" + "math" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -11,28 +12,32 @@ import ( "go.opentelemetry.io/otel/trace" ) -func (b *Blobovnicza) iterateBuckets(tx *bbolt.Tx, f func(uint64, uint64, *bbolt.Bucket) (bool, error)) error { - return b.iterateBucketKeys(func(lower uint64, upper uint64, key []byte) (bool, error) { +// iterateAllBuckets iterates all buckets in db +// +// If the maximum size of the object (b.objSizeLimit) has been changed to lower value, +// then there may be more buckets than the current limit of the object size. +func (b *Blobovnicza) iterateAllBuckets(tx *bbolt.Tx, f func(uint64, uint64, *bbolt.Bucket) (bool, error)) error { + return b.iterateBucketKeys(false, func(lower uint64, upper uint64, key []byte) (bool, error) { buck := tx.Bucket(key) if buck == nil { - // expected to happen: - // - before initialization step (incorrect usage by design) - // - if DB is corrupted (in future this case should be handled) - return false, fmt.Errorf("(%T) could not get bucket %s", b, stringifyBounds(lower, upper)) + return true, nil } return f(lower, upper, buck) }) } -func (b *Blobovnicza) iterateBucketKeys(f func(uint64, uint64, []byte) (bool, error)) error { - return b.iterateBounds(func(lower, upper uint64) (bool, error) { +func (b *Blobovnicza) iterateBucketKeys(useObjLimitBound bool, f func(uint64, uint64, []byte) (bool, error)) error { + return b.iterateBounds(useObjLimitBound, func(lower, upper uint64) (bool, error) { return f(lower, upper, bucketKeyFromBounds(upper)) }) } -func (b *Blobovnicza) iterateBounds(f func(uint64, uint64) (bool, error)) error { - objLimitBound := upperPowerOfTwo(b.objSizeLimit) +func (b *Blobovnicza) iterateBounds(useObjLimitBound bool, f func(uint64, uint64) (bool, error)) error { + var objLimitBound uint64 = math.MaxUint64 + if useObjLimitBound { + objLimitBound = upperPowerOfTwo(b.objSizeLimit) + } for upper := firstBucketBound; upper <= max(objLimitBound, firstBucketBound); upper *= 2 { var lower uint64 diff --git a/pkg/local_object_storage/blobovnicza/put.go b/pkg/local_object_storage/blobovnicza/put.go index cc816b3e1..b8cc9954a 100644 --- a/pkg/local_object_storage/blobovnicza/put.go +++ b/pkg/local_object_storage/blobovnicza/put.go @@ -61,7 +61,7 @@ func (b *Blobovnicza) Put(ctx context.Context, prm PutPrm) (PutRes, error) { defer span.End() sz := uint64(len(prm.objData)) - bucketName := bucketForSize(sz) + bucketName, upperBound := bucketForSize(sz) key := addressKey(prm.addr) err := b.boltDB.Batch(func(tx *bbolt.Tx) error { @@ -85,7 +85,7 @@ func (b *Blobovnicza) Put(ctx context.Context, prm PutPrm) (PutRes, error) { return nil }) if err == nil { - b.incSize(sz) + b.incSize(upperBound) } return PutRes{}, err diff --git a/pkg/local_object_storage/blobovnicza/sizes.go b/pkg/local_object_storage/blobovnicza/sizes.go index 7e10b728e..482242c3f 100644 --- a/pkg/local_object_storage/blobovnicza/sizes.go +++ b/pkg/local_object_storage/blobovnicza/sizes.go @@ -28,8 +28,9 @@ func bucketKeyFromBounds(upperBound uint64) []byte { return buf[:ln] } -func bucketForSize(sz uint64) []byte { - return bucketKeyFromBounds(upperPowerOfTwo(sz)) +func bucketForSize(sz uint64) ([]byte, uint64) { + upperBound := upperPowerOfTwo(sz) + return bucketKeyFromBounds(upperBound), upperBound } func upperPowerOfTwo(v uint64) uint64 { @@ -40,15 +41,15 @@ func upperPowerOfTwo(v uint64) uint64 { } func (b *Blobovnicza) incSize(sz uint64) { - b.filled.Add(sz) + b.dataSize.Add(sz) b.metrics.AddSize(sz) } func (b *Blobovnicza) decSize(sz uint64) { - b.filled.Add(^(sz - 1)) + b.dataSize.Add(^(sz - 1)) b.metrics.SubSize(sz) } func (b *Blobovnicza) full() bool { - return b.filled.Load() >= b.fullSizeLimit + return b.dataSize.Load() >= b.fullSizeLimit } diff --git a/pkg/local_object_storage/blobovnicza/sizes_test.go b/pkg/local_object_storage/blobovnicza/sizes_test.go index 2bf451f12..d2f576fd3 100644 --- a/pkg/local_object_storage/blobovnicza/sizes_test.go +++ b/pkg/local_object_storage/blobovnicza/sizes_test.go @@ -34,7 +34,8 @@ func TestSizes(t *testing.T) { upperBound: 4 * firstBucketBound, }, } { - require.Equal(t, bucketKeyFromBounds(item.upperBound), bucketForSize(item.sz)) + key, _ := bucketForSize(item.sz) + require.Equal(t, bucketKeyFromBounds(item.upperBound), key) } } -- 2.45.2 From c0f3fb332f0591c8aa93e2307532335415f6ff88 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 16 Aug 2023 11:58:47 +0300 Subject: [PATCH 3/3] [#602] metrics: Rename blobovnicza size metric `Size` is not size, but open db size. Signed-off-by: Dmitrii Stepanov --- .../blobovnicza/control.go | 4 +-- .../blobovnicza/metrics.go | 12 +++---- pkg/local_object_storage/blobovnicza/sizes.go | 4 +-- .../metrics/blobovnizca.go | 8 ++--- pkg/metrics/blobovnizca.go | 32 +++++++++---------- pkg/metrics/consts.go | 32 +++++++++---------- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/pkg/local_object_storage/blobovnicza/control.go b/pkg/local_object_storage/blobovnicza/control.go index 7b5552907..0e3204968 100644 --- a/pkg/local_object_storage/blobovnicza/control.go +++ b/pkg/local_object_storage/blobovnicza/control.go @@ -111,7 +111,7 @@ func (b *Blobovnicza) initializeSize() error { return fmt.Errorf("can't determine DB size: %w", err) } b.dataSize.Store(size) - b.metrics.AddSize(size) + b.metrics.AddOpenBlobovnizcaSize(size) return nil } @@ -135,7 +135,7 @@ func (b *Blobovnicza) Close() error { } b.metrics.DecOpenBlobovnizcaCount() - b.metrics.SubSize(b.dataSize.Load()) + b.metrics.SubOpenBlobovnizcaSize(b.dataSize.Load()) b.dataSize.Store(0) b.opened = false diff --git a/pkg/local_object_storage/blobovnicza/metrics.go b/pkg/local_object_storage/blobovnicza/metrics.go index d511f90f1..5f4f94cbe 100644 --- a/pkg/local_object_storage/blobovnicza/metrics.go +++ b/pkg/local_object_storage/blobovnicza/metrics.go @@ -4,13 +4,13 @@ type Metrics interface { IncOpenBlobovnizcaCount() DecOpenBlobovnizcaCount() - AddSize(size uint64) - SubSize(size uint64) + AddOpenBlobovnizcaSize(size uint64) + SubOpenBlobovnizcaSize(size uint64) } type NoopMetrics struct{} -func (m *NoopMetrics) IncOpenBlobovnizcaCount() {} -func (m *NoopMetrics) DecOpenBlobovnizcaCount() {} -func (m *NoopMetrics) AddSize(uint64) {} -func (m *NoopMetrics) SubSize(uint64) {} +func (m *NoopMetrics) IncOpenBlobovnizcaCount() {} +func (m *NoopMetrics) DecOpenBlobovnizcaCount() {} +func (m *NoopMetrics) AddOpenBlobovnizcaSize(uint64) {} +func (m *NoopMetrics) SubOpenBlobovnizcaSize(uint64) {} diff --git a/pkg/local_object_storage/blobovnicza/sizes.go b/pkg/local_object_storage/blobovnicza/sizes.go index 482242c3f..d4ac19201 100644 --- a/pkg/local_object_storage/blobovnicza/sizes.go +++ b/pkg/local_object_storage/blobovnicza/sizes.go @@ -42,12 +42,12 @@ func upperPowerOfTwo(v uint64) uint64 { func (b *Blobovnicza) incSize(sz uint64) { b.dataSize.Add(sz) - b.metrics.AddSize(sz) + b.metrics.AddOpenBlobovnizcaSize(sz) } func (b *Blobovnicza) decSize(sz uint64) { b.dataSize.Add(^(sz - 1)) - b.metrics.SubSize(sz) + b.metrics.SubOpenBlobovnizcaSize(sz) } func (b *Blobovnicza) full() bool { diff --git a/pkg/local_object_storage/metrics/blobovnizca.go b/pkg/local_object_storage/metrics/blobovnizca.go index a498d822e..72c45c31d 100644 --- a/pkg/local_object_storage/metrics/blobovnizca.go +++ b/pkg/local_object_storage/metrics/blobovnizca.go @@ -81,12 +81,12 @@ type blobovniczaMetrics struct { path string } -func (m *blobovniczaMetrics) AddSize(size uint64) { - m.m.AddTreeSize(m.shardID(), m.path, size) +func (m *blobovniczaMetrics) AddOpenBlobovnizcaSize(size uint64) { + m.m.AddOpenBlobovnizcaSize(m.shardID(), m.path, size) } -func (m *blobovniczaMetrics) SubSize(size uint64) { - m.m.SubTreeSize(m.shardID(), m.path, size) +func (m *blobovniczaMetrics) SubOpenBlobovnizcaSize(size uint64) { + m.m.SubOpenBlobovnizcaSize(m.shardID(), m.path, size) } func (m *blobovniczaMetrics) IncOpenBlobovnizcaCount() { diff --git a/pkg/metrics/blobovnizca.go b/pkg/metrics/blobovnizca.go index 9dc3ed572..b80ec5fc1 100644 --- a/pkg/metrics/blobovnizca.go +++ b/pkg/metrics/blobovnizca.go @@ -15,8 +15,8 @@ type BlobobvnizcaMetrics interface { AddBlobobvnizcaTreePut(shardID, path string, size int) AddBlobobvnizcaTreeGet(shardID, path string, size int) - AddTreeSize(shardID, path string, size uint64) - SubTreeSize(shardID, path string, size uint64) + AddOpenBlobovnizcaSize(shardID, path string, size uint64) + SubOpenBlobovnizcaSize(shardID, path string, size uint64) IncOpenBlobovnizcaCount(shardID, path string) DecOpenBlobovnizcaCount(shardID, path string) @@ -27,41 +27,41 @@ type blobovnizca struct { treeReqDuration *prometheus.HistogramVec treePut *prometheus.CounterVec treeGet *prometheus.CounterVec - treeSize *prometheus.GaugeVec + treeOpenSize *prometheus.GaugeVec treeOpenCounter *prometheus.GaugeVec } func newBlobovnizca() *blobovnizca { return &blobovnizca{ - treeMode: newShardIDPathMode(blobovnizaTreeSubSystem, "mode", "Blobovnizca tree mode"), + treeMode: newShardIDPathMode(blobovniczaTreeSubSystem, "mode", "Blobovnizca tree mode"), treeReqDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{ Namespace: namespace, - Subsystem: blobovnizaTreeSubSystem, + Subsystem: blobovniczaTreeSubSystem, Name: "request_duration_seconds", Help: "Accumulated Blobovnizca tree request process duration", }, []string{shardIDLabel, pathLabel, successLabel, methodLabel, withStorageIDLabel}), treePut: metrics.NewCounterVec(prometheus.CounterOpts{ Namespace: namespace, - Subsystem: blobovnizaTreeSubSystem, + Subsystem: blobovniczaTreeSubSystem, Name: "put_bytes", Help: "Accumulated payload size written to Blobovnizca tree", }, []string{shardIDLabel, pathLabel}), treeGet: metrics.NewCounterVec(prometheus.CounterOpts{ Namespace: namespace, - Subsystem: blobovnizaTreeSubSystem, + Subsystem: blobovniczaTreeSubSystem, Name: "get_bytes", Help: "Accumulated payload size read from Blobovnizca tree", }, []string{shardIDLabel, pathLabel}), - treeSize: metrics.NewGaugeVec(prometheus.GaugeOpts{ + treeOpenSize: metrics.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, - Subsystem: blobovnizaTreeSubSystem, - Name: "size_bytes", - Help: "Blobovnizca tree size", + Subsystem: blobovniczaTreeSubSystem, + Name: "open_blobovnizca_size_bytes", + Help: "Size of opened blobovnizcas of Blobovnizca tree", }, []string{shardIDLabel, pathLabel}), treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, - Subsystem: blobovnizaTreeSubSystem, + Subsystem: blobovniczaTreeSubSystem, Name: "open_blobovnizca_count", Help: "Count of opened blobovnizcas of Blobovnizca tree", }, []string{shardIDLabel, pathLabel}), @@ -112,15 +112,15 @@ func (b *blobovnizca) AddBlobobvnizcaTreeGet(shardID, path string, size int) { }).Add(float64(size)) } -func (b *blobovnizca) AddTreeSize(shardID, path string, size uint64) { - b.treeSize.With(prometheus.Labels{ +func (b *blobovnizca) AddOpenBlobovnizcaSize(shardID, path string, size uint64) { + b.treeOpenSize.With(prometheus.Labels{ shardIDLabel: shardID, pathLabel: path, }).Add(float64(size)) } -func (b *blobovnizca) SubTreeSize(shardID, path string, size uint64) { - b.treeSize.With(prometheus.Labels{ +func (b *blobovnizca) SubOpenBlobovnizcaSize(shardID, path string, size uint64) { + b.treeOpenSize.With(prometheus.Labels{ shardIDLabel: shardID, pathLabel: path, }).Sub(float64(size)) diff --git a/pkg/metrics/consts.go b/pkg/metrics/consts.go index 691aaa375..550eec424 100644 --- a/pkg/metrics/consts.go +++ b/pkg/metrics/consts.go @@ -4,22 +4,22 @@ const ( namespace = "frostfs_node" innerRingNamespace = "frostfs_ir" - fstreeSubSystem = "fstree" - blobstoreSubSystem = "blobstore" - blobovnizaTreeSubSystem = "blobovniza_tree" - metabaseSubSystem = "metabase" - piloramaSubSystem = "pilorama" - engineSubsystem = "engine" - gcSubsystem = "garbage_collector" - innerRingSubsystem = "ir" - morphSubsystem = "morph" - morphCacheSubsystem = "morphcache" - objectSubsystem = "object" - replicatorSubsystem = "replicator" - stateSubsystem = "state" - treeServiceSubsystem = "treeservice" - writeCacheSubsystem = "writecache" - grpcServerSubsystem = "grpc_server" + fstreeSubSystem = "fstree" + blobstoreSubSystem = "blobstore" + blobovniczaTreeSubSystem = "blobovnicza_tree" + metabaseSubSystem = "metabase" + piloramaSubSystem = "pilorama" + engineSubsystem = "engine" + gcSubsystem = "garbage_collector" + innerRingSubsystem = "ir" + morphSubsystem = "morph" + morphCacheSubsystem = "morphcache" + objectSubsystem = "object" + replicatorSubsystem = "replicator" + stateSubsystem = "state" + treeServiceSubsystem = "treeservice" + writeCacheSubsystem = "writecache" + grpcServerSubsystem = "grpc_server" successLabel = "success" shardIDLabel = "shard_id" -- 2.45.2