[#849] policer: Log object address in processNodes method

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-24 18:19:54 +03:00 committed by Alex Vanin
parent 14329ab565
commit d613a856ce

View file

@ -47,6 +47,10 @@ func (p *Policer) processObject(ctx context.Context, addr *object.Address) {
} }
func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes netmap.Nodes, shortage uint32) { func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes netmap.Nodes, shortage uint32) {
log := p.log.With(
zap.Stringer("object", addr),
)
prm := new(headsvc.RemoteHeadPrm).WithObjectAddress(addr) prm := new(headsvc.RemoteHeadPrm).WithObjectAddress(addr)
redundantLocalCopy := false redundantLocalCopy := false
@ -61,7 +65,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes
err := node.FromIterator(nodes[i]) err := node.FromIterator(nodes[i])
if err != nil { if err != nil {
p.log.Error("could not parse network address", log.Error("could not parse network address",
zap.String("error", err.Error()), zap.String("error", err.Error()),
) )
@ -91,7 +95,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes
if strings.Contains(err.Error(), headsvc.ErrNotFound.Error()) { if strings.Contains(err.Error(), headsvc.ErrNotFound.Error()) {
continue continue
} else { } else {
p.log.Error("could not receive object header", log.Error("could not receive object header",
zap.String("error", err.Error()), zap.String("error", err.Error()),
) )
@ -107,7 +111,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes
} }
if shortage > 0 { if shortage > 0 {
p.log.Info("shortage of object copies detected", log.Info("shortage of object copies detected",
zap.Uint32("shortage", shortage), zap.Uint32("shortage", shortage),
) )