-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[feat][storage] Add SpanKind support for badger #6376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I have changed the structure of cache which is leading to these concerns:
Once the correct approach is discussed I will handle some more edge cases and make the e2e tests pass (making |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6376 +/- ##
==========================================
- Coverage 96.03% 96.02% -0.01%
==========================================
Files 364 365 +1
Lines 20690 20823 +133
==========================================
+ Hits 19870 19996 +126
- Misses 626 631 +5
- Partials 194 196 +2
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:
|
@yurishkuro Please review the approach and problems! |
@yurishkuro I have added more changes which reduces the iterations in prefill to 1 but it limits the |
I have an idea for old data without using the migration script! We can store the old data in two other data structures in cache (without kind). But then the only question which rises then: What to return when no span kind is given by user? Operations of new data of all kind or operations of old data (kind marked as unspecified) or an addition of both? |
then we should return all operations regardless of the span kind |
That means including all spans of old data also (Whose kind is not there in cache)? |
My current approach is leading to errors in unit test of
This is probably because
The only problem is that, during prefilling 6*NumberOfOperations Get Queries will be called. Please review this approach @yurishkuro and I think we need to discuss about autoCreation of new index or should we skip the creation of any new index and use the function given above? |
@yurishkuro I finally got rid of migration and now I think its ready for review! Please ignore my previous comments. The current commit has no linkage them! |
|
@yurishkuro A humble reminder to review this PR! |
Signed-off-by: Manik2708 <[email protected]>
} | ||
|
||
// This method is to test backward compatibility for old index key | ||
func (w *SpanWriter) writeSpan(span *model.Span, writeOldIndex bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this approach. But my aim was to lower the diff!
// The uint64 value is the expiry time of operation | ||
operations map[string]map[model.SpanKind]map[string]uint64 | ||
|
||
store *badger.DB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't find any use of store in Cache when the responsibility to fill cache is given to reader
"jaeger.badger.dualLookUp", | ||
featuregate.StageBeta, // enabed by default | ||
featuregate.WithRegisterFromVersion("v2.2.0"), | ||
featuregate.WithRegisterToVersion("v2.5.0"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused about the two options:
- Versions used
- Whether it should be the issue which should be linked or pull request, as issue is not talking about this change directly!
Signed-off-by: Manik Mehta <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
@yurishkuro Sorry for disturbance, but can you please review this PR and resolve the doubts? |
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request introduces SpanKind support for Badger, which is a valuable enhancement. The changes seem well-structured and include a backward compatibility test. However, there are a few areas that could benefit from further review and refinement.
Summary of Findings
Merge Readiness
The pull request appears to be in good shape overall, but I recommend addressing the comments provided below before merging. I am unable to directly approve this pull request, so please ensure that other reviewers also examine the changes and provide their approval before proceeding with the merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR adds support for SpanKind in Badger storage by updating index keys, reader/writer logic, the cache structure, and integration tests.
- Introduces new type mappings and conversion functions for SpanKind.
- Updates factory, reader, writer, and cache layers to create and query indexes that incorporate span kind.
- Adds and adjusts unit and integration tests to verify backward compatibility and new functionality.
Reviewed Changes
File | Description |
---|---|
internal/storage/v1/badger/spanstore/backward_compatibility_test.go | Adds tests to ensure backward compatibility after the index changes. |
internal/storage/v1/badger/spanstore/kind.go | Introduces new type and mapping functions for span kind conversion. |
internal/storage/v1/badger/factory.go | Registers a new feature gate and updates cache initialization and reader construction. |
internal/storage/v1/badger/spanstore/reader.go | Updates TraceReader to accept a dual lookup flag and prefill operations by span kind. |
internal/storage/v1/badger/spanstore/rw_internal_test.go | Adjusts tests to use the new TraceReader and CacheStore signatures. |
internal/storage/v1/badger/spanstore/writer.go | Modifies index key creation to incorporate SpanKind for operations. |
internal/storage/v1/badger/spanstore/cache.go | Updates cache structure for operations to be keyed by span kind. |
internal/storage/integration/badgerstore_test.go, cmd/jaeger/internal/integration/badger_test.go | Remove legacy flags and update integration tests to reflect SpanKind support. |
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
internal/storage/v1/badger/spanstore/reader.go:60
- [nitpick] Consider renaming 'dualLookUp' to 'dualLookup' to follow common naming conventions.
dualLookUp bool
Co-authored-by: Copilot <[email protected]> Signed-off-by: Manik Mehta <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time. |
_ storage.SamplingStoreFactory = (*Factory)(nil) | ||
includeDualLookUp = featuregate.GlobalRegistry().MustRegister( | ||
"jaeger.badger.dualLookUp", | ||
featuregate.StageBeta, // enabed by default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the feature gate stage description: enabed
should be enabled
.
featuregate.StageBeta, // enabed by default | |
featuregate.StageBeta, // enabled by default |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time. |
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test