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 <[email protected]>
  • Loading branch information
ekefan committed Jan 28, 2025
1 parent 4d9bfa1 commit 4c6cff1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 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
16 changes: 9 additions & 7 deletions plugin/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ func (s *StorageIntegration) testArchiveTrace(t *testing.T) {

var actual *model.Trace
found := s.waitForCondition(t, func(_ *testing.T) bool {
var err error
iterTraces := s.ArchiveTraceReader.GetTraces(context.Background(), tracestore.GetTraceParams{TraceID: v1adapter.FromV1TraceID(tID)})
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)
})
require.True(t, found)
Expand All @@ -230,9 +230,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 @@ -310,9 +311,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 4c6cff1

Please sign in to comment.