frostfs-node/pkg/local_object_storage/metrics/fstree.go
Dmitrii Stepanov b66ea2c713
Some checks failed
DCO action / DCO (pull_request) Successful in 1m51s
Build / Build Components (1.21) (pull_request) Successful in 3m7s
Vulncheck / Vulncheck (pull_request) Successful in 3m27s
Tests and linters / Lint (pull_request) Failing after 4m18s
Build / Build Components (1.20) (pull_request) Successful in 4m40s
Tests and linters / gopls check (pull_request) Successful in 6m40s
Tests and linters / Staticcheck (pull_request) Successful in 7m10s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m48s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m58s
Tests and linters / Tests with -race (pull_request) Successful in 8m32s
[#1029] metabase: Add refill metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-04-09 19:47:46 +03:00

71 lines
1.8 KiB
Go

package metrics
import (
"time"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/fstree"
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/metrics"
)
func NewFSTreeMetricsWithoutShardID(path string, m metrics_impl.FSTreeMetrics) fstree.Metrics {
return &fstreeMetrics{
shardID: undefined,
path: path,
m: m,
}
}
type fstreeMetrics struct {
shardID string
path string
m metrics_impl.FSTreeMetrics
}
func (m *fstreeMetrics) SetParentID(parentID string) {
m.shardID = parentID
}
func (m *fstreeMetrics) SetMode(readOnly bool) {
m.m.SetMode(m.shardID, m.path, readOnly)
}
func (m *fstreeMetrics) Close() {
m.m.Close(m.shardID, m.path)
}
func (m *fstreeMetrics) Iterate(d time.Duration, success bool) {
m.m.MethodDuration(m.shardID, m.path, "Iterate", d, success)
}
func (m *fstreeMetrics) Delete(d time.Duration, success bool) {
m.m.MethodDuration(m.shardID, m.path, "Delete", d, success)
}
func (m *fstreeMetrics) Exists(d time.Duration, success bool) {
m.m.MethodDuration(m.shardID, m.path, "Exists", d, success)
}
func (m *fstreeMetrics) Put(d time.Duration, size int, success bool) {
m.m.MethodDuration(m.shardID, m.path, "Put", d, success)
if success {
m.m.AddPut(m.shardID, m.path, size)
}
}
func (m *fstreeMetrics) Get(d time.Duration, size int, success bool) {
m.m.MethodDuration(m.shardID, m.path, "Get", d, success)
if success {
m.m.AddGet(m.shardID, m.path, size)
}
}
func (m *fstreeMetrics) GetRange(d time.Duration, size int, success bool) {
m.m.MethodDuration(m.shardID, m.path, "GetRange", d, success)
if success {
m.m.AddGet(m.shardID, m.path, size)
}
}
func (m *fstreeMetrics) ObjectsCount(d time.Duration, success bool) {
m.m.MethodDuration(m.shardID, m.path, "ObjectsCount", d, success)
}