Rewrite traces using rebatching#4690
Merged
stoewer merged 15 commits intografana:mainfrom Feb 20, 2025
Merged
Conversation
8d0765b to
afd14bf
Compare
Signed-off-by: Joe Elliott <number101010@gmail.com>
Will be implemented in separate branch that will not be merged
The functions test.MakeBatch and test.MakeTrace* now create more unique ResourceSpans and ScopeSpans. This avoids unwanted rebatching in tests
Test data now has additional attributes on resource level that caused these tests to fail
afd14bf to
8ef32f6
Compare
1607e88 to
d50ab3c
Compare
joe-elliott
reviewed
Feb 19, 2025
Collaborator
joe-elliott
left a comment
There was a problem hiding this comment.
nice implementation. couple nits and only one "real" question.
thanks!
| } | ||
|
|
||
| // modify trace by rebatching spans and assigning nested set values | ||
| rebatchTrace(ot) |
Collaborator
There was a problem hiding this comment.
should we also call this after combining here-ish?
we seem to have three things we do every time we build a trace:
- rebatch
- nested set model
- service stats
should we create some holistic function like "finalizeTrace" that accomplishes this? that way if we add more of this kind of processing we will have an easy place to put it?
func finalizeTrace() {
rebatch()
assignNestedSetModel()
...
}
| } | ||
|
|
||
| // preallocate a map and a slice to collect the indices of unique ResourceSpans and ScopeSpans | ||
| uniqueIndexes := make([]int, 0, max(len(trace.ResourceSpans), len(trace.ResourceSpans[0].ScopeSpans))) |
Collaborator
There was a problem hiding this comment.
took me a bit to figure out what you were using this. appreciate the effort on the in place alg. clean and well implemented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
Rebatch traces in order to remove redundant
ResourceSpansandScopeSpansto reduces the number of rows on resource and scope level. This has shown to speed up queries with matching resource attributes and also reduces the overall file size.Which issue(s) this PR fixes:
Fixes grafana/tempo-squad#548
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]