-
Notifications
You must be signed in to change notification settings - Fork 452
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
Fix serde #1856
Fix serde #1856
Conversation
Sorry I saw you comment on my previous PR but didn't get a chance to dig deep and reply 😞 Will take another look today |
@hwrdtm - These proto-generated rust files shouldn't be directly modified. The files are generated using grpc_build.rs, and most probably you need to modify this build script to get the required changes in the proto files. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1856 +/- ##
=====================================
Coverage 74.5% 74.5%
=====================================
Files 122 122
Lines 19809 19809
=====================================
Hits 14760 14760
Misses 5049 5049 ☔ View full report in Codecov by Sentry. |
@lalitb done, and CI passing now. |
@lalitb not sure how the deserialization is working as in this test, but the serialization path is definitely not producing the same result - I implemented a serde test in another PR to demonstrate, check it out for more details. Also my comment here has an example for what the issue is. Basically, we are currently getting this during serialization:
when we want
|
Not sure if
is the expected result as pointed out in #1753, int64, fixed64, uint64 should be serialized as string in json. I think we should fix the I think we want
|
@TommyCpp From the proto docs
So I think either works. Actually I verified this locally and my OTEL Collector parsed the Also this example trace in the open-telemetry/opentelemetry-collector uses a mixture of strings for the Also quick repo search in each of the However, if you feel strongly towards making consistent use of numbers, happy to do that too. |
Yes, either will work. However, JSON parsers may not support the full range of 64-bit integers, so serializing as strings ensures compatibility. Although, during deserialization, we should be able to handle both string and int. |
@hwrdtm - I validated your test in PR #1860 with fix in The change ensures that we serialize i64 as "value": {
"intValue": "100"
} and not "value": {
"intValue": 100
} or "value": "100" So the custom serializer is used here to encode i64 as a string. I didn't test it fully, but if the changes look fine, and you can update this PR accordingly? |
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.
as discussed above - #1856 (comment)
@lalitb last time I tried looking down the path of changing the logic in the serializers I was having some trouble. I don't think I'll have time to get back to this PR until mid next week - feel free to help get it over the finish line. |
fix incorporated in #1882. |
hey @lalitb , thanks for merging in #1882 . I don't think the other fixes in this PR as referred to here got incorporated though? I am referring to the fixes for these fields:
|
@hwrdtm I haven't tested, but do we need them? I believe all these fields use "common::v1::KeyValue" internally, and we already have custom serialization for it. If you foresee any issue, feel free to raise an PR, else I can validate it out later next week. |
Make compatible with Collector serde shape
Changes
This PR:
data
andvalue
fields in order to be consistent with the JSON schema implemented on the OTEL Collectorcommon::v1::KeyValue::value
field serde into anOption<AnyValue>
rather than the direct serialized value in order to be consistent with the JSON schema implemented on the OTEL CollectorMerge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes