40 lines
954 B
Go
40 lines
954 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.Mode) {
|
||
|
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)
|
||
|
}
|