Refine log level (#20896) (#20902)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/20950/head
Jiquan Long 2022-12-02 10:11:16 +08:00 committed by GitHub
parent 11e37c176e
commit 5bf76a8fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 31 deletions

View File

@ -814,7 +814,7 @@ func (kc *Catalog) AlterGrant(ctx context.Context, tenant string, entity *milvus
v, err = kc.Txn.Load(k)
if err != nil {
log.Error("fail to load grant privilege entity", zap.String("key", k), zap.Any("type", operateType), zap.Error(err))
log.Warn("fail to load grant privilege entity", zap.String("key", k), zap.Any("type", operateType), zap.Error(err))
if funcutil.IsRevoke(operateType) {
if common.IsKeyNotExistError(err) {
return common.NewIgnorableError(fmt.Errorf("the grant[%s] isn't existed", k))
@ -837,7 +837,7 @@ func (kc *Catalog) AlterGrant(ctx context.Context, tenant string, entity *milvus
k = funcutil.HandleTenantForEtcdKey(GranteeIDPrefix, tenant, fmt.Sprintf("%s/%s", idStr, privilegeName))
_, err = kc.Txn.Load(k)
if err != nil {
log.Error("fail to load the grantee id", zap.String("key", k), zap.Error(err))
log.Warn("fail to load the grantee id", zap.String("key", k), zap.Error(err))
if !common.IsKeyNotExistError(err) {
return err
}

View File

@ -1856,8 +1856,10 @@ func (node *Proxy) GetLoadingProgress(ctx context.Context, request *milvuspb.Get
zap.Any("request", request))
getErrResponse := func(err error) *milvuspb.GetLoadingProgressResponse {
logger.Error("fail to get loading progress", zap.String("collection_name", request.CollectionName),
zap.Strings("partition_name", request.PartitionNames), zap.Error(err))
log.Warn("fail to get loading progress",
zap.Error(err),
zap.String("collection_name", request.CollectionName),
zap.Strings("partition_name", request.PartitionNames))
metrics.ProxyFunctionCall.WithLabelValues(strconv.FormatInt(Params.ProxyCfg.GetNodeID(), 10), method, metrics.FailLabel).Inc()
return &milvuspb.GetLoadingProgressResponse{
Status: &commonpb.Status{
@ -3828,7 +3830,9 @@ func (node *Proxy) LoadBalance(ctx context.Context, req *milvuspb.LoadBalanceReq
collectionID, err := globalMetaCache.GetCollectionID(ctx, req.GetCollectionName())
if err != nil {
log.Error("failed to get collection id", zap.String("collection name", req.GetCollectionName()), zap.Error(err))
log.Warn("failed to get collection id",
zap.String("collection name", req.GetCollectionName()),
zap.Error(err))
status.Reason = err.Error()
return status, nil
}
@ -3846,13 +3850,15 @@ func (node *Proxy) LoadBalance(ctx context.Context, req *milvuspb.LoadBalanceReq
CollectionID: collectionID,
})
if err != nil {
log.Error("Failed to LoadBalance from Query Coordinator",
zap.Any("req", req), zap.Error(err))
log.Warn("Failed to LoadBalance from Query Coordinator",
zap.Any("req", req),
zap.Error(err))
status.Reason = err.Error()
return status, nil
}
if infoResp.ErrorCode != commonpb.ErrorCode_Success {
log.Error("Failed to LoadBalance from Query Coordinator", zap.String("errMsg", infoResp.Reason))
log.Warn("Failed to LoadBalance from Query Coordinator",
zap.String("errMsg", infoResp.Reason))
status.Reason = infoResp.Reason
return status, nil
}

View File

@ -450,7 +450,7 @@ func (sched *taskScheduler) processTask(t task, q taskQueue) {
}()
if err != nil {
trace.LogError(span, err)
log.Error("Failed to pre-execute task: "+err.Error(),
log.Warn("Failed to pre-execute task: "+err.Error(),
zap.String("traceID", traceID))
return
}
@ -459,7 +459,7 @@ func (sched *taskScheduler) processTask(t task, q taskQueue) {
err = t.Execute(ctx)
if err != nil {
trace.LogError(span, err)
log.Error("Failed to execute task: ", zap.Error(err),
log.Warn("Failed to execute task: ", zap.Error(err),
zap.String("traceID", traceID))
return
}
@ -469,7 +469,7 @@ func (sched *taskScheduler) processTask(t task, q taskQueue) {
if err != nil {
trace.LogError(span, err)
log.Error("Failed to post-execute task: ", zap.Error(err),
log.Warn("Failed to post-execute task: ", zap.Error(err),
zap.String("traceID", traceID))
return
}

View File

@ -99,13 +99,13 @@ func (broker *CoordinatorBroker) GetPartitions(ctx context.Context, collectionID
}
resp, err := broker.rootCoord.ShowPartitions(ctx, req)
if err != nil {
log.Error("showPartition failed", zap.Int64("collectionID", collectionID), zap.Error(err))
log.Warn("showPartition failed", zap.Int64("collectionID", collectionID), zap.Error(err))
return nil, err
}
if resp.Status.ErrorCode != commonpb.ErrorCode_Success {
err = errors.New(resp.Status.Reason)
log.Error("showPartition failed", zap.Int64("collectionID", collectionID), zap.Error(err))
log.Warn("showPartition failed", zap.Int64("collectionID", collectionID), zap.Error(err))
return nil, err
}

View File

@ -876,7 +876,7 @@ func (c *Core) HasCollection(ctx context.Context, in *milvuspb.HasCollectionRequ
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to has collection", zap.Error(err))
log.Warn("failed to enqueue request to has collection", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("HasCollection", metrics.FailLabel).Inc()
return &milvuspb.BoolResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "HasCollection failed: "+err.Error()),
@ -885,7 +885,7 @@ func (c *Core) HasCollection(ctx context.Context, in *milvuspb.HasCollectionRequ
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to has collection", zap.Error(err))
log.Warn("failed to has collection", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("HasCollection", metrics.FailLabel).Inc()
return &milvuspb.BoolResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "HasCollection failed: "+err.Error()),
@ -962,7 +962,7 @@ func (c *Core) DescribeCollection(ctx context.Context, in *milvuspb.DescribeColl
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to describe collection", zap.Error(err))
log.Warn("failed to enqueue request to describe collection", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("DescribeCollection", metrics.FailLabel).Inc()
return &milvuspb.DescribeCollectionResponse{
// TODO: use commonpb.ErrorCode_CollectionNotExists. SDK use commonpb.ErrorCode_UnexpectedError now.
@ -971,7 +971,7 @@ func (c *Core) DescribeCollection(ctx context.Context, in *milvuspb.DescribeColl
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to describe collection", zap.Error(err))
log.Warn("failed to describe collection", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("DescribeCollection", metrics.FailLabel).Inc()
return &milvuspb.DescribeCollectionResponse{
// TODO: use commonpb.ErrorCode_CollectionNotExists. SDK use commonpb.ErrorCode_UnexpectedError now.
@ -1010,7 +1010,7 @@ func (c *Core) ShowCollections(ctx context.Context, in *milvuspb.ShowCollections
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to show collections", zap.Error(err))
log.Warn("failed to enqueue request to show collections", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("ShowCollections", metrics.FailLabel).Inc()
return &milvuspb.ShowCollectionsResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "ShowCollections failed: "+err.Error()),
@ -1018,7 +1018,7 @@ func (c *Core) ShowCollections(ctx context.Context, in *milvuspb.ShowCollections
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to show collections", zap.Error(err))
log.Warn("failed to show collections", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("ShowCollections", metrics.FailLabel).Inc()
return &milvuspb.ShowCollectionsResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "ShowCollections failed: "+err.Error()),
@ -1054,7 +1054,8 @@ func (c *Core) AlterCollection(ctx context.Context, in *milvuspb.AlterCollection
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to alter collection", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to enqueue request to alter collection",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("name", in.GetCollectionName()), zap.Int64("msgID", in.GetBase().GetMsgID()))
@ -1063,7 +1064,8 @@ func (c *Core) AlterCollection(ctx context.Context, in *milvuspb.AlterCollection
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to alter collection", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to alter collection",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("name", in.GetCollectionName()),
zap.Int64("msgID", in.GetBase().GetMsgID()), zap.Uint64("ts", t.GetTs()))
@ -1208,7 +1210,7 @@ func (c *Core) HasPartition(ctx context.Context, in *milvuspb.HasPartitionReques
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to has partition", zap.Error(err))
log.Warn("failed to enqueue request to has partition", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("HasPartition", metrics.FailLabel).Inc()
return &milvuspb.BoolResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "HasPartition failed: "+err.Error()),
@ -1217,7 +1219,7 @@ func (c *Core) HasPartition(ctx context.Context, in *milvuspb.HasPartitionReques
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to has partition", zap.Error(err))
log.Warn("failed to has partition", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("HasPartition", metrics.FailLabel).Inc()
return &milvuspb.BoolResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "HasPartition failed: "+err.Error()),
@ -1255,7 +1257,7 @@ func (c *Core) ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionsRe
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to show partitions", zap.Error(err))
log.Warn("failed to enqueue request to show partitions", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("ShowPartitions", metrics.FailLabel).Inc()
return &milvuspb.ShowPartitionsResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "ShowPartitions failed: "+err.Error()),
@ -1263,7 +1265,7 @@ func (c *Core) ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionsRe
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to show partitions", zap.Error(err))
log.Warn("failed to show partitions", zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues("ShowPartitions", metrics.FailLabel).Inc()
return &milvuspb.ShowPartitionsResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "ShowPartitions failed: "+err.Error()),
@ -1462,7 +1464,8 @@ func (c *Core) CreateAlias(ctx context.Context, in *milvuspb.CreateAliasRequest)
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to create alias", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to enqueue request to create alias",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("alias", in.GetAlias()), zap.String("collection", in.GetCollectionName()),
zap.Int64("msgID", in.GetBase().GetMsgID()))
@ -1472,7 +1475,8 @@ func (c *Core) CreateAlias(ctx context.Context, in *milvuspb.CreateAliasRequest)
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to create alias", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to create alias",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("alias", in.GetAlias()), zap.String("collection", in.GetCollectionName()),
zap.Int64("msgID", in.GetBase().GetMsgID()), zap.Uint64("ts", t.GetTs()))
@ -1512,7 +1516,8 @@ func (c *Core) DropAlias(ctx context.Context, in *milvuspb.DropAliasRequest) (*c
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to drop alias", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to enqueue request to drop alias",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("alias", in.GetAlias()), zap.Int64("msgID", in.GetBase().GetMsgID()))
@ -1521,7 +1526,8 @@ func (c *Core) DropAlias(ctx context.Context, in *milvuspb.DropAliasRequest) (*c
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to drop alias", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to drop alias",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("alias", in.GetAlias()),
zap.Int64("msgID", in.GetBase().GetMsgID()), zap.Uint64("ts", t.GetTs()))
@ -1562,7 +1568,8 @@ func (c *Core) AlterAlias(ctx context.Context, in *milvuspb.AlterAliasRequest) (
}
if err := c.scheduler.AddTask(t); err != nil {
log.Error("failed to enqueue request to alter alias", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to enqueue request to alter alias",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("alias", in.GetAlias()), zap.String("collection", in.GetCollectionName()),
zap.Int64("msgID", in.GetBase().GetMsgID()))
@ -1572,7 +1579,8 @@ func (c *Core) AlterAlias(ctx context.Context, in *milvuspb.AlterAliasRequest) (
}
if err := t.WaitToFinish(); err != nil {
log.Error("failed to alter alias", zap.String("role", typeutil.RootCoordRole),
log.Warn("failed to alter alias",
zap.String("role", typeutil.RootCoordRole),
zap.Error(err),
zap.String("alias", in.GetAlias()), zap.String("collection", in.GetCollectionName()),
zap.Int64("msgID", in.GetBase().GetMsgID()), zap.Uint64("ts", t.GetTs()))