-
Notifications
You must be signed in to change notification settings - Fork 437
refactor(profiling): type pprof exporter and fix type comparison #2987
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
Merged
Conversation
This file contains hidden or 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
93eb939
to
21af6bf
Compare
28c6d3e
to
abcbf70
Compare
brettlangdon
previously approved these changes
Nov 5, 2021
@jd this pull request is now in conflict 😩 |
abcbf70
to
3ab82cb
Compare
@jd this pull request is now in conflict 😩 |
P403n1x87
previously approved these changes
Nov 8, 2021
brettlangdon
previously approved these changes
Nov 8, 2021
3ab82cb
to
18c8c56
Compare
It looks like it's a real failure, I'll take a look. |
There was an ongoing issue wih the pprof encode mixing type between strings, ints and None when dealing with labels. This has been fixed in multiple places and in multiple occasion, but there were still holes. When encoding Events to pprof, they are grouped by event fields. Those fields might be str, int or something else. In order to group those events, all the fields used for grouping must be: 1. hashable (because we index in a dict) 2. sortable (because we sort event to have reproducible) 3. string (because we store those as labels in pprof) The problem is that most value type used in events are hashable (None, int or str) but sortability often fails when one of the field is None: you can't compare `int` with `None`, making sorted() call fails like in DataDog#2962. As we need string in the end, the fix is to convert everything to strings as soon as possible when grouping events: that makes sure conditions 1, 2 and 3 are validated ASAP and everything works. To do this, the code has been updated and typed to catch any future error. Fixes DataDog#2962
5988a19
to
2c5555a
Compare
brettlangdon
approved these changes
Nov 11, 2021
P403n1x87
approved these changes
Nov 15, 2021
@Mergifyio backport 0.56 |
mergify bot
added a commit
that referenced
this pull request
Dec 10, 2021
There was an ongoing issue wih the pprof encode mixing type between strings, ints and None when dealing with labels. This has been fixed in multiple places and in multiple occasion, but there were still holes. When encoding Events to pprof, they are grouped by event fields. Those fields might be str, int or something else. In order to group those events, all the fields used for grouping must be: 1. hashable (because we index in a dict) 2. sortable (because we sort event to have reproducible) 3. string (because we store those as labels in pprof) The problem is that most value type used in events are hashable (None, int or str) but sortability often fails when one of the field is None: you can't compare `int` with `None`, making sorted() call fails like in #2962. As we need string in the end, the fix is to convert everything to strings as soon as possible when grouping events: that makes sure conditions 1, 2 and 3 are validated ASAP and everything works. To do this, the code has been updated and typed to catch any future error. Fixes #2962 Co-authored-by: Brett Langdon <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 6520212)
✅ Backports have been created
|
mergify bot
added a commit
that referenced
this pull request
Dec 10, 2021
…) (#3062) There was an ongoing issue wih the pprof encode mixing type between strings, ints and None when dealing with labels. This has been fixed in multiple places and in multiple occasion, but there were still holes. When encoding Events to pprof, they are grouped by event fields. Those fields might be str, int or something else. In order to group those events, all the fields used for grouping must be: 1. hashable (because we index in a dict) 2. sortable (because we sort event to have reproducible) 3. string (because we store those as labels in pprof) The problem is that most value type used in events are hashable (None, int or str) but sortability often fails when one of the field is None: you can't compare `int` with `None`, making sorted() call fails like in #2962. As we need string in the end, the fix is to convert everything to strings as soon as possible when grouping events: that makes sure conditions 1, 2 and 3 are validated ASAP and everything works. To do this, the code has been updated and typed to catch any future error. Fixes #2962 Co-authored-by: Brett Langdon <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 6520212) Co-authored-by: Julien Danjou <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There was an ongoing issue wih the pprof encode mixing type between strings,
ints and None when dealing with labels. This has been fixed in multiple places
and in multiple occasion, but there were still holes.
When encoding Events to pprof, they are grouped by event fields. Those fields
might be str, int or something else. In order to group those events, all the
fields used for grouping must be:
The problem is that most value type used in events are hashable (None, int or
str) but sortability often fails when one of the field is None: you can't
compare
int
withNone
, making sorted() call fails like in #2962.As we need string in the end, the fix is to convert everything to strings as
soon as possible when grouping events: that makes sure conditions 1, 2 and 3
are validated ASAP and everything works.
To do this, the code has been updated and typed to catch any future error.
Fixes #2962