Refine log of ShowPartitions (#12941)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/12801/head^2
dragondriver 2021-12-08 14:57:48 +08:00 committed by GitHub
parent dcb6c3b2fe
commit 8eda489c5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 14 deletions

View File

@ -1295,6 +1295,11 @@ func (node *Proxy) ShowPartitions(ctx context.Context, request *milvuspb.ShowPar
Status: unhealthyStatus(),
}, nil
}
sp, ctx := trace.StartSpanFromContextWithOperationName(ctx, "Proxy-ShowPartitions")
defer sp.Finish()
traceID, _, _ := trace.InfoFromSpan(sp)
spt := &showPartitionsTask{
ctx: ctx,
Condition: NewTaskCondition(ctx),
@ -1304,11 +1309,22 @@ func (node *Proxy) ShowPartitions(ctx context.Context, request *milvuspb.ShowPar
result: nil,
}
log.Debug("ShowPartitions enqueue",
method := "ShowPartitions"
log.Debug(
rpcReceived(method),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Any("request", request))
err := node.sched.ddQueue.Enqueue(spt)
if err != nil {
if err := node.sched.ddQueue.Enqueue(spt); err != nil {
log.Warn(
rpcFailedToEnqueue(method),
zap.Error(err),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Any("request", request))
return &milvuspb.ShowPartitionsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
@ -1317,21 +1333,30 @@ func (node *Proxy) ShowPartitions(ctx context.Context, request *milvuspb.ShowPar
}, nil
}
log.Debug("ShowPartitions",
log.Debug(
rpcEnqueued(method),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("msgID", spt.ID()),
zap.Uint64("BeginTS", spt.BeginTs()),
zap.Uint64("EndTS", spt.EndTs()),
zap.String("db", spt.ShowPartitionsRequest.DbName),
zap.String("collection", spt.ShowPartitionsRequest.CollectionName),
zap.Any("partitions", spt.ShowPartitionsRequest.PartitionNames),
)
defer func() {
log.Debug("ShowPartitions Done",
zap.Error(err),
zap.String("role", Params.RoleName),
zap.Any("result", spt.result))
}()
zap.Any("partitions", spt.ShowPartitionsRequest.PartitionNames))
if err := spt.WaitToFinish(); err != nil {
log.Warn(
rpcFailedToWaitToFinish(method),
zap.Error(err),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("msgID", spt.ID()),
zap.Uint64("BeginTS", spt.BeginTs()),
zap.Uint64("EndTS", spt.EndTs()),
zap.String("db", spt.ShowPartitionsRequest.DbName),
zap.String("collection", spt.ShowPartitionsRequest.CollectionName),
zap.Any("partitions", spt.ShowPartitionsRequest.PartitionNames))
err = spt.WaitToFinish()
if err != nil {
return &milvuspb.ShowPartitionsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
@ -1339,6 +1364,18 @@ func (node *Proxy) ShowPartitions(ctx context.Context, request *milvuspb.ShowPar
},
}, nil
}
log.Debug(
rpcDone(method),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("msgID", spt.ID()),
zap.Uint64("BeginTS", spt.BeginTs()),
zap.Uint64("EndTS", spt.EndTs()),
zap.String("db", spt.ShowPartitionsRequest.DbName),
zap.String("collection", spt.ShowPartitionsRequest.CollectionName),
zap.Any("partitions", spt.ShowPartitionsRequest.PartitionNames))
return spt.result, nil
}