Skip to content

Commit

Permalink
Merge #106280
Browse files Browse the repository at this point in the history
106280: server: don't print trace if empty r=knz a=adityamaru

This change adds a conditional to only print the
trace of context cancelled request if the trace is not empty. This avoids log spam noticed in #105378.

Fixes: #105378
Release note: None

Co-authored-by: adityamaru <[email protected]>
  • Loading branch information
craig[bot] and adityamaru committed Jul 7, 2023
2 parents 5d453ee + c829b15 commit 21904db
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/server/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,11 @@ func (n *Node) batchInternal(
// the request was doing at the time it noticed the cancellation.
if pErr != nil && ctx.Err() != nil {
if sp := tracing.SpanFromContext(ctx); sp != nil && !sp.IsNoop() {
log.Infof(ctx, "batch request %s failed with error: %s\ntrace:\n%s", args.String(),
pErr.GoError().Error(), sp.GetConfiguredRecording().String())
recording := sp.GetConfiguredRecording()
if recording.Len() != 0 {
log.Infof(ctx, "batch request %s failed with error: %v\ntrace:\n%s", args.String(),
pErr.GoError(), recording)
}
}
}

Expand Down

0 comments on commit 21904db

Please sign in to comment.