From 8a1f4f8eab8c7905956ec2145c1c9aacbcfad0d4 Mon Sep 17 00:00:00 2001 From: Roman Loginov Date: Mon, 25 Nov 2024 15:40:59 +0300 Subject: [PATCH] [#498] layer: Add spans to detail the trace Signed-off-by: Roman Loginov --- api/layer/compound.go | 4 ++++ api/layer/cors.go | 10 +++++++++ api/layer/layer.go | 40 +++++++++++++++++++++++++++++++++-- api/layer/lifecycle.go | 10 +++++++++ api/layer/listing.go | 10 +++++++++ api/layer/multipart_upload.go | 22 +++++++++++++++++++ api/layer/object.go | 4 ++++ api/layer/patch.go | 4 ++++ api/layer/system_object.go | 13 ++++++++++++ api/layer/tagging.go | 19 +++++++++++++++++ 10 files changed, 134 insertions(+), 2 deletions(-) diff --git a/api/layer/compound.go b/api/layer/compound.go index 83f38051..ba59e70f 100644 --- a/api/layer/compound.go +++ b/api/layer/compound.go @@ -5,12 +5,16 @@ import ( "errors" "fmt" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/tree" ) func (n *Layer) GetObjectTaggingAndLock(ctx context.Context, objVersion *data.ObjectVersion, nodeVersion *data.NodeVersion) (map[string]string, data.LockInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetObjectTaggingAndLock") + defer span.End() + var err error owner := n.BearerOwner(ctx) diff --git a/api/layer/cors.go b/api/layer/cors.go index 49b6cc49..9157ee3b 100644 --- a/api/layer/cors.go +++ b/api/layer/cors.go @@ -7,6 +7,7 @@ import ( "fmt" "io" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs" @@ -22,6 +23,9 @@ const wildcard = "*" var supportedMethods = map[string]struct{}{"GET": {}, "HEAD": {}, "POST": {}, "PUT": {}, "DELETE": {}} func (n *Layer) PutBucketCORS(ctx context.Context, p *PutCORSParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutBucketCORS") + defer span.End() + var ( buf bytes.Buffer tee = io.TeeReader(p.Reader, &buf) @@ -96,6 +100,9 @@ func (n *Layer) deleteCORSObject(ctx context.Context, bktInfo *data.BucketInfo, } func (n *Layer) GetBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (*data.CORSConfiguration, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetBucketCORS") + defer span.End() + cors, err := n.getCORS(ctx, bktInfo) if err != nil { return nil, err @@ -105,6 +112,9 @@ func (n *Layer) GetBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (*d } func (n *Layer) DeleteBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteBucketCORS") + defer span.End() + objs, err := n.treeService.DeleteBucketCORS(ctx, bktInfo) objNotFound := errors.Is(err, tree.ErrNoNodeToRemove) if err != nil && !objNotFound { diff --git a/api/layer/layer.go b/api/layer/layer.go index 12d064c1..af0e5786 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -15,6 +15,7 @@ import ( "strings" "time" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" @@ -317,6 +318,9 @@ func (n *Layer) prepareAuthParameters(ctx context.Context, prm *frostfs.PrmAuth, // GetBucketInfo returns bucket info by name. func (n *Layer) GetBucketInfo(ctx context.Context, name string) (*data.BucketInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetBucketInfo") + defer span.End() + name, err := url.QueryUnescape(name) if err != nil { return nil, fmt.Errorf("unescape bucket name: %w", err) @@ -365,11 +369,17 @@ func (n *Layer) ResolveCID(ctx context.Context, name string) (cid.ID, error) { // ListBuckets returns all user containers. The name of the bucket is a container // id. Timestamp is omitted since it is not saved in frostfs container. func (n *Layer) ListBuckets(ctx context.Context) ([]*data.BucketInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.ListBuckets") + defer span.End() + return n.containerList(ctx) } // GetObject from storage. func (n *Layer) GetObject(ctx context.Context, p *GetObjectParams) (*ObjectPayload, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetObject") + defer span.End() + var params getParams params.objInfo = p.ObjectInfo @@ -484,6 +494,9 @@ func getDecrypter(p *GetObjectParams) (*encryption.Decrypter, error) { // GetObjectInfo returns meta information about the object. func (n *Layer) GetObjectInfo(ctx context.Context, p *HeadObjectParams) (*data.ObjectInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetObjectInfo") + defer span.End() + extendedObjectInfo, err := n.GetExtendedObjectInfo(ctx, p) if err != nil { return nil, err @@ -494,8 +507,13 @@ func (n *Layer) GetObjectInfo(ctx context.Context, p *HeadObjectParams) (*data.O // GetExtendedObjectInfo returns meta information and corresponding info from the tree service about the object. func (n *Layer) GetExtendedObjectInfo(ctx context.Context, p *HeadObjectParams) (*data.ExtendedObjectInfo, error) { - var objInfo *data.ExtendedObjectInfo - var err error + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetExtendedObjectInfo") + defer span.End() + + var ( + objInfo *data.ExtendedObjectInfo + err error + ) if p.Versioned() { objInfo, err = n.headVersion(ctx, p.BktInfo, p) @@ -515,6 +533,9 @@ func (n *Layer) GetExtendedObjectInfo(ctx context.Context, p *HeadObjectParams) // CopyObject from one bucket into another bucket. func (n *Layer) CopyObject(ctx context.Context, p *CopyObjectParams) (*data.ExtendedObjectInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.CopyObject") + defer span.End() + objPayload, err := n.GetObject(ctx, &GetObjectParams{ ObjectInfo: p.SrcObject, Versioned: p.SrcVersioned, @@ -773,6 +794,9 @@ func (n *Layer) removeCombinedObject(ctx context.Context, bkt *data.BucketInfo, // DeleteObjects from the storage. func (n *Layer) DeleteObjects(ctx context.Context, p *DeleteObjectParams) []*VersionedObject { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteObjects") + defer span.End() + for i, obj := range p.Objects { p.Objects[i] = n.deleteObject(ctx, p.BktInfo, p.Settings, obj, p.NetworkInfo) if p.IsMultiple && p.Objects[i].Error != nil { @@ -784,6 +808,9 @@ func (n *Layer) DeleteObjects(ctx context.Context, p *DeleteObjectParams) []*Ver } func (n *Layer) CreateBucket(ctx context.Context, p *CreateBucketParams) (*data.BucketInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.CreateBucket") + defer span.End() + bktInfo, err := n.GetBucketInfo(ctx, p.Name) if err != nil { if apierr.IsS3Error(err, apierr.ErrNoSuchBucket) { @@ -813,6 +840,9 @@ func (n *Layer) ResolveBucket(ctx context.Context, zone, name string) (cid.ID, e } func (n *Layer) DeleteBucket(ctx context.Context, p *DeleteBucketParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteBucket") + defer span.End() + if !p.SkipCheck { res, _, err := n.getAllObjectsVersions(ctx, commonVersionsListingParams{ BktInfo: p.BktInfo, @@ -856,6 +886,9 @@ func (n *Layer) DeleteBucket(ctx context.Context, p *DeleteBucketParams) error { } func (n *Layer) DeleteContainer(ctx context.Context, p *DeleteBucketParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteContainer") + defer span.End() + n.cache.DeleteBucket(p.BktInfo) if err := n.frostFS.DeleteContainer(ctx, p.BktInfo.CID, p.SessionToken); err != nil { return fmt.Errorf("delete container: %w", err) @@ -864,6 +897,9 @@ func (n *Layer) DeleteContainer(ctx context.Context, p *DeleteBucketParams) erro } func (n *Layer) GetNetworkInfo(ctx context.Context) (netmap.NetworkInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetNetworkInfo") + defer span.End() + cachedInfo := n.cache.GetNetworkInfo() if cachedInfo != nil { return *cachedInfo, nil diff --git a/api/layer/lifecycle.go b/api/layer/lifecycle.go index f16aded3..93b57a04 100644 --- a/api/layer/lifecycle.go +++ b/api/layer/lifecycle.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs" @@ -23,6 +24,9 @@ type PutBucketLifecycleParams struct { } func (n *Layer) PutBucketLifecycleConfiguration(ctx context.Context, p *PutBucketLifecycleParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutBucketLifecycleConfiguration") + defer span.End() + cfgBytes, err := xml.Marshal(p.LifecycleCfg) if err != nil { return fmt.Errorf("marshal lifecycle configuration: %w", err) @@ -84,6 +88,9 @@ func (n *Layer) deleteLifecycleObject(ctx context.Context, bktInfo *data.BucketI } func (n *Layer) GetBucketLifecycleConfiguration(ctx context.Context, bktInfo *data.BucketInfo) (*data.LifecycleConfiguration, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetBucketLifecycleConfiguration") + defer span.End() + owner := n.BearerOwner(ctx) if cfg := n.cache.GetLifecycleConfiguration(owner, bktInfo); cfg != nil { return cfg, nil @@ -129,6 +136,9 @@ func (n *Layer) GetBucketLifecycleConfiguration(ctx context.Context, bktInfo *da } func (n *Layer) DeleteBucketLifecycleConfiguration(ctx context.Context, bktInfo *data.BucketInfo) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteBucketLifecycleConfiguration") + defer span.End() + objs, err := n.treeService.DeleteBucketLifecycleConfiguration(ctx, bktInfo) objsNotFound := errors.Is(err, tree.ErrNoNodeToRemove) if err != nil && !objsNotFound { diff --git a/api/layer/listing.go b/api/layer/listing.go index 790243b8..e8354e0f 100644 --- a/api/layer/listing.go +++ b/api/layer/listing.go @@ -9,6 +9,7 @@ import ( "strings" "sync" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/cache" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" @@ -97,6 +98,9 @@ const ( // ListObjectsV1 returns objects in a bucket for requests of Version 1. func (n *Layer) ListObjectsV1(ctx context.Context, p *ListObjectsParamsV1) (*ListObjectsInfoV1, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.ListObjectsV1") + defer span.End() + var result ListObjectsInfoV1 prm := commonLatestVersionsListingParams{ @@ -128,6 +132,9 @@ func (n *Layer) ListObjectsV1(ctx context.Context, p *ListObjectsParamsV1) (*Lis // ListObjectsV2 returns objects in a bucket for requests of Version 2. func (n *Layer) ListObjectsV2(ctx context.Context, p *ListObjectsParamsV2) (*ListObjectsInfoV2, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.ListObjectsV2") + defer span.End() + var result ListObjectsInfoV2 prm := commonLatestVersionsListingParams{ @@ -158,6 +165,9 @@ func (n *Layer) ListObjectsV2(ctx context.Context, p *ListObjectsParamsV2) (*Lis } func (n *Layer) ListObjectVersions(ctx context.Context, p *ListObjectVersionsParams) (*ListObjectVersionsInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.ListObjectVersions") + defer span.End() + prm := commonVersionsListingParams{ BktInfo: p.BktInfo, Delimiter: p.Delimiter, diff --git a/api/layer/multipart_upload.go b/api/layer/multipart_upload.go index 9e9375a9..6e8d16bb 100644 --- a/api/layer/multipart_upload.go +++ b/api/layer/multipart_upload.go @@ -15,6 +15,7 @@ import ( "strings" "time" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/auth" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" @@ -147,6 +148,9 @@ type ( ) func (n *Layer) CreateMultipartUpload(ctx context.Context, p *CreateMultipartParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.CreateMultipartUpload") + defer span.End() + metaSize := len(p.Header) if p.Data != nil { metaSize += len(p.Data.TagSet) @@ -187,6 +191,9 @@ func (n *Layer) CreateMultipartUpload(ctx context.Context, p *CreateMultipartPar } func (n *Layer) UploadPart(ctx context.Context, p *UploadPartParams) (string, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.UploadPart") + defer span.End() + multipartInfo, err := n.treeService.GetMultipartUpload(ctx, p.Info.Bkt, p.Info.Key, p.Info.UploadID) if err != nil { if errors.Is(err, tree.ErrNodeNotFound) { @@ -332,6 +339,9 @@ func (n *Layer) uploadPart(ctx context.Context, multipartInfo *data.MultipartInf } func (n *Layer) UploadPartCopy(ctx context.Context, p *UploadCopyParams) (*data.ObjectInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.UploadPartCopy") + defer span.End() + multipartInfo, err := n.treeService.GetMultipartUpload(ctx, p.Info.Bkt, p.Info.Key, p.Info.UploadID) if err != nil { if errors.Is(err, tree.ErrNodeNotFound) { @@ -380,6 +390,9 @@ func (n *Layer) UploadPartCopy(ctx context.Context, p *UploadCopyParams) (*data. } func (n *Layer) CompleteMultipartUpload(ctx context.Context, p *CompleteMultipartParams) (*UploadData, *data.ExtendedObjectInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.CompleteMultipartUpload") + defer span.End() + for i := 1; i < len(p.Parts); i++ { if p.Parts[i].PartNumber <= p.Parts[i-1].PartNumber { return nil, nil, apierr.GetAPIError(apierr.ErrInvalidPartOrder) @@ -500,6 +513,9 @@ func (n *Layer) CompleteMultipartUpload(ctx context.Context, p *CompleteMultipar } func (n *Layer) ListMultipartUploads(ctx context.Context, p *ListMultipartUploadsParams) (*ListMultipartUploadsInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.ListMultipartUploads") + defer span.End() + var result ListMultipartUploadsInfo if p.MaxUploads == 0 { return &result, nil @@ -560,6 +576,9 @@ func (n *Layer) ListMultipartUploads(ctx context.Context, p *ListMultipartUpload } func (n *Layer) AbortMultipartUpload(ctx context.Context, p *UploadInfoParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.AbortMultipartUpload") + defer span.End() + multipartInfo, parts, err := n.getUploadParts(ctx, p) if err != nil { return err @@ -578,6 +597,9 @@ func (n *Layer) AbortMultipartUpload(ctx context.Context, p *UploadInfoParams) e } func (n *Layer) ListParts(ctx context.Context, p *ListPartsParams) (*ListPartsInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.ListParts") + defer span.End() + var res ListPartsInfo multipartInfo, partsInfo, err := n.getUploadParts(ctx, p.Info) if err != nil { diff --git a/api/layer/object.go b/api/layer/object.go index 555a0cbf..90ea0086 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -17,6 +17,7 @@ import ( "strconv" "strings" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/auth" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" @@ -227,6 +228,9 @@ func ParseCompletedPartHeader(hdr string) (*Part, error) { // PutObject stores object into FrostFS, took payload from io.Reader. func (n *Layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.ExtendedObjectInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutObject") + defer span.End() + bktSettings, err := n.GetBucketSettings(ctx, p.BktInfo) if err != nil { return nil, fmt.Errorf("couldn't get versioning settings object: %w", err) diff --git a/api/layer/patch.go b/api/layer/patch.go index fca21427..def74c1c 100644 --- a/api/layer/patch.go +++ b/api/layer/patch.go @@ -10,6 +10,7 @@ import ( "strconv" "strings" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs" @@ -25,6 +26,9 @@ type PatchObjectParams struct { } func (n *Layer) PatchObject(ctx context.Context, p *PatchObjectParams) (*data.ExtendedObjectInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PatchObject") + defer span.End() + if p.Object.ObjectInfo.Headers[AttributeDecryptedSize] != "" { return nil, fmt.Errorf("patch encrypted object") } diff --git a/api/layer/system_object.go b/api/layer/system_object.go index 626d6689..568abaec 100644 --- a/api/layer/system_object.go +++ b/api/layer/system_object.go @@ -10,6 +10,7 @@ import ( "time" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs" @@ -30,6 +31,9 @@ type PutLockInfoParams struct { } func (n *Layer) PutLockInfo(ctx context.Context, p *PutLockInfoParams) (err error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutLockInfo") + defer span.End() + newLock := p.NewLock versionNode := p.NodeVersion // sometimes node version can be provided from executing context @@ -137,6 +141,9 @@ func (n *Layer) putLockObject(ctx context.Context, bktInfo *data.BucketInfo, obj } func (n *Layer) GetLockInfo(ctx context.Context, objVersion *data.ObjectVersion) (*data.LockInfo, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetLockInfo") + defer span.End() + owner := n.BearerOwner(ctx) if lockInfo := n.cache.GetLockInfo(owner, lockObjectKey(objVersion)); lockInfo != nil { return lockInfo, nil @@ -204,6 +211,9 @@ func lockObjectKey(objVersion *data.ObjectVersion) string { } func (n *Layer) GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo) (*data.BucketSettings, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetBucketSettings") + defer span.End() + owner := n.BearerOwner(ctx) if settings := n.cache.GetSettings(owner, bktInfo); settings != nil { return settings, nil @@ -223,6 +233,9 @@ func (n *Layer) GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo) } func (n *Layer) PutBucketSettings(ctx context.Context, p *PutSettingsParams) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutBucketSettings") + defer span.End() + if err := n.treeService.PutSettingsNode(ctx, p.BktInfo, p.Settings); err != nil { return fmt.Errorf("failed to get settings node: %w", err) } diff --git a/api/layer/tagging.go b/api/layer/tagging.go index a80e72b4..a8eaed33 100644 --- a/api/layer/tagging.go +++ b/api/layer/tagging.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" + "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/tree" @@ -16,6 +17,9 @@ import ( ) func (n *Layer) GetObjectTagging(ctx context.Context, p *data.GetObjectTaggingParams) (string, map[string]string, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetObjectTagging") + defer span.End() + var err error owner := n.BearerOwner(ctx) @@ -52,6 +56,9 @@ func (n *Layer) GetObjectTagging(ctx context.Context, p *data.GetObjectTaggingPa } func (n *Layer) PutObjectTagging(ctx context.Context, p *data.PutObjectTaggingParams) (err error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutObjectTagging") + defer span.End() + nodeVersion := p.NodeVersion if nodeVersion == nil { nodeVersion, err = n.getNodeVersionFromCacheOrFrostfs(ctx, p.ObjectVersion) @@ -75,6 +82,9 @@ func (n *Layer) PutObjectTagging(ctx context.Context, p *data.PutObjectTaggingPa } func (n *Layer) DeleteObjectTagging(ctx context.Context, p *data.ObjectVersion) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteObjectTagging") + defer span.End() + version, err := n.getNodeVersion(ctx, p) if err != nil { return err @@ -96,6 +106,9 @@ func (n *Layer) DeleteObjectTagging(ctx context.Context, p *data.ObjectVersion) } func (n *Layer) GetBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) (map[string]string, error) { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.GetBucketTagging") + defer span.End() + owner := n.BearerOwner(ctx) if tags := n.cache.GetTagging(owner, bucketTaggingCacheKey(bktInfo.CID)); tags != nil { @@ -113,6 +126,9 @@ func (n *Layer) GetBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) } func (n *Layer) PutBucketTagging(ctx context.Context, bktInfo *data.BucketInfo, tagSet map[string]string) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.PutBucketTagging") + defer span.End() + if err := n.treeService.PutBucketTagging(ctx, bktInfo, tagSet); err != nil { return err } @@ -123,6 +139,9 @@ func (n *Layer) PutBucketTagging(ctx context.Context, bktInfo *data.BucketInfo, } func (n *Layer) DeleteBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) error { + ctx, span := tracing.StartSpanFromContext(ctx, "layer.DeleteBucketTagging") + defer span.End() + n.cache.DeleteTagging(bucketTaggingCacheKey(bktInfo.CID)) return n.treeService.DeleteBucketTagging(ctx, bktInfo)