Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor agent GetObject error not to wrap with details for performance issue #2154

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions pkg/agent/core/ngt/handler/grpc/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/vdaas/vald/apis/grpc/v1/payload"
"github.com/vdaas/vald/apis/grpc/v1/vald"
"github.com/vdaas/vald/internal/errors"
"github.com/vdaas/vald/internal/info"
"github.com/vdaas/vald/internal/log"
"github.com/vdaas/vald/internal/net/grpc"
"github.com/vdaas/vald/internal/net/grpc/codes"
Expand Down Expand Up @@ -67,17 +66,7 @@ func (s *server) Exists(ctx context.Context, uid *payload.Object_ID) (res *paylo
return nil, err
}
if _, ok := s.ngt.Exists(uuid); !ok {
err = errors.ErrObjectIDNotFound(uid.GetId())
err = status.WrapWithNotFound(fmt.Sprintf("Exists API meta %s's uuid not found", uid.GetId()), err,
&errdetails.RequestInfo{
RequestId: uid.GetId(),
ServingData: errdetails.Serialize(uid),
},
&errdetails.ResourceInfo{
ResourceType: ngtResourceType + "/ngt.Exists",
ResourceName: fmt.Sprintf("%s: %s(%s)", apiName, s.name, s.ip),
},
uid.GetId())
err = status.New(codes.NotFound, errors.ErrObjectIDNotFound(uid.GetId()).Error()).Err()
if span != nil {
span.RecordError(err)
span.SetAttributes(trace.StatusCodeNotFound(err.Error())...)
Expand Down Expand Up @@ -125,16 +114,7 @@ func (s *server) GetObject(ctx context.Context, id *payload.Object_VectorRequest
}
vec, ts, err := s.ngt.GetObject(uuid)
if err != nil || vec == nil {
err = errors.ErrObjectNotFound(err, uuid)
err = status.WrapWithNotFound("GetObject API failed to remove request", err,
&errdetails.RequestInfo{
RequestId: uuid,
ServingData: errdetails.Serialize(id),
},
&errdetails.ResourceInfo{
ResourceType: ngtResourceType + "/ngt.GetObject",
ResourceName: fmt.Sprintf("%s: %s(%s)", apiName, s.name, s.ip),
}, info.Get())
err = status.New(codes.NotFound, errors.ErrObjectNotFound(err, uuid).Error()).Err()
if span != nil {
span.RecordError(err)
span.SetAttributes(trace.StatusCodeNotFound(err.Error())...)
Expand Down