forked from TrueCloudLab/frostfs-node
[#2022] Add metric readonly
to get shards mode
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
e5c304536b
commit
edb1428248
7 changed files with 59 additions and 3 deletions
|
@ -45,6 +45,10 @@ 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)
|
||||
}
|
||||
|
||||
// AddShard adds a new shard to the storage engine.
|
||||
//
|
||||
// Returns any error encountered that did not allow adding a shard.
|
||||
|
@ -60,6 +64,10 @@ func (e *StorageEngine) AddShard(opts ...shard.Option) (*shard.ID, error) {
|
|||
return nil, fmt.Errorf("could not add %s shard: %w", sh.ID().String(), err)
|
||||
}
|
||||
|
||||
if e.cfg.metrics != nil {
|
||||
e.cfg.metrics.SetReadonly(sh.ID().String(), sh.GetMode() != mode.ReadWrite)
|
||||
}
|
||||
|
||||
return sh.ID(), nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue