-
Notifications
You must be signed in to change notification settings - Fork 211
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
pkg/parcacol: Group all profiles of a write request into one buffer #2202
Conversation
brancz
commented
Nov 30, 2022
•
edited
Loading
edited
func sortedKeys(m map[string]struct{}) []string { | ||
keys := make([]string, 0, len(m)) | ||
for k := range m { | ||
keys = append(keys, k) | ||
} | ||
sort.Strings(keys) | ||
return keys | ||
} |
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.
func sortedKeys(m map[string]struct{}) []string { | |
keys := make([]string, 0, len(m)) | |
for k := range m { | |
keys = append(keys, k) | |
} | |
sort.Strings(keys) | |
return keys | |
} | |
func sortedKeys(in map[string]struct{}) []string { | |
if len(in) == 0 { | |
return []string{} | |
} | |
out := maps.Keys(in) | |
sort.Strings(out) | |
return out | |
} |
Sadly the sort.Sort isn't generic yet, but when it's going to be, there will only be one of this ever.
YAY! 🎉 🚀 |
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.
LGTM
7d4b971
to
0026fa3
Compare
2d6958b
to
8f9d950
Compare
This benchmark was previously used to optimize label handling so it didn't need profiling data, but that's now changing.
de7df55
to
1165bc6
Compare
1165bc6
to
e09e165
Compare
for _, s := range series { | ||
for _, normalizedProfiles := range s.Samples { | ||
for _, p := range normalizedProfiles { |
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.
So this is the biggest change I would still propose to this.
Given that we built this nested series>profiles>samples
construct earlier on, but then use it here for just a bit of reusing labels, I'd propose to flatten this earlier already.
Basically, the Ingest
takes in []normalizedSamples
and we only have one loop to iterate over.