[#602] metrics: Rename blobovnicza size metric

`Size` is not size, but open db size.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
pull/623/head
Dmitrii Stepanov 2023-08-16 11:58:47 +03:00 committed by Evgenii Stratonikov
parent 809e97626b
commit 10e63537b2
6 changed files with 46 additions and 46 deletions

View File

@ -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

View File

@ -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) {}

View File

@ -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 {

View File

@ -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() {

View File

@ -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))

View File

@ -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"