Do not drop legacy profile alloc metrics when they are equal to in-use ones #433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.