2023-06-07 14:06:02 +00:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2024-06-24 14:12:26 +00:00
|
|
|
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics"
|
2023-06-07 14:06:02 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/fstree"
|
2024-06-04 13:28:47 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
2023-06-07 14:06:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-06-04 13:28:47 +00:00
|
|
|
func (m *fstreeMetrics) SetMode(mod mode.ComponentMode) {
|
|
|
|
m.m.SetMode(m.shardID, m.path, mod)
|
2023-06-07 14:06:02 +00:00
|
|
|
}
|
2023-10-31 11:56:55 +00:00
|
|
|
|
2023-06-07 14:06:02 +00:00
|
|
|
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)
|
|
|
|
}
|
2023-10-31 11:56:55 +00:00
|
|
|
|
2023-06-07 14:06:02 +00:00
|
|
|
func (m *fstreeMetrics) Delete(d time.Duration, success bool) {
|
|
|
|
m.m.MethodDuration(m.shardID, m.path, "Delete", d, success)
|
|
|
|
}
|
2023-10-31 11:56:55 +00:00
|
|
|
|
2023-06-07 14:06:02 +00:00
|
|
|
func (m *fstreeMetrics) Exists(d time.Duration, success bool) {
|
|
|
|
m.m.MethodDuration(m.shardID, m.path, "Exists", d, success)
|
|
|
|
}
|
2023-10-31 11:56:55 +00:00
|
|
|
|
2023-06-07 14:06:02 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2023-10-31 11:56:55 +00:00
|
|
|
|
2023-06-07 14:06:02 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2023-10-31 11:56:55 +00:00
|
|
|
|
2023-06-07 14:06:02 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2024-03-12 14:36:26 +00:00
|
|
|
|
|
|
|
func (m *fstreeMetrics) ObjectsCount(d time.Duration, success bool) {
|
|
|
|
m.m.MethodDuration(m.shardID, m.path, "ObjectsCount", d, success)
|
|
|
|
}
|