[#602] metrics: Rename blobovnicza size metric
All checks were successful
DCO action / DCO (pull_request) Successful in 1m57s
Vulncheck / Vulncheck (pull_request) Successful in 3m13s
Build / Build Components (1.20) (pull_request) Successful in 3m58s
Build / Build Components (1.21) (pull_request) Successful in 4m27s
Tests and linters / Staticcheck (pull_request) Successful in 5m44s
Tests and linters / Lint (pull_request) Successful in 9m47s
Tests and linters / Tests (1.20) (pull_request) Successful in 12m13s
Tests and linters / Tests with -race (pull_request) Successful in 12m8s
Tests and linters / Tests (1.21) (pull_request) Successful in 12m18s

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

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-08-16 11:58:47 +03:00
parent 5f5dcf0ebc
commit c0f3fb332f
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) return fmt.Errorf("can't determine DB size: %w", err)
} }
b.dataSize.Store(size) b.dataSize.Store(size)
b.metrics.AddSize(size) b.metrics.AddOpenBlobovnizcaSize(size)
return nil return nil
} }
@ -135,7 +135,7 @@ func (b *Blobovnicza) Close() error {
} }
b.metrics.DecOpenBlobovnizcaCount() b.metrics.DecOpenBlobovnizcaCount()
b.metrics.SubSize(b.dataSize.Load()) b.metrics.SubOpenBlobovnizcaSize(b.dataSize.Load())
b.dataSize.Store(0) b.dataSize.Store(0)
b.opened = false b.opened = false

View file

@ -4,13 +4,13 @@ type Metrics interface {
IncOpenBlobovnizcaCount() IncOpenBlobovnizcaCount()
DecOpenBlobovnizcaCount() DecOpenBlobovnizcaCount()
AddSize(size uint64) AddOpenBlobovnizcaSize(size uint64)
SubSize(size uint64) SubOpenBlobovnizcaSize(size uint64)
} }
type NoopMetrics struct{} type NoopMetrics struct{}
func (m *NoopMetrics) IncOpenBlobovnizcaCount() {} func (m *NoopMetrics) IncOpenBlobovnizcaCount() {}
func (m *NoopMetrics) DecOpenBlobovnizcaCount() {} func (m *NoopMetrics) DecOpenBlobovnizcaCount() {}
func (m *NoopMetrics) AddSize(uint64) {} func (m *NoopMetrics) AddOpenBlobovnizcaSize(uint64) {}
func (m *NoopMetrics) SubSize(uint64) {} func (m *NoopMetrics) SubOpenBlobovnizcaSize(uint64) {}

View file

@ -42,12 +42,12 @@ func upperPowerOfTwo(v uint64) uint64 {
func (b *Blobovnicza) incSize(sz uint64) { func (b *Blobovnicza) incSize(sz uint64) {
b.dataSize.Add(sz) b.dataSize.Add(sz)
b.metrics.AddSize(sz) b.metrics.AddOpenBlobovnizcaSize(sz)
} }
func (b *Blobovnicza) decSize(sz uint64) { func (b *Blobovnicza) decSize(sz uint64) {
b.dataSize.Add(^(sz - 1)) b.dataSize.Add(^(sz - 1))
b.metrics.SubSize(sz) b.metrics.SubOpenBlobovnizcaSize(sz)
} }
func (b *Blobovnicza) full() bool { func (b *Blobovnicza) full() bool {

View file

@ -81,12 +81,12 @@ type blobovniczaMetrics struct {
path string path string
} }
func (m *blobovniczaMetrics) AddSize(size uint64) { func (m *blobovniczaMetrics) AddOpenBlobovnizcaSize(size uint64) {
m.m.AddTreeSize(m.shardID(), m.path, size) m.m.AddOpenBlobovnizcaSize(m.shardID(), m.path, size)
} }
func (m *blobovniczaMetrics) SubSize(size uint64) { func (m *blobovniczaMetrics) SubOpenBlobovnizcaSize(size uint64) {
m.m.SubTreeSize(m.shardID(), m.path, size) m.m.SubOpenBlobovnizcaSize(m.shardID(), m.path, size)
} }
func (m *blobovniczaMetrics) IncOpenBlobovnizcaCount() { func (m *blobovniczaMetrics) IncOpenBlobovnizcaCount() {

View file

@ -15,8 +15,8 @@ type BlobobvnizcaMetrics interface {
AddBlobobvnizcaTreePut(shardID, path string, size int) AddBlobobvnizcaTreePut(shardID, path string, size int)
AddBlobobvnizcaTreeGet(shardID, path string, size int) AddBlobobvnizcaTreeGet(shardID, path string, size int)
AddTreeSize(shardID, path string, size uint64) AddOpenBlobovnizcaSize(shardID, path string, size uint64)
SubTreeSize(shardID, path string, size uint64) SubOpenBlobovnizcaSize(shardID, path string, size uint64)
IncOpenBlobovnizcaCount(shardID, path string) IncOpenBlobovnizcaCount(shardID, path string)
DecOpenBlobovnizcaCount(shardID, path string) DecOpenBlobovnizcaCount(shardID, path string)
@ -27,41 +27,41 @@ type blobovnizca struct {
treeReqDuration *prometheus.HistogramVec treeReqDuration *prometheus.HistogramVec
treePut *prometheus.CounterVec treePut *prometheus.CounterVec
treeGet *prometheus.CounterVec treeGet *prometheus.CounterVec
treeSize *prometheus.GaugeVec treeOpenSize *prometheus.GaugeVec
treeOpenCounter *prometheus.GaugeVec treeOpenCounter *prometheus.GaugeVec
} }
func newBlobovnizca() *blobovnizca { func newBlobovnizca() *blobovnizca {
return &blobovnizca{ return &blobovnizca{
treeMode: newShardIDPathMode(blobovnizaTreeSubSystem, "mode", "Blobovnizca tree mode"), treeMode: newShardIDPathMode(blobovniczaTreeSubSystem, "mode", "Blobovnizca tree mode"),
treeReqDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{ treeReqDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovnizaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "request_duration_seconds", Name: "request_duration_seconds",
Help: "Accumulated Blobovnizca tree request process duration", Help: "Accumulated Blobovnizca tree request process duration",
}, []string{shardIDLabel, pathLabel, successLabel, methodLabel, withStorageIDLabel}), }, []string{shardIDLabel, pathLabel, successLabel, methodLabel, withStorageIDLabel}),
treePut: metrics.NewCounterVec(prometheus.CounterOpts{ treePut: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovnizaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "put_bytes", Name: "put_bytes",
Help: "Accumulated payload size written to Blobovnizca tree", Help: "Accumulated payload size written to Blobovnizca tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
treeGet: metrics.NewCounterVec(prometheus.CounterOpts{ treeGet: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovnizaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "get_bytes", Name: "get_bytes",
Help: "Accumulated payload size read from Blobovnizca tree", Help: "Accumulated payload size read from Blobovnizca tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
treeSize: metrics.NewGaugeVec(prometheus.GaugeOpts{ treeOpenSize: metrics.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovnizaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "size_bytes", Name: "open_blobovnizca_size_bytes",
Help: "Blobovnizca tree size", Help: "Size of opened blobovnizcas of Blobovnizca tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{ treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovnizaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "open_blobovnizca_count", Name: "open_blobovnizca_count",
Help: "Count of opened blobovnizcas of Blobovnizca tree", Help: "Count of opened blobovnizcas of Blobovnizca tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
@ -112,15 +112,15 @@ func (b *blobovnizca) AddBlobobvnizcaTreeGet(shardID, path string, size int) {
}).Add(float64(size)) }).Add(float64(size))
} }
func (b *blobovnizca) AddTreeSize(shardID, path string, size uint64) { func (b *blobovnizca) AddOpenBlobovnizcaSize(shardID, path string, size uint64) {
b.treeSize.With(prometheus.Labels{ b.treeOpenSize.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Add(float64(size)) }).Add(float64(size))
} }
func (b *blobovnizca) SubTreeSize(shardID, path string, size uint64) { func (b *blobovnizca) SubOpenBlobovnizcaSize(shardID, path string, size uint64) {
b.treeSize.With(prometheus.Labels{ b.treeOpenSize.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Sub(float64(size)) }).Sub(float64(size))

View file

@ -6,7 +6,7 @@ const (
fstreeSubSystem = "fstree" fstreeSubSystem = "fstree"
blobstoreSubSystem = "blobstore" blobstoreSubSystem = "blobstore"
blobovnizaTreeSubSystem = "blobovniza_tree" blobovniczaTreeSubSystem = "blobovnicza_tree"
metabaseSubSystem = "metabase" metabaseSubSystem = "metabase"
piloramaSubSystem = "pilorama" piloramaSubSystem = "pilorama"
engineSubsystem = "engine" engineSubsystem = "engine"