Skip to content

Commit fe7352d

Browse files
vprithviyurishkuro
authored andcommitted
Log cql query on error (#1250)
Signed-off-by: Prithvi Raj <p.r@uber.com>
1 parent eed786f commit fe7352d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

plugin/storage/cassandra/spanstore/reader.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ func (s *SpanReader) executeQuery(span opentracing.Span, query cassandra.Query,
410410
tableMetrics.Emit(err, time.Since(start))
411411
if err != nil {
412412
logErrorToSpan(span, err)
413-
s.logger.Error("Failed to exec query", zap.Error(err))
413+
span.LogFields(otlog.String("query", query.String()))
414+
s.logger.Error("Failed to exec query", zap.Error(err), zap.String("query", query.String()))
414415
return nil, err
415416
}
416417
return retMe, nil

plugin/storage/cassandra/spanstore/reader_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ func TestSpanReaderFindTraces(t *testing.T) {
305305
query.On("Consistency", cassandra.One).Return(query)
306306
query.On("PageSize", 0).Return(query)
307307
query.On("Iter").Return(iter)
308+
query.On("String").Return("queryString")
308309

309310
return query
310311
}

0 commit comments

Comments
 (0)