From d3336548a9abc82cb7799804cfd55eb4211c5903 Mon Sep 17 00:00:00 2001 From: adityamaru Date: Thu, 6 Jul 2023 11:10:48 -0300 Subject: [PATCH] server: don't print trace if empty 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 --- pkg/server/node.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/server/node.go b/pkg/server/node.go index 59a8ebe8b51b..5024948bba38 100644 --- a/pkg/server/node.go +++ b/pkg/server/node.go @@ -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.String()) + } } }