From 59c93eb351830397461c7f5c62ea98c67f8b475b Mon Sep 17 00:00:00 2001 From: dragondriver Date: Wed, 8 Dec 2021 23:05:07 +0800 Subject: [PATCH] Refine log of GetPartitionStatistics (#12940) Signed-off-by: dragondriver --- internal/proxy/impl.go | 81 +++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 24 deletions(-) diff --git a/internal/proxy/impl.go b/internal/proxy/impl.go index 82bb8c899e..8e721653ee 100644 --- a/internal/proxy/impl.go +++ b/internal/proxy/impl.go @@ -1235,6 +1235,11 @@ func (node *Proxy) GetPartitionStatistics(ctx context.Context, request *milvuspb Status: unhealthyStatus(), }, nil } + + sp, ctx := trace.StartSpanFromContextWithOperationName(ctx, "Proxy-GetPartitionStatistics") + defer sp.Finish() + traceID, _, _ := trace.InfoFromSpan(sp) + g := &getPartitionStatisticsTask{ ctx: ctx, Condition: NewTaskCondition(ctx), @@ -1242,41 +1247,26 @@ func (node *Proxy) GetPartitionStatistics(ctx context.Context, request *milvuspb dataCoord: node.dataCoord, } - log.Debug("GetPartitionStatistics enqueue", - zap.String("role", Params.RoleName), - zap.String("db", request.DbName), - zap.String("collection", request.CollectionName), - zap.String("partition", request.PartitionName)) - err := node.sched.ddQueue.Enqueue(g) - if err != nil { - return &milvuspb.GetPartitionStatisticsResponse{ - Status: &commonpb.Status{ - ErrorCode: commonpb.ErrorCode_UnexpectedError, - Reason: err.Error(), - }, - }, nil - } + method := "GetPartitionStatistics" - log.Debug("GetPartitionStatistics", + log.Debug( + rpcReceived(method), + zap.String("traceID", traceID), zap.String("role", Params.RoleName), - zap.Int64("msgID", request.Base.MsgID), - zap.Uint64("timestamp", request.Base.Timestamp), zap.String("db", request.DbName), zap.String("collection", request.CollectionName), zap.String("partition", request.PartitionName)) - defer func() { - log.Debug("GetPartitionStatistics Done", + + if err := node.sched.ddQueue.Enqueue(g); err != nil { + log.Warn( + rpcFailedToEnqueue(method), zap.Error(err), + zap.String("traceID", traceID), zap.String("role", Params.RoleName), - zap.Int64("msgID", request.Base.MsgID), - zap.Uint64("timestamp", request.Base.Timestamp), zap.String("db", request.DbName), zap.String("collection", request.CollectionName), zap.String("partition", request.PartitionName)) - }() - err = g.WaitToFinish() - if err != nil { return &milvuspb.GetPartitionStatisticsResponse{ Status: &commonpb.Status{ ErrorCode: commonpb.ErrorCode_UnexpectedError, @@ -1285,6 +1275,49 @@ func (node *Proxy) GetPartitionStatistics(ctx context.Context, request *milvuspb }, nil } + log.Debug( + rpcEnqueued(method), + zap.String("traceID", traceID), + zap.String("role", Params.RoleName), + zap.Int64("msgID", g.ID()), + zap.Uint64("BeginTS", g.BeginTs()), + zap.Uint64("EndTS", g.EndTs()), + zap.String("db", request.DbName), + zap.String("collection", request.CollectionName), + zap.String("partition", request.PartitionName)) + + if err := g.WaitToFinish(); err != nil { + log.Warn( + rpcFailedToWaitToFinish(method), + zap.Error(err), + zap.String("traceID", traceID), + zap.String("role", Params.RoleName), + zap.Int64("msgID", g.ID()), + zap.Uint64("BeginTS", g.BeginTs()), + zap.Uint64("EndTS", g.EndTs()), + zap.String("db", request.DbName), + zap.String("collection", request.CollectionName), + zap.String("partition", request.PartitionName)) + + return &milvuspb.GetPartitionStatisticsResponse{ + Status: &commonpb.Status{ + ErrorCode: commonpb.ErrorCode_UnexpectedError, + Reason: err.Error(), + }, + }, nil + } + + log.Debug( + rpcDone(method), + zap.String("traceID", traceID), + zap.String("role", Params.RoleName), + zap.Int64("msgID", g.ID()), + zap.Uint64("BeginTS", g.BeginTs()), + zap.Uint64("EndTS", g.EndTs()), + zap.String("db", request.DbName), + zap.String("collection", request.CollectionName), + zap.String("partition", request.PartitionName)) + return g.result, nil }