From cba3c9ce8d0d21d93319ed4c3f52ff5843d648be Mon Sep 17 00:00:00 2001 From: Prithvi Raj Date: Thu, 13 Dec 2018 14:01:49 -0500 Subject: [PATCH] Add query to read error log Signed-off-by: Prithvi Raj --- plugin/storage/cassandra/spanstore/reader.go | 3 ++- plugin/storage/cassandra/spanstore/reader_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/storage/cassandra/spanstore/reader.go b/plugin/storage/cassandra/spanstore/reader.go index 6a6ad7ede72..f232edb7e1b 100644 --- a/plugin/storage/cassandra/spanstore/reader.go +++ b/plugin/storage/cassandra/spanstore/reader.go @@ -410,7 +410,8 @@ func (s *SpanReader) executeQuery(span opentracing.Span, query cassandra.Query, tableMetrics.Emit(err, time.Since(start)) if err != nil { logErrorToSpan(span, err) - s.logger.Error("Failed to exec query", zap.Error(err)) + span.LogFields(otlog.String("query", query.String())) + s.logger.Error("Failed to exec query", zap.Error(err), zap.String("query", query.String())) return nil, err } return retMe, nil diff --git a/plugin/storage/cassandra/spanstore/reader_test.go b/plugin/storage/cassandra/spanstore/reader_test.go index 8499aa6800a..b59ad520b85 100644 --- a/plugin/storage/cassandra/spanstore/reader_test.go +++ b/plugin/storage/cassandra/spanstore/reader_test.go @@ -305,6 +305,7 @@ func TestSpanReaderFindTraces(t *testing.T) { query.On("Consistency", cassandra.One).Return(query) query.On("PageSize", 0).Return(query) query.On("Iter").Return(iter) + query.On("String").Return("queryString") return query }