Skip to content
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

Implement unmarshal Logs with jsoniter #6021

Merged

Conversation

atingchen
Copy link
Contributor

@atingchen atingchen commented Sep 4, 2022

Description:
Now Traces And Metrics was converted to jsoniter, But Logs still uses jsonpb. Unmarshaler with jsoniter` will skip unknown fields instead of error

Link to tracking Issue: [https://github.com//pull/4986 ]
Testing:
unit test. construct a logs message, fill all the fields, use jsonpb marshal to json bytes, use jsoniter unmarshal to struct, test assert there are equal.

@atingchen atingchen requested a review from a team as a code owner September 4, 2022 10:02
@codecov
Copy link

codecov bot commented Sep 4, 2022

Codecov Report

Base: 92.01% // Head: 92.07% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (b6d9a8f) compared to base (c512073).
Patch coverage: 97.93% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6021      +/-   ##
==========================================
+ Coverage   92.01%   92.07%   +0.06%     
==========================================
  Files         213      213              
  Lines       13232    13322      +90     
==========================================
+ Hits        12175    12266      +91     
  Misses        838      838              
+ Partials      219      218       -1     
Impacted Files Coverage Δ
pdata/plog/json.go 98.18% <97.87%> (+13.18%) ⬆️
pdata/internal/json/attribute.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@atingchen atingchen changed the title Implement unmarshal json with jsoniter Implement unmarshal Logs with jsoniter Sep 4, 2022
pdata/plog/json.go Outdated Show resolved Hide resolved
return lr
}

func (d *jsonUnmarshaler) readSeverityNumber(iter *jsoniter.Iterator) otlplogs.SeverityNumber {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary func called once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants