[#424] metrics: Use mode value as metric value for shard

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-06-14 11:00:44 +03:00
parent 847732605c
commit 4449006862
8 changed files with 66 additions and 74 deletions

View file

@ -50,8 +50,8 @@ func (m *metricsWithID) DecObjectCounter(objectType string) {
m.mw.AddToObjectCounter(m.id, objectType, -1)
}
func (m *metricsWithID) SetReadonly(readonly bool) {
m.mw.SetReadonly(m.id, readonly)
func (m *metricsWithID) SetMode(mode mode.Mode) {
m.mw.SetMode(m.id, mode)
}
func (m *metricsWithID) AddToContainerSize(cnr string, size int64) {
@ -90,7 +90,7 @@ func (e *StorageEngine) AddShard(opts ...shard.Option) (*shard.ID, error) {
}
if e.cfg.metrics != nil {
e.cfg.metrics.SetReadonly(sh.ID().String(), sh.GetMode() != mode.ReadWrite)
e.cfg.metrics.SetMode(sh.ID().String(), sh.GetMode())
}
return sh.ID(), nil