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
core: add msgpack encoder #1491
Merged
Merged
Conversation
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
brettlangdon
reviewed
Jun 8, 2020
Kyle-Verhoog
force-pushed
the
kylev/custom-msgpack
branch
from
June 8, 2020 18:55
59f9ff9
to
d02932b
Compare
brettlangdon
reviewed
Jun 8, 2020
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.
👍 on most of your responses, good to keep things 100% compatible now, then we can make riskier optimizations later
Kyle-Verhoog
force-pushed
the
kylev/custom-msgpack
branch
from
June 8, 2020 20:02
d02932b
to
f91972c
Compare
Kyle-Verhoog
force-pushed
the
kylev/custom-msgpack
branch
from
June 8, 2020 20:43
f91972c
to
43c5875
Compare
Kyle-Verhoog
force-pushed
the
kylev/custom-msgpack
branch
from
June 9, 2020 04:17
5e58b1d
to
147bf90
Compare
Kyle-Verhoog
force-pushed
the
kylev/custom-msgpack
branch
from
June 9, 2020 04:51
5e58444
to
c5c4658
Compare
Kyle-Verhoog
force-pushed
the
kylev/custom-msgpack
branch
from
July 24, 2020 23:55
f5c7c31
to
d8f2068
Compare
- remove float implementation
Was able to run the tests under Windows: @brettlangdon I think we're good for a final review 😄 |
jd
reviewed
Jul 28, 2020
brettlangdon
approved these changes
Jul 28, 2020
5 tasks
4 tasks
mergify bot
pushed a commit
that referenced
this pull request
Nov 24, 2021
It's handy to have a general msgpack encoder that can be used for encoding arbitrary payloads of primitive Python types (see #2915). The encoder added here is based off the one added in #1491. It might be useful to use as a fallback for encoding traces as well if an issue with the custom msgpack encoder is suspected. The relevant tests from the msgpack-python implementation are included as well to ensure that the implementation is correct.
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.
What?
This patch introduces the following:
Packer
A Cython msgpack encoder mostly derived from the official msgpack library's 0.6.2 implementation. The changes made were:
service
,name
,resource
), etcTraceMsgPackEncoder
A trace encoder using the above
Packer
to encode traces.Why?
We support Python 2 but the msgpack package has dropped support for the C-extension in Python 2. Instead a pure-python fallback is used which is over an order of magnitude slower. This results in an unacceptable performance overhead to Python 2 projects using the tracer.
This also opens the door to further optimizations we can make to encoding.
Benchmarks
Python 2
We see a 23x improvement (244.49ms -> 10.35ms).
Note here that
custom
is the implementation added,fallback
is the default that a user would have if they installed the tracer today without specifying their own version of msgpack.Python 3
We get about a 1.4-2.0x improvement with the optimizations introduced.
Further optimizations
Outside the scope of this PR
join_encoded
is actually pretty slow and can be quite easily done manuallyTODO