Skip to content

Commit

Permalink
Wait for storage backend to update documents
Browse files Browse the repository at this point in the history
Signed-off-by: Emmanuel Emonueje Ebenezer <eebenezer949@gmail.com>
  • Loading branch information
ekefan committed Jan 29, 2025
1 parent a94253a commit f9bd987
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugin/storage/es/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func getLoggingTimeRangeIndexFn(logger *zap.Logger, fn timeRangeIndexFn) timeRan
}
return func(indexName string, indexDateLayout string, startTime time.Time, endTime time.Time, reduceDuration time.Duration) []string {
indices := fn(indexName, indexDateLayout, startTime, endTime, reduceDuration)
// logger.Debug("Reading from ES indices", zap.Strings("index", indices))
logger.Debug("Reading from ES indices", zap.Strings("index", indices))
return indices
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/es/spanstore/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (s *SpanWriter) WriteSpan(_ context.Context, span *model.Span) error {
s.writeService(serviceIndexName, jsonSpan)
}
s.writeSpan(spanIndexName, jsonSpan)
// s.logger.Debug("Wrote span to ES index", zap.String("index", spanIndexName))
s.logger.Debug("Wrote span to ES index", zap.String("index", spanIndexName))
return nil
}

Expand Down
10 changes: 6 additions & 4 deletions plugin/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ func (s *StorageIntegration) testGetLargeSpan(t *testing.T) {
found := s.waitForCondition(t, func(_ *testing.T) bool {
iterTraces := s.TraceReader.GetTraces(context.Background(), tracestore.GetTraceParams{TraceID: expectedTraceID})
traces, err := v1adapter.V1TracesFromSeq2(iterTraces)
if len(traces) > 0 {
actual = traces[0]
if len(traces) == 0 {
return false
}
actual = traces[0]
return err == nil && len(actual.Spans) >= len(expected.Spans)
})

Expand Down Expand Up @@ -269,9 +270,10 @@ func (s *StorageIntegration) testGetTrace(t *testing.T) {
t.Log(err)
return false
}
if len(traces) > 0 {
actual = traces[0]
if len(traces) == 0 {
return false
}
actual = traces[0]
return len(actual.Spans) == len(expected.Spans)
})
if !assert.True(t, found) {
Expand Down

0 comments on commit f9bd987

Please sign in to comment.