-
Notifications
You must be signed in to change notification settings - Fork 609
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: pprof grouping for samples with span_id #3450
Conversation
This reverts commit 15cc64a.
Hmm, something is flaky in our integration test
Not sure if It was like this before this PR. |
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
Thanks for fixing this!
Yeah, the flaky integration test is worth investigating. Did you test the fix with "real" data? Our Go simple example should produce the data we need
Update:
I'm wondering if you discovered this issue in the wild – just trying to understand if this affected anyone.
IIRC, the logic here was that a situation when we have series that would match after the removal of span_id
should not be possible:
(1,2) (3,4) (5,6)
(1,2) (3,4) (5,6) (7, 8)
When we set span_id
, we also set span_name
, which inevitably results in a unique combination of labels, but never exists alone.
Thus, we can have:
[ label set ] span_name span_id
Or:
[ label set ]
But never:
[ label set ] span_name
So, when we then remove span_id
, no collisions are expected. For grouping to work, the order of the labels should be deterministic, but not necessarily defined as descending or ascending.
Now I understand that it may break in the case when a trace has been sampled – I'm not super sure how that's handled in all the SDKs.
The described logic is tailored to our use case. I really like the way it is handled in the PR – we should definitely make use of it
I have not seen this in the wild, just found it while reading the code. |
The following code:
may produce sampels with the folowing labels
After applying
LabelsWithout
they will look like:Next
CompareSampleLabels
will fail to recognize that these two label sets are equalsbecause first one is in reverse sorted order and the other is not.
In this PR we change
FilterLabelsInPlace
function to maintain sorted order of non filtered labels,maintain reverse sorted order of filtered labels and put the filtered labels on the right side in place
so that
slices.Reverse
is not needed.