[#602] metrics: Add blobovnicza items counter
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 1m29s
Build / Build Components (1.21) (pull_request) Successful in 3m23s
DCO action / DCO (pull_request) Successful in 3m50s
Tests and linters / Tests (1.21) (pull_request) Successful in 4m27s
Tests and linters / Lint (pull_request) Successful in 4m48s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m6s
Tests and linters / Staticcheck (pull_request) Successful in 5m8s
Tests and linters / Tests with -race (pull_request) Successful in 5m38s
Build / Build Components (1.20) (pull_request) Successful in 7m46s

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-08-18 13:01:27 +03:00
parent c4e1d8eb07
commit f2811f8585
8 changed files with 70 additions and 18 deletions

View file

@ -18,6 +18,9 @@ type BlobobvnizcaMetrics interface {
AddOpenBlobovniczaSize(shardID, path string, size uint64)
SubOpenBlobovniczaSize(shardID, path string, size uint64)
AddOpenBlobovniczaItems(shardID, path string, items uint64)
SubOpenBlobovniczaItems(shardID, path string, items uint64)
IncOpenBlobovniczaCount(shardID, path string)
DecOpenBlobovniczaCount(shardID, path string)
}
@ -28,6 +31,7 @@ type blobovnicza struct {
treePut *prometheus.CounterVec
treeGet *prometheus.CounterVec
treeOpenSize *prometheus.GaugeVec
treeOpenItems *prometheus.GaugeVec
treeOpenCounter *prometheus.GaugeVec
}
@ -59,6 +63,12 @@ func newBlobovnicza() *blobovnicza {
Name: "open_blobovnicza_size_bytes",
Help: "Size of opened blobovniczas of Blobovnicza tree",
}, []string{shardIDLabel, pathLabel}),
treeOpenItems: metrics.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem,
Name: "open_blobovnicza_items_total",
Help: "Count of items in opened blobovniczas of Blobovnicza tree",
}, []string{shardIDLabel, pathLabel}),
treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem,
@ -139,3 +149,17 @@ func (b *blobovnicza) DecOpenBlobovniczaCount(shardID, path string) {
pathLabel: path,
}).Dec()
}
func (b *blobovnicza) AddOpenBlobovniczaItems(shardID, path string, items uint64) {
b.treeOpenItems.With(prometheus.Labels{
shardIDLabel: shardID,
pathLabel: path,
}).Add(float64(items))
}
func (b *blobovnicza) SubOpenBlobovniczaItems(shardID, path string, items uint64) {
b.treeOpenItems.With(prometheus.Labels{
shardIDLabel: shardID,
pathLabel: path,
}).Sub(float64(items))
}