From c0f3fb332f0591c8aa93e2307532335415f6ff88 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 16 Aug 2023 11:58:47 +0300 Subject: [PATCH] [#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"