diff --git a/plugin/storage/kafka/writer.go b/plugin/storage/kafka/writer.go index e82ecea735cf..2664beff90ba 100644 --- a/plugin/storage/kafka/writer.go +++ b/plugin/storage/kafka/writer.go @@ -57,8 +57,10 @@ func NewSpanWriter( }() go func() { for e := range producer.Errors() { - logger.Error(e.Err.Error()) - writeMetrics.SpansWrittenFailure.Inc(1) + if e != nil && e.Err != nil { + logger.Error(e.Err.Error()) + writeMetrics.SpansWrittenFailure.Inc(1) + } } }()