Revert "[#135] acl: Add tracing spans"

This reverts commit b2ca730547.
This commit is contained in:
Evgenii Stratonikov 2023-04-12 16:54:04 +03:00
parent 5d2affa5cd
commit 08769f413f

View file

@ -6,7 +6,6 @@ import (
"fmt"
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
@ -112,14 +111,6 @@ func New(opts ...Option) Service {
// Get implements ServiceServer interface, makes ACL checks and calls
// next Get method in the ServiceServer pipeline.
func (b Service) Get(request *objectV2.GetRequest, stream object.GetObjectStream) error {
spanClosed := false
_, span := tracing.StartSpanFromContext(stream.Context(), "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
cnr, err := getContainerIDFromRequest(request)
if err != nil {
return err
@ -167,9 +158,6 @@ func (b Service) Get(request *objectV2.GetRequest, stream object.GetObjectStream
return eACLErr(reqInfo, err)
}
span.End()
spanClosed = true
return b.next.Get(request, &getStreamBasicChecker{
GetObjectStream: stream,
info: reqInfo,
@ -189,14 +177,6 @@ func (b Service) Put() (object.PutObjectStream, error) {
func (b Service) Head(
ctx context.Context,
request *objectV2.HeadRequest) (*objectV2.HeadResponse, error) {
spanClosed := false
_, span := tracing.StartSpanFromContext(ctx, "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
cnr, err := getContainerIDFromRequest(request)
if err != nil {
return nil, err
@ -244,9 +224,6 @@ func (b Service) Head(
return nil, eACLErr(reqInfo, err)
}
span.End()
spanClosed = true
resp, err := b.next.Head(ctx, request)
if err == nil {
if err = b.checker.CheckEACL(resp, reqInfo); err != nil {
@ -258,14 +235,6 @@ func (b Service) Head(
}
func (b Service) Search(request *objectV2.SearchRequest, stream object.SearchStream) error {
spanClosed := false
_, span := tracing.StartSpanFromContext(stream.Context(), "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
id, err := getContainerIDFromRequest(request)
if err != nil {
return err
@ -306,9 +275,6 @@ func (b Service) Search(request *objectV2.SearchRequest, stream object.SearchStr
return eACLErr(reqInfo, err)
}
span.End()
spanClosed = true
return b.next.Search(request, &searchStreamBasicChecker{
checker: b.checker,
SearchStream: stream,
@ -319,14 +285,6 @@ func (b Service) Search(request *objectV2.SearchRequest, stream object.SearchStr
func (b Service) Delete(
ctx context.Context,
request *objectV2.DeleteRequest) (*objectV2.DeleteResponse, error) {
spanClosed := false
_, span := tracing.StartSpanFromContext(ctx, "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
cnr, err := getContainerIDFromRequest(request)
if err != nil {
return nil, err
@ -374,21 +332,10 @@ func (b Service) Delete(
return nil, eACLErr(reqInfo, err)
}
span.End()
spanClosed = true
return b.next.Delete(ctx, request)
}
func (b Service) GetRange(request *objectV2.GetRangeRequest, stream object.GetObjectRangeStream) error {
spanClosed := false
_, span := tracing.StartSpanFromContext(stream.Context(), "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
cnr, err := getContainerIDFromRequest(request)
if err != nil {
return err
@ -436,9 +383,6 @@ func (b Service) GetRange(request *objectV2.GetRangeRequest, stream object.GetOb
return eACLErr(reqInfo, err)
}
span.End()
spanClosed = true
return b.next.GetRange(request, &rangeStreamBasicChecker{
checker: b.checker,
GetObjectRangeStream: stream,
@ -449,14 +393,6 @@ func (b Service) GetRange(request *objectV2.GetRangeRequest, stream object.GetOb
func (b Service) GetRangeHash(
ctx context.Context,
request *objectV2.GetRangeHashRequest) (*objectV2.GetRangeHashResponse, error) {
spanClosed := false
_, span := tracing.StartSpanFromContext(ctx, "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
cnr, err := getContainerIDFromRequest(request)
if err != nil {
return nil, err
@ -504,21 +440,10 @@ func (b Service) GetRangeHash(
return nil, eACLErr(reqInfo, err)
}
span.End()
spanClosed = true
return b.next.GetRangeHash(ctx, request)
}
func (p putStreamBasicChecker) Send(ctx context.Context, request *objectV2.PutRequest) error {
spanClosed := false
_, span := tracing.StartSpanFromContext(ctx, "checkACL")
defer func() {
if !spanClosed {
span.End()
}
}()
body := request.GetBody()
if body == nil {
return errEmptyBody
@ -587,9 +512,6 @@ func (p putStreamBasicChecker) Send(ctx context.Context, request *objectV2.PutRe
}
}
span.End()
spanClosed = true
return p.next.Send(ctx, request)
}