Skip to content

Commit

Permalink
server: don't print trace if empty
Browse files Browse the repository at this point in the history
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
  • Loading branch information
adityamaru committed Jul 6, 2023
1 parent e38486c commit 76414de
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: %s\ntrace:\n%s", args.String(),
pErr.GoError().Error(), recording.String())
}
}
}

Expand Down

0 comments on commit 76414de

Please sign in to comment.