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>
37 lines
877 B
Go
37 lines
877 B
Go
package metrics
|
|
|
|
import (
|
|
"time"
|
|
|
|
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
|
)
|
|
|
|
func NewPiloramaMetrics(m metrics_impl.PiloramaMetrics) pilorama.Metrics {
|
|
return &piloramaMetrics{
|
|
shardID: undefined,
|
|
m: m,
|
|
}
|
|
}
|
|
|
|
type piloramaMetrics struct {
|
|
shardID string
|
|
m metrics_impl.PiloramaMetrics
|
|
}
|
|
|
|
func (m *piloramaMetrics) SetParentID(id string) {
|
|
m.shardID = id
|
|
}
|
|
|
|
func (m *piloramaMetrics) SetMode(mod mode.ComponentMode) {
|
|
m.m.SetMode(m.shardID, mod)
|
|
}
|
|
|
|
func (m *piloramaMetrics) Close() {
|
|
m.m.Close(m.shardID)
|
|
}
|
|
|
|
func (m *piloramaMetrics) AddMethodDuration(method string, d time.Duration, success bool) {
|
|
m.m.AddMethodDuration(m.shardID, method, d, success)
|
|
}
|