Add opentrace log for index component (#7946)

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
pull/8033/head
cai.zhang 2021-09-16 10:07:48 +08:00 committed by GitHub
parent b465e8f9a4
commit 4814f9cb1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View File

@ -69,7 +69,7 @@ func (s *Server) init() error {
indexcoord.Params.Address = Params.ServiceAddress
indexcoord.Params.Port = Params.ServicePort
closer := trace.InitTracing("index_coord")
closer := trace.InitTracing("IndexCoord")
s.closer = closer
if err := s.indexcoord.Register(); err != nil {

View File

@ -104,7 +104,7 @@ func (s *Server) init() error {
indexnode.Params.IP = Params.IP
indexnode.Params.Address = Params.Address
closer := trace.InitTracing(fmt.Sprintf("index_node ip: %s, port: %d", Params.IP, Params.Port))
closer := trace.InitTracing(fmt.Sprintf("IndexNode-%d", indexnode.Params.NodeID))
s.closer = closer
Params.Address = Params.IP + ":" + strconv.FormatInt(int64(Params.Port), 10)

View File

@ -342,14 +342,13 @@ func (i *IndexCoord) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequ
return i.sched.IndexAddQueue.Enqueue(t)
}
}
err := fn()
if err != nil {
ret.Status.ErrorCode = commonpb.ErrorCode_UnexpectedError
ret.Status.Reason = err.Error()
return ret, nil
}
log.Debug("IndexCoord BuildIndex Enqueue successfully", zap.Any("IndexBuildID", indexBuildID))
log.Debug("IndexCoord BuildIndex Enqueue successfully", zap.Any("IndexBuildID", t.indexBuildID))
err = t.WaitToFinish()
if err != nil {
@ -357,6 +356,7 @@ func (i *IndexCoord) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequ
ret.Status.Reason = err.Error()
return ret, nil
}
sp.SetTag("IndexCoord-IndexBuildID", strconv.FormatInt(t.indexBuildID, 10))
ret.Status.ErrorCode = commonpb.ErrorCode_Success
ret.IndexBuildID = t.indexBuildID
return ret, nil

View File

@ -175,8 +175,9 @@ func (i *IndexNode) CreateIndex(ctx context.Context, request *indexpb.CreateInde
zap.Any("TypeParams", request.TypeParams),
zap.Any("IndexParams", request.IndexParams))
sp, ctx := trace.StartSpanFromContextWithOperationName(ctx, "CreateIndex")
sp, ctx := trace.StartSpanFromContextWithOperationName(ctx, "IndexNode-CreateIndex")
defer sp.Finish()
sp.SetTag("IndexBuildID", strconv.FormatInt(request.IndexBuildID, 10))
t := &IndexBuildTask{
BaseTask: BaseTask{