forked from TrueCloudLab/frostfs-node
[#661] metrcis: Add rebuild percent metric
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
8bbfb2df43
commit
8911656b1a
4 changed files with 30 additions and 0 deletions
|
@ -30,6 +30,7 @@ func (b *Blobovniczas) Rebuild(ctx context.Context, prm common.RebuildPrm) (comm
|
|||
}
|
||||
|
||||
b.metrics.SetRebuildStatus(rebuildStatusRunning)
|
||||
b.metrics.SetRebuildPercent(0)
|
||||
success := true
|
||||
defer func() {
|
||||
if success {
|
||||
|
@ -71,6 +72,7 @@ func (b *Blobovniczas) Rebuild(ctx context.Context, prm common.RebuildPrm) (comm
|
|||
}
|
||||
|
||||
func (b *Blobovniczas) migrateDBs(ctx context.Context, dbs []string, prm common.RebuildPrm, res common.RebuildRes) (common.RebuildRes, error) {
|
||||
var completedDBCount uint32
|
||||
for _, db := range dbs {
|
||||
b.log.Debug(logs.BlobovniczaTreeRebuildingBlobovnicza, zap.String("path", db))
|
||||
movedObjects, err := b.rebuildDB(ctx, db, prm.MetaStorage, prm.WorkerLimiter)
|
||||
|
@ -81,7 +83,10 @@ func (b *Blobovniczas) migrateDBs(ctx context.Context, dbs []string, prm common.
|
|||
}
|
||||
b.log.Debug(logs.BlobovniczaTreeRebuildingBlobovniczaSuccess, zap.String("path", db), zap.Uint64("moved_objects_count", movedObjects))
|
||||
res.FilesRemoved++
|
||||
completedDBCount++
|
||||
b.metrics.SetRebuildPercent((100 * completedDBCount) / uint32(len(dbs)))
|
||||
}
|
||||
b.metrics.SetRebuildPercent(100)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue