-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: introduce code for JSON encoding protobuf types #42
Conversation
0aa44f3
to
691ae24
Compare
8206529
to
bcefefd
Compare
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.
Looks good! I think the CompressionStrategy conversion is wrong, so that's a blocker, but the other things I mentioned are debatable.
While you're here, would you mind changing the port
fields in protobuf from uint32 to uint16?
Could you clarify this ? Protobuf doesn't have a uint16 AFAIK |
Ah right, I had forgotten this. They will be varints, and the number of bytes will depend on the value. Nothing to do here then. |
I've updated the code, here's the benchmarks: Classic model (model -> modeljson):
Protobuf (modelpb -> modeljson):
Notes:
|
b12e536
to
f4abe77
Compare
Pushed a few more fixes I found while integrating this with APM Server (no PR yet). This should be ready for review again. |
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.
Thank you!
delete(in, k) | ||
in[sanitizeLabelKey(k)] = v |
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.
delete(in, k) | |
in[sanitizeLabelKey(k)] = v | |
if k2 := sanitizeLabelKey(k); k2 != k { | |
delete(in, k) | |
in[k2] = v | |
} |
We should expect most keys to not require sanitisation, and optimise for that.
Introduce code for JSON encoding protobuf types
I tried to keep them close to the original apmevent
toModelJSON
but it should be fairly containedRelated to #36
Blocked by #41