Skip to content

Commit

Permalink
enhance: Use zap.Stringer for large log field (#29143)
Browse files Browse the repository at this point in the history
See also #29113
Using zap.Stringer log field will evaluate log field value only when log
level meets the configuration, which could save some CPU time in search
route

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Dec 12, 2023
1 parent 4651f89 commit cb75e73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (sa *segIDAssigner) syncSegments() (bool, error) {
strconv.FormatInt(paramtable.GetNodeID(), 10)).Observe(float64(len(sa.segReqs)))
sa.segReqs = nil

log.Debug("syncSegments call dataCoord.AssignSegmentID", zap.String("request", req.String()))
log.Debug("syncSegments call dataCoord.AssignSegmentID", zap.Stringer("request", req))

resp, err := sa.dataCoord.AssignSegmentID(context.Background(), req)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/task_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (t *searchTask) PreExecute(ctx context.Context) error {

log.Debug("Proxy::searchTask::PreExecute",
zap.Int64s("plan.OutputFieldIds", plan.GetOutputFieldIds()),
zap.String("plan", plan.String())) // may be very large if large term passed.
zap.Stringer("plan", plan)) // may be very large if large term passed.
}

// translate partition name to partition ids. Use regex-pattern to match partition name.
Expand Down

0 comments on commit cb75e73

Please sign in to comment.