From 49f08d15189c630b6339a95f4fd9ed2cf8e11381 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Wed, 26 Feb 2020 19:13:58 -0500 Subject: [PATCH] review Signed-off-by: Yuri Shkuro --- plugin/storage/cassandra/spanstore/writer.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugin/storage/cassandra/spanstore/writer.go b/plugin/storage/cassandra/spanstore/writer.go index 6c3e0f973feb..2ffc278c6f57 100644 --- a/plugin/storage/cassandra/spanstore/writer.go +++ b/plugin/storage/cassandra/spanstore/writer.go @@ -142,14 +142,9 @@ func (s *SpanWriter) WriteSpan(span *model.Span) error { } } if s.storageMode&indexFlag == indexFlag { - if err := s.writeServiceOperationIndex(span, ds); err != nil { + if err := s.writeIndexes(span, ds); err != nil { return err } - if !span.Flags.IsFirehoseEnabled() { - if err := s.writeOtherIndexes(span, ds); err != nil { - return err - } - } } return nil } @@ -176,7 +171,7 @@ func (s *SpanWriter) writeSpan(span *model.Span, ds *dbmodel.Span) error { return nil } -func (s *SpanWriter) writeServiceOperationIndex(span *model.Span, ds *dbmodel.Span) error { +func (s *SpanWriter) writeIndexes(span *model.Span, ds *dbmodel.Span) error { spanKind, _ := span.GetSpanKind() if err := s.saveServiceNameAndOperationName(dbmodel.Operation{ ServiceName: ds.ServiceName, @@ -186,10 +181,11 @@ func (s *SpanWriter) writeServiceOperationIndex(span *model.Span, ds *dbmodel.Sp // should this be a soft failure? return s.logError(ds, err, "Failed to insert service name and operation name", s.logger) } - return nil -} -func (s *SpanWriter) writeOtherIndexes(span *model.Span, ds *dbmodel.Span) error { + if span.Flags.IsFirehoseEnabled() { + return nil // skipping expensive indexing + } + if err := s.indexByTags(span, ds); err != nil { return s.logError(ds, err, "Failed to index tags", s.logger) }