-
Notifications
You must be signed in to change notification settings - Fork 222
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
fix: export of custom pprof labels #2667
Conversation
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.
This is going into a really awesome direction, thank you so much for taking a stab at this!!
pkg/parcacol/querier.go
Outdated
@@ -102,7 +107,8 @@ func (q *Querier) Labels( | |||
} | |||
|
|||
val := stringCol.Value(i) | |||
seen[strings.TrimPrefix(val, "labels.")] = struct{}{} | |||
l := strings.TrimPrefix(strings.TrimPrefix(val, ColumnLabelsPrefix), ColumnPprofLabelsPrefix) |
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.
based on the prefix we can tell what kind of profile it is and return that to the frontend, and only the frontend will unify it into a single list
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 don't quite understand 😄
I assumed that since we removed the prefix for labels.
we should do the same irrespective of where the prefix comes from.
Do you mean we should only trim the labels.
prefix and the frontend is going to take care of removing the pprof_labels.
prefix?
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 mean that the response should have one list that is pprof_labels, and one that is regular labels. That way the frontend will be able to tell whether a label is a profile label or a regular one, but to the user it will only show a single list.
The reason we need this knowledge in the frontend is to be able to tell the LabelValues
request, whether a label is a pprof label or a regular label.
pkg/parcacol/querier.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
return logicalplan.Or(labelExpr, pprofLabelExpr), nil |
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.
Like I said on Discord, I'm not sure this is quite correct, we actually need to say something like "label.a exists and is equal to "b" and pprof_labels.a does not exist OR pprof.labels_a exists and is equal to "b" and labels.a does not exist"
Unfortunately, frostdb doesn't support this yet.
I think we can leave this part for last though, we might have it implemented by the time we fix all the other things! :)
Created polarsignals/frostdb#394 and added it to the team's backlog so we'll hopefully have the last missing piece for this soon! Thanks for bearing with us! |
polarsignals/frostdb#394 is implemented so we can now build the queries we want to here! 🥳 |
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 personally think we can leave the LabelNames
and LabelValues
calls out for now and leave them with the current behavior, and handle that in a follow-up, this is difficult enough without those :D your choice though
pkg/parcacol/querier.go
Outdated
@@ -102,7 +107,8 @@ func (q *Querier) Labels( | |||
} | |||
|
|||
val := stringCol.Value(i) | |||
seen[strings.TrimPrefix(val, "labels.")] = struct{}{} | |||
l := strings.TrimPrefix(strings.TrimPrefix(val, ColumnLabelsPrefix), ColumnPprofLabelsPrefix) |
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 mean that the response should have one list that is pprof_labels, and one that is regular labels. That way the frontend will be able to tell whether a label is a profile label or a regular one, but to the user it will only show a single list.
The reason we need this knowledge in the frontend is to be able to tell the LabelValues
request, whether a label is a pprof label or a regular label.
Normalization of labels is done twice. Label normalization before ingest was adding the collision prefix 'exported_' even if no collision was present.
samples: []*pprofpb.Sample{ | ||
{ | ||
Label: []*pprofpb.Label{{ | ||
Key: 3, |
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.
@brancz I just want to make sure I get this right 😅 I added some missing tests based on the ones that were already here. The order
in colliding labels in descending order
refers to the order of the []*pprofpb.Label
right? So the label.Key
in descending order is method, instance
in this case and reversed in the ascending case.
Just rebased and tested this, and it works flawlessly. I'd be happy to merge this! |
work in progress to fix #2657
pkg/parcacol/normalizer_test.go
setup data as it did not seem to reflect reality. ThestringTable
does not contain the takenLabels key/values when running parca.stringTable
only contains strings from the profile. In case of a collision, the colliding key will be in thestringTable
due to it being in the profile. In such a case it is not prefixed withexported_
as this is done by parca.