Do not drop legacy profile alloc metrics when they are equal to in-use ones
Fixes #432.
In #432 the user has a number of collected heap profiles in the legacy format that they ask pprof to merge and open and the merge fails.
The reason for the error is that one of the profiles has the alloc metric values equal to the in-use ones in the header line. Since pprof legacy profile parser drops the alloc metrics in this case, the profiles can't be merged since the merge requires that the sample types are the same between merged profiles.
This PR makes the parser stop dropping the alloc metrics in this case. This behavior seems more correct anyway as there doesn't seem to be a strong reason for such implicit behavior and in case of parsing profile.proto profiles there isn't such implicit behavior either. But may be I am missing some history here, so please review.
Codecov Report
Merging #433 into master will increase coverage by
0.05%. The diff coverage is100%.
@@ Coverage Diff @@
## master #433 +/- ##
==========================================
+ Coverage 67.09% 67.14% +0.05%
==========================================
Files 37 37
Lines 7594 7594
==========================================
+ Hits 5095 5099 +4
+ Misses 2096 2093 -3
+ Partials 403 402 -1
| Impacted Files | Coverage Δ | |
|---|---|---|
| profile/legacy_profile.go | 77.31% <100%> (+0.67%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 2ef8d84...169f465. Read the comment docs.