Skip to content

Commit

Permalink
Log cql query on error (#1250)
Browse files Browse the repository at this point in the history
Signed-off-by: Prithvi Raj <p.r@uber.com>
  • Loading branch information
vprithvi authored and yurishkuro committed Jan 1, 2019
1 parent eed786f commit fe7352d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugin/storage/cassandra/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions plugin/storage/cassandra/spanstore/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit fe7352d

Please sign in to comment.