-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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: trace formatter should not crash when given a non-binary payload #13140
fix: trace formatter should not crash when given a non-binary payload #13140
Conversation
42ec8ab
to
2eb5c24
Compare
emqx_packet:format(Packet, Encode) | ||
catch | ||
_:_ -> | ||
%% We don't want to crash if there is a field named packet with |
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.
could you provide an example here?
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.
There is a trace that includes the output of a rule. As the the rule can output almost any map it can contain a field named packet. Not 100% sure if the key can be an atom in that case. Perhaps the optimal solution is to not look for the packet field in all levels of the map as we may only want to format it when it is in the top level. What do you think? The payload field is perhaps different since the user can change how it is formatted and will perhaps expect it to be formatted this way wherever it may be.
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.
this is ok.
I missed that this is done recursively.
maybe good to explain as comment.
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.
✔️
Would it make sense to add a smoke test for this case?
It would not hurt. I added a task for this so I can pick it up later: https://emqx.atlassian.net/browse/EMQX-12483
Also does not hurt. Will try to add this at the same time as I do the task above. |
Fixes:
https://emqx.atlassian.net/browse/EMQX-12474
Release version: v/e5.?
Summary
PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md
files