frostfs-node/pkg/local_object_storage/metrics/metabase.go
Alexander Chuprov d61f78ec1f [#1121] node: Change mode of shard components
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2024-06-04 16:30:04 +03:00

39 lines
963 B
Go

package metrics
import (
"time"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/metrics"
)
func NewMetabaseMetrics(path string, m metrics_impl.MetabaseMetrics) meta.Metrics {
return &metabaseMetrics{
shardID: undefined,
path: path,
m: m,
}
}
type metabaseMetrics struct {
shardID string
path string
m metrics_impl.MetabaseMetrics
}
func (m *metabaseMetrics) SetParentID(parentID string) {
m.shardID = parentID
}
func (m *metabaseMetrics) SetMode(mode mode.ComponentMode) {
m.m.SetMode(m.shardID, m.path, mode.String())
}
func (m *metabaseMetrics) Close() {
m.m.Close(m.shardID, m.path)
}
func (m *metabaseMetrics) AddMethodDuration(method string, d time.Duration, success bool) {
m.m.MethodDuration(m.shardID, m.path, method, d, success)
}