-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: pprof grouping for samples with span_id (#3450)
The following code: ```go pprof.Do(context.Background(), pprof.Labels("function", "slow", "qwe", "asd", "asdasd", "zxczxc"), func(c context.Context) { work(40000) pprof.Do(c, pprof.Labels("span_id", "239"), func(c context.Context) { work(40000) }) }) ``` may produce sampels with the folowing labels ``` (1,2) (3,4) (5,6) (1,2) (3,4) (5,6) (7, 8) ``` After applying `LabelsWithout` they will look like: ``` (5,6) (3,4) (1,2) (1,2) (5,6) (3,4) | (7, 8) // | denotes slice length and to the right is the filtered label ``` Next `CompareSampleLabels` will fail to recognize that these two label sets are equals because 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.
- Loading branch information
1 parent
02f2ded
commit 96cad4a
Showing
4 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Binary file not shown.
This file contains 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