enhance: Optimize ConsistencyLevel and GuaranteeTimestamp log (#34738)

/kind improvement

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
yihao.dai 2024-07-18 15:17:41 +08:00 committed by GitHub
parent f1b2f7b640
commit c8bf6c8a46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2959,9 +2959,7 @@ func (node *Proxy) search(ctx context.Context, request *milvuspb.SearchRequest)
mustUsePartitionKey: Params.ProxyCfg.MustUsePartitionKey.GetAsBool(),
}
guaranteeTs := request.GuaranteeTimestamp
log := log.Ctx(ctx).With(
log := log.Ctx(ctx).With( // TODO: it might cause some cpu consumption
zap.String("role", typeutil.ProxyRole),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
@ -2970,14 +2968,15 @@ func (node *Proxy) search(ctx context.Context, request *milvuspb.SearchRequest)
zap.Any("len(PlaceholderGroup)", len(request.PlaceholderGroup)),
zap.Any("OutputFields", request.OutputFields),
zap.Any("search_params", request.SearchParams),
zap.Uint64("guarantee_timestamp", guaranteeTs),
zap.String("ConsistencyLevel", request.GetConsistencyLevel().String()),
zap.Bool("useDefaultConsistency", request.GetUseDefaultConsistency()),
)
defer func() {
span := tr.ElapseSpan()
if span >= paramtable.Get().ProxyCfg.SlowQuerySpanInSeconds.GetAsDuration(time.Second) {
log.Info(rpcSlow(method), zap.Int64("nq", qt.SearchRequest.GetNq()), zap.Duration("duration", span))
log.Info(rpcSlow(method), zap.Uint64("guarantee_timestamp", qt.GetGuaranteeTimestamp()),
zap.Int64("nq", qt.SearchRequest.GetNq()), zap.Duration("duration", span))
metrics.ProxySlowQueryCount.WithLabelValues(
strconv.FormatInt(paramtable.GetNodeID(), 10),
metrics.SearchLabel,
@ -3162,22 +3161,20 @@ func (node *Proxy) hybridSearch(ctx context.Context, request *milvuspb.HybridSea
mustUsePartitionKey: Params.ProxyCfg.MustUsePartitionKey.GetAsBool(),
}
guaranteeTs := request.GuaranteeTimestamp
log := log.Ctx(ctx).With(
zap.String("role", typeutil.ProxyRole),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.Any("partitions", request.PartitionNames),
zap.Any("OutputFields", request.OutputFields),
zap.Uint64("guarantee_timestamp", guaranteeTs),
zap.String("ConsistencyLevel", request.GetConsistencyLevel().String()),
zap.Bool("useDefaultConsistency", request.GetUseDefaultConsistency()),
)
defer func() {
span := tr.ElapseSpan()
if span >= paramtable.Get().ProxyCfg.SlowQuerySpanInSeconds.GetAsDuration(time.Second) {
log.Info(rpcSlow(method), zap.Duration("duration", span))
log.Info(rpcSlow(method), zap.Uint64("guarantee_timestamp", qt.GetGuaranteeTimestamp()), zap.Duration("duration", span))
metrics.ProxySlowQueryCount.WithLabelValues(
strconv.FormatInt(paramtable.GetNodeID(), 10),
metrics.HybridSearchLabel,
@ -3433,6 +3430,7 @@ func (node *Proxy) query(ctx context.Context, qt *queryTask) (*milvuspb.QueryRes
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.Strings("partitions", request.PartitionNames),
zap.String("ConsistencyLevel", request.GetConsistencyLevel().String()),
zap.Bool("useDefaultConsistency", request.GetUseDefaultConsistency()),
)
@ -3441,7 +3439,6 @@ func (node *Proxy) query(ctx context.Context, qt *queryTask) (*milvuspb.QueryRes
zap.String("expr", request.Expr),
zap.Strings("OutputFields", request.OutputFields),
zap.Uint64("travel_timestamp", request.TravelTimestamp),
zap.Uint64("guarantee_timestamp", request.GuaranteeTimestamp),
)
tr := timerecord.NewTimeRecorder(method)
@ -3454,7 +3451,7 @@ func (node *Proxy) query(ctx context.Context, qt *queryTask) (*milvuspb.QueryRes
zap.String("expr", request.Expr),
zap.Strings("OutputFields", request.OutputFields),
zap.Uint64("travel_timestamp", request.TravelTimestamp),
zap.Uint64("guarantee_timestamp", request.GuaranteeTimestamp),
zap.Uint64("guarantee_timestamp", qt.GetGuaranteeTimestamp()),
zap.Duration("duration", span))
metrics.ProxySlowQueryCount.WithLabelValues(
strconv.FormatInt(paramtable.GetNodeID(), 10),