-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
parser_json: fix wrong LoadError warning #4522
parser_json: fix wrong LoadError warning #4522
Conversation
b25e989
to
151e631
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.
It seems that this rescue
no longer needed.
It would be better to do retry
at when :oj
instead of rescue
block.
d515b3a
to
29ff381
Compare
Thanks for your review! |
If Oj is not installed, LoadError with the empty message is raised. So, the current condition `/\boj\z/.match?(ex.message)` does not work and the following meaningless warning is displayed. {datetime} [warn]: #x {id} LoadError After this fix, the log message will be: {datetime} [info]: #x {id} Oj is not installed, and failing back to Yajl for json parser Refactor "rescue" logic because this falling back feature is currently only for "oj" (LoadError can not occur for "json" and "yajl"). Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com> Co-authored-by: Takuro Ashie <ashie@clear-code.com>
29ff381
to
891ce71
Compare
It looks like |
Thanks! |
Thanks for your review! |
Which issue(s) this PR fixes:
None
What this PR does / why we need it:
If Oj is not installed, LoadError with the empty message is raised.
fluentd/lib/fluent/plugin/parser_json.rb
Line 53 in b25e989
So, the current condition
/\boj\z/.match?(ex.message)
does not work and the following meaningless warning is displayed.After this fix, the log message will be:
Docs Changes:
Not needed.
Release Note:
Same as the title.