-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[bugfix] Deduplicate spans based upon their hashcode #6009
base: main
Are you sure you want to change the base?
Conversation
fd74590
to
888ca59
Compare
@yurishkuro as discussed! let me know if you want anything else changed |
fa8c498
to
8022f67
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6009 +/- ##
=======================================
Coverage 96.79% 96.80%
=======================================
Files 348 349 +1
Lines 16559 16571 +12
=======================================
+ Hits 16029 16041 +12
Misses 342 342
Partials 188 188
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
Signed-off-by: Chris Danis <[email protected]>
PTAL :D |
func (d *spanHashDeduper) groupSpansByHash() { | ||
spansByHash := make(map[uint64][]*model.Span) | ||
for _, span := range d.trace.Spans { | ||
hash, _ := model.HashCode(span) |
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 recall there was some issue in the past with hash function requiring proper ordering of tags or something.
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.
Yes, this is still the case:
func (s *Span) Hash(w io.Writer) (err error) {
// gob is not the most efficient way, but it ensures we don't miss any fields.
// See BenchmarkSpanHash in span_test.go
enc := gob.NewEncoder(w)
return enc.Encode(s)
}
You can only compare hashes if the tags are properly sorted. Surprisingly, we don't have an explicit adjuster for that, but some of that sorting happens in ip_tag.go and sort_log_fields.go adjusters. Perhaps it would make sense to pull the sorting explicitly into SortTagsAndLogs adjuster and makes sure it is called before DedupeBySpanHash
adjuster.
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test