[cassandra] Change signatures of CoreSpanReader to return iterators#8296
[cassandra] Change signatures of CoreSpanReader to return iterators#8296Manik2708 wants to merge 4 commits intojaegertracing:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request modifies the CoreSpanReader interface to return iterators instead of slices, optimizing memory usage by avoiding the need to store traces before conversion. The changes affect the v1 and v2 storage layers, specifically the Cassandra implementation.
Changes:
- Changed
CoreSpanReader.FindTracesreturn type from([]*model.Trace, error)toiter.Seq2[*model.Trace, error]to return an iterator - Changed
CoreSpanReader.GetOperationssignature to usetracestore.OperationQueryParams(removed the oldGetOperationsV2method) - Updated
FindTraceIDsreturn type to usedbmodel.TraceIDinstead ofmodel.TraceID - Removed the
fallbackfield from the v2TraceReaderstruct and implemented direct iterator-based implementations forGetTraces,FindTraces, andFindTraceIDs - Updated all tests and test utilities to work with the new iterator-based interfaces
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/storage/v1/cassandra/spanstore/reader.go | Updated CoreSpanReader interface, implemented FindTraces to return iter.Seq2, changed FindTraceIDs return type to dbmodel.TraceID, consolidated GetOperations method |
| internal/storage/v2/cassandra/tracestore/reader.go | Removed fallback field, implemented iterator-based GetTraces, FindTraces, and FindTraceIDs methods directly instead of delegating to adapter |
| internal/storage/v1/cassandra/spanstore/reader_test.go | Updated FindTraces tests to consume the iterator pattern |
| internal/storage/v2/cassandra/tracestore/reader_test.go | Added comprehensive tests for new iterator-based methods |
| internal/storage/v1/cassandra/spanstore/mocks/mocks.go | Updated mock CoreSpanReader to reflect new interface signatures |
| internal/storage/v1/cassandra/savetracetest/main.go | Updated queryAndPrint function to consume FindTraces iterator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@yurishkuro I think workflows require approval from maintainers. Can you run the workflows? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8296 +/- ##
==========================================
- Coverage 95.63% 95.60% -0.03%
==========================================
Files 314 314
Lines 16505 16505
==========================================
- Hits 15784 15780 -4
- Misses 568 571 +3
- Partials 153 154 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@mahadzaryab1 i have trimmed the scope of this PR by changing just |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CI Summary ReportMetrics Comparison✅ No significant metric changes Code Coverage✅ Coverage 96.8% (baseline 96.8%) ➡️ View CI run | View publish logs |
|
@yurishkuro I have implemented the adapter as per my understanding if this looks fine i will start working on covering the edge cases for code coverage |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@yurishkuro adapter seemed a bridge to me just like v1 adapter so I transferred v2 functions to |
| for _, err := range r.reader.FindTraces(context.Background(), nil) { | ||
| require.Empty(t, r.traceBuffer.GetSpans(), "Spans Not recorded") | ||
| require.Error(t, err) | ||
| } |
There was a problem hiding this comment.
not equivalent, the loop may simply exit and you're not going to execute any require* steps.
| for _, err := range r.reader.FindTraces(context.Background(), nil) { | ||
| require.Error(t, err) | ||
| } | ||
| require.Empty(t, r.traceBuffer.GetSpans(), "Spans Not recorded") |
There was a problem hiding this comment.
i think now it will be fine
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
make lint testAI Usage in this PR (choose one)
See AI Usage Policy.