[#1437] node: Use ctx for logging

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-21 10:22:54 +03:00
parent c16dae8b4d
commit 6db46257c0
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
157 changed files with 764 additions and 713 deletions

View file

@ -43,7 +43,7 @@ func (e *StorageEngine) RemoveDuplicates(ctx context.Context, prm RemoveDuplicat
prm.Concurrency = defaultRemoveDuplicatesConcurrency
}
e.log.Info(logs.EngineStartingRemovalOfLocallyredundantCopies,
e.log.Info(ctx, logs.EngineStartingRemovalOfLocallyredundantCopies,
zap.Int("concurrency", prm.Concurrency))
// The mutext must be taken for the whole duration to avoid target shard being removed
@ -55,7 +55,7 @@ func (e *StorageEngine) RemoveDuplicates(ctx context.Context, prm RemoveDuplicat
// This is not currently the case, because `FreeSpace` metric used by weight sorting is always 0.
// However we could change weights in future and easily forget this function.
for _, sh := range e.shards {
e.log.Debug(logs.EngineStartedDuplicatesRemovalRoutine, zap.Stringer("shard_id", sh.ID()))
e.log.Debug(ctx, logs.EngineStartedDuplicatesRemovalRoutine, zap.Stringer("shard_id", sh.ID()))
ch := make(chan oid.Address)
errG, ctx := errgroup.WithContext(ctx)
@ -93,12 +93,12 @@ func (e *StorageEngine) RemoveDuplicates(ctx context.Context, prm RemoveDuplicat
})
}
if err := errG.Wait(); err != nil {
e.log.Error(logs.EngineFinishedRemovalOfLocallyredundantCopies, zap.Error(err))
e.log.Error(ctx, logs.EngineFinishedRemovalOfLocallyredundantCopies, zap.Error(err))
return err
}
}
e.log.Info(logs.EngineFinishedRemovalOfLocallyredundantCopies)
e.log.Info(ctx, logs.EngineFinishedRemovalOfLocallyredundantCopies)
return nil
}