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