diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 612e74cce3..fd77cae480 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -327,7 +327,7 @@ func initObjectService(c *cfg) { SetEACLSource(c.cfgObject.eaclSource). SetValidator(eaclSDK.NewValidator()). SetLocalStorage(ls). - SetHeaderSource(cachedHeaderSource(sGet, cachedFirstObjectsNumber)), + SetHeaderSource(cachedHeaderSource(sGet, cachedFirstObjectsNumber, c.log)), ), ), ) @@ -546,8 +546,11 @@ func (e storageEngine) Put(o *objectSDK.Object, objBin []byte, hdrLen int) error return err } -func cachedHeaderSource(getSvc *getsvc.Service, cacheSize int) headerSource { - hs := headerSource{getsvc: getSvc} +func cachedHeaderSource(getSvc *getsvc.Service, cacheSize int, l *zap.Logger) headerSource { + hs := headerSource{ + getsvc: getSvc, + l: l.With(zap.String("service", "cached header source"), zap.Int("cache capacity", cacheSize)), + } if cacheSize > 0 { var err error @@ -563,6 +566,7 @@ func cachedHeaderSource(getSvc *getsvc.Service, cacheSize int) headerSource { type headerSource struct { getsvc *getsvc.Service cache *lru.Cache[oid.Address, *objectSDK.Object] + l *zap.Logger } type headerWriter struct { @@ -575,9 +579,13 @@ func (h *headerWriter) WriteHeader(o *objectSDK.Object) error { } func (h headerSource) Head(address oid.Address) (*objectSDK.Object, error) { + l := h.l.With(zap.Stringer("address", address)) + l.Debug("requesting header") + if h.cache != nil { head, ok := h.cache.Get(address) if ok { + l.Debug("returning header from cache") return head, nil } } @@ -598,6 +606,8 @@ func (h headerSource) Head(address oid.Address) (*objectSDK.Object, error) { h.cache.Add(address, hw.h) + l.Debug("returning header from network") + return hw.h, nil } diff --git a/pkg/services/object/acl/v2/classifier.go b/pkg/services/object/acl/v2/classifier.go index d4901a3903..c08d0b9667 100644 --- a/pkg/services/object/acl/v2/classifier.go +++ b/pkg/services/object/acl/v2/classifier.go @@ -31,6 +31,8 @@ func (c senderClassifier) classify( return nil, err } + l := c.log.With(zap.Stringer("cid", idCnr), zap.Stringer("requester", ownerID)) + // TODO: #767 get owner from neofs.id if present // if request owner is the same as container owner, return RoleUser @@ -44,7 +46,7 @@ func (c senderClassifier) classify( isInnerRingNode, err := c.isInnerRingKey(ownerKey) if err != nil { // do not throw error, try best case matching - c.log.Debug("can't check if request from inner ring", + l.Debug("can't check if request from inner ring", zap.String("error", err.Error())) } else if isInnerRingNode { return &classifyResult{ @@ -58,7 +60,7 @@ func (c senderClassifier) classify( // error might happen if request has `RoleOther` key and placement // is not possible for previous epoch, so // do not throw error, try best case matching - c.log.Debug("can't check if request from container node", + l.Debug("can't check if request from container node", zap.String("error", err.Error())) } else if isContainerNode { return &classifyResult{ diff --git a/pkg/services/object/get/remote.go b/pkg/services/object/get/remote.go index 8e0a815012..2cadb23976 100644 --- a/pkg/services/object/get/remote.go +++ b/pkg/services/object/get/remote.go @@ -10,7 +10,12 @@ import ( ) func (exec *execCtx) processNode(info client.NodeInfo) bool { - exec.log.Debug("processing node...") + l := exec.log.With( + zap.Stringers("address group", info.AddressGroup()), + zap.Stringers("external address group", info.ExternalAddressGroup()), + ) + + l.Debug("processing node...") client, ok := exec.remoteClient(info) if !ok { @@ -26,7 +31,7 @@ func (exec *execCtx) processNode(info client.NodeInfo) bool { exec.status = statusUndefined exec.err = apistatus.ErrObjectNotFound - exec.log.Debug("remote call failed", + l.Debug("remote call failed", zap.String("error", err.Error()), ) case err == nil: