[#606] Reorganize some log tags

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2025-02-11 16:47:05 +03:00
parent b207eb48d9
commit ee46382a68
6 changed files with 30 additions and 29 deletions

View file

@ -52,7 +52,7 @@ func NewListSessionCache(config *Config) *ListSessionCache {
session, ok := val.(*data.ListSession) session, ok := val.(*data.ListSession)
if !ok { if !ok {
config.Logger.Warn(logs.InvalidCacheEntryType, zap.String("actual", fmt.Sprintf("%T", val)), config.Logger.Warn(logs.InvalidCacheEntryType, zap.String("actual", fmt.Sprintf("%T", val)),
zap.String("expected", fmt.Sprintf("%T", session))) zap.String("expected", fmt.Sprintf("%T", session)), logs.TagField(logs.TagDatapath))
} }
if !session.Acquired.Load() { if !session.Acquired.Load() {

View file

@ -108,13 +108,13 @@ func (h *handler) AppendCORSHeaders(w http.ResponseWriter, r *http.Request) {
} }
bktInfo, err := h.getBucketInfo(ctx, reqInfo.BucketName) bktInfo, err := h.getBucketInfo(ctx, reqInfo.BucketName)
if err != nil { if err != nil {
h.reqLogger(ctx).Warn(logs.GetBucketInfo, zap.Error(err), logs.TagField(logs.TagExternalBlockchain)) h.reqLogger(ctx).Warn(logs.GetBucketInfo, zap.Error(err), logs.TagField(logs.TagDatapath))
return return
} }
cors, err := h.obj.GetBucketCORS(ctx, bktInfo, h.cfg.NewXMLDecoder) cors, err := h.obj.GetBucketCORS(ctx, bktInfo, h.cfg.NewXMLDecoder)
if err != nil { if err != nil {
h.reqLogger(ctx).Warn(logs.GetBucketCors, zap.Error(err), logs.TagField(logs.TagExternalStorageTree)) h.reqLogger(ctx).Warn(logs.GetBucketCors, zap.Error(err), logs.TagField(logs.TagDatapath))
return return
} }

View file

@ -853,7 +853,7 @@ func (n *Layer) ResolveBucket(ctx context.Context, zone, name string) (cid.ID, e
return cid.ID{}, err return cid.ID{}, err
} }
n.reqLogger(ctx).Info(logs.ResolveBucket, zap.Stringer("cid", cnrID), logs.TagField(logs.TagExternalBlockchain)) n.reqLogger(ctx).Info(logs.ResolveBucket, zap.Stringer("cid", cnrID), logs.TagField(logs.TagDatapath))
} }
return cnrID, nil return cnrID, nil
@ -878,7 +878,7 @@ func (n *Layer) DeleteBucket(ctx context.Context, p *DeleteBucketParams) error {
corsObj, err := n.treeService.GetBucketCORS(ctx, p.BktInfo) corsObj, err := n.treeService.GetBucketCORS(ctx, p.BktInfo)
if err != nil { if err != nil {
n.reqLogger(ctx).Error(logs.GetBucketCors, zap.Error(err), logs.TagField(logs.TagExternalStorageTree)) n.reqLogger(ctx).Error(logs.GetBucketCorsFromTree, zap.Error(err), logs.TagField(logs.TagExternalStorageTree))
} }
lifecycleObj, treeErr := n.treeService.GetBucketLifecycleConfiguration(ctx, p.BktInfo) lifecycleObj, treeErr := n.treeService.GetBucketLifecycleConfiguration(ctx, p.BktInfo)

View file

@ -548,7 +548,7 @@ func (n *Layer) objectPutAndHash(ctx context.Context, prm frostfs.PrmObjectCreat
func (n *Layer) payloadDiscard(ctx context.Context, payload io.Reader) { func (n *Layer) payloadDiscard(ctx context.Context, payload io.Reader) {
if payload != nil { if payload != nil {
if _, errDiscard := io.Copy(io.Discard, payload); errDiscard != nil { if _, errDiscard := io.Copy(io.Discard, payload); errDiscard != nil {
n.reqLogger(ctx).Warn(logs.FailedToDiscardPutPayloadProbablyGoroutineLeaks, zap.Error(errDiscard), logs.TagField(logs.TagExternalStorage)) n.reqLogger(ctx).Warn(logs.FailedToDiscardPutPayloadProbablyGoroutineLeaks, zap.Error(errDiscard), logs.TagField(logs.TagDatapath))
} }
} }
} }

View file

@ -139,7 +139,7 @@ func resolveCID(log *zap.Logger, resolveContainerID ContainerIDResolveFunc) cidR
containerID, err := resolveContainerID(ctx, reqInfo.BucketName) containerID, err := resolveContainerID(ctx, reqInfo.BucketName)
if err != nil { if err != nil {
reqLogOrDefault(ctx, log).Debug(logs.FailedToResolveCID, zap.Error(err), logs.TagField(logs.TagExternalBlockchain)) reqLogOrDefault(ctx, log).Debug(logs.FailedToResolveCID, zap.Error(err), logs.TagField(logs.TagDatapath))
return "" return ""
} }

View file

@ -154,42 +154,42 @@ const (
CouldntCacheCors = "couldn't cache cors" CouldntCacheCors = "couldn't cache cors"
CouldntCacheListPolicyChains = "couldn't cache list policy chains" CouldntCacheListPolicyChains = "couldn't cache list policy chains"
CouldntCacheLifecycleConfiguration = "couldn't cache lifecycle configuration" CouldntCacheLifecycleConfiguration = "couldn't cache lifecycle configuration"
GetBucketCors = "get bucket cors"
GetBucketInfo = "get bucket info"
ResolveBucket = "resolve bucket"
FailedToResolveCID = "failed to resolve CID"
FailedToDiscardPutPayloadProbablyGoroutineLeaks = "failed to discard put payload, probably goroutine leaks"
) )
// External storage. // External storage.
const ( const (
ObjectIsCopied = "object is copied" ObjectIsCopied = "object is copied"
CouldntDeleteObject = "couldn't delete object" CouldntDeleteObject = "couldn't delete object"
CouldNotListUserContainers = "could not list user containers" CouldNotListUserContainers = "could not list user containers"
CouldNotFetchContainerInfo = "could not fetch container info" CouldNotFetchContainerInfo = "could not fetch container info"
CouldntDeleteObjectFromStorageContinueDeleting = "couldn't delete object from storage, continue deleting from tree" CouldntDeleteObjectFromStorageContinueDeleting = "couldn't delete object from storage, continue deleting from tree"
FailedToPutTombstoneObject = "failed to put tombstone object" FailedToPutTombstoneObject = "failed to put tombstone object"
FailedToListAllObjectRelations = "failed to list all object relations" FailedToListAllObjectRelations = "failed to list all object relations"
FailedToPutTombstones = "failed to put tombstones" FailedToPutTombstones = "failed to put tombstones"
CouldntDeleteCorsObject = "couldn't delete cors object" CouldntDeleteCorsObject = "couldn't delete cors object"
BucketIsCreated = "bucket is created" BucketIsCreated = "bucket is created"
CouldntDeleteOldPartObject = "couldn't delete old part object" CouldntDeleteOldPartObject = "couldn't delete old part object"
CouldNotPutCompletedObject = "could not put a completed object (multipart upload)" CouldNotPutCompletedObject = "could not put a completed object (multipart upload)"
CouldNotDeleteUploadPart = "could not delete upload part" CouldNotDeleteUploadPart = "could not delete upload part"
PutObject = "put object" PutObject = "put object"
CouldNotFetchObjectMeta = "could not fetch object meta" CouldNotFetchObjectMeta = "could not fetch object meta"
FailedToDiscardPutPayloadProbablyGoroutineLeaks = "failed to discard put payload, probably goroutine leaks" FailedToDeleteObject = "failed to delete object"
FailedToDeleteObject = "failed to delete object" CouldntDeleteLifecycleObject = "couldn't delete lifecycle configuration object"
CouldntDeleteLifecycleObject = "couldn't delete lifecycle configuration object"
) )
// External blockchain. // External blockchain.
const ( const (
UserGroupsListIsEmpty = "user groups list is empty, subject not found" UserGroupsListIsEmpty = "user groups list is empty, subject not found"
ResolveBucket = "resolve bucket"
FailedToResolveCID = "failed to resolve CID"
GetBucketInfo = "get bucket info"
) )
// External storage tree. // External storage tree.
const ( const (
FoundMoreThanOneUnversionedNode = "found more than one unversioned node" FoundMoreThanOneUnversionedNode = "found more than one unversioned node"
GetBucketCors = "get bucket cors"
GetTreeNode = "get tree node" GetTreeNode = "get tree node"
InvalidTreeKV = "invalid tree service meta KV" InvalidTreeKV = "invalid tree service meta KV"
FailedToRemoveOldSystemNode = "failed to remove old system node" FailedToRemoveOldSystemNode = "failed to remove old system node"
@ -200,6 +200,7 @@ const (
BucketTaggingNodeHasMultipleIDs = "bucket tagging node has multiple ids" BucketTaggingNodeHasMultipleIDs = "bucket tagging node has multiple ids"
BucketSettingsNodeHasMultipleIDs = "bucket settings node has multiple ids" BucketSettingsNodeHasMultipleIDs = "bucket settings node has multiple ids"
BucketCORSNodeHasMultipleIDs = "bucket cors node has multiple ids" BucketCORSNodeHasMultipleIDs = "bucket cors node has multiple ids"
GetBucketCorsFromTree = "get bucket cors from tree"
) )
// Authmate. // Authmate.