forked from TrueCloudLab/frostfs-node
Dmitrii Stepanov
81ea91de52
`metrics` don't look like something others want to import. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
39 lines
968 B
Go
39 lines
968 B
Go
package metrics
|
|
|
|
import (
|
|
"time"
|
|
|
|
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics"
|
|
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
|
)
|
|
|
|
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)
|
|
}
|