[#602] metrics: Rename blobovnicza size metric
`Size` is not size, but open db size. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
809e97626b
commit
10e63537b2
6 changed files with 46 additions and 46 deletions
|
@ -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
|
||||||
|
|
|
@ -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) {}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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))
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue