-
Notifications
You must be signed in to change notification settings - Fork 51
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
libflux: make flux_msg_fprint() output clearer #3742
libflux: make flux_msg_fprint() output clearer #3742
Conversation
Oh thanks for giving something concrete to look at. That makes it much easier to improve. Here's a few suggestions:
On the payload, maybe use a heuristic so we get something human readable that doesn't exceed some max line width (with Edit: swapping payload and proto order might be useful, so that payload max line width can exceed 80 cols and not break up the flow too much. I don't thnk the frame ordering on the wire necessarily needs to be represented here. |
7ae5a60
to
532bc5f
Compare
Re-pushed with changes per suggestions per @garlick comments above. So here's some example outputs from some extra coverage tests I added. Perhaps its just me, but I like the "header" to be at the top of the debugging, so moved the "proto frame" stuff to the top and payload is at the bottom since it will most often be the longest.
|
Looking better! I think we could probably drop the payload size. Also, if the payload is JSON, any chance of seeing it as JSON text? |
oh good idea! |
532bc5f
to
82e6ce6
Compare
Oh actually, this was already taken care of. The problem was
|
82e6ce6
to
c8e87be
Compare
re-pushed, added some tests, removed the Aslo added a dumb commit to allow a "verbose" option to |
ccccd23
to
6215b6a
Compare
4434f47
to
16b1166
Compare
Quite an improvement:
Would it make it slightly more clear if the topic string were the first thing printed, without the
Also, if there are no routes should just omit the line with the |
ahh, yeah, I think that makes more sense. I was thinking more "header goes first", but people tend to identify based on the topic.
Oh yeah, that makes sense. |
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.
I'm fine with this with or without the changes I proposed, so marking approved.
Feel free to set MWP when you're done.
16b1166
to
d2e77e8
Compare
re-pushed per comments above. Re-ordered the output and simply changed a
|
Problem: It can be difficult to test/debug flux_msg_fprint tests becauses tests default to routing all output to /dev/null. Solution: Support a simple verbose option in test/message.c to have fprintf output go to stderr.
Problem: With zmsg_t being removed from the internals of the flux_msg_t data structure (commit cd0cbfb), flux_msg_fprint() is no longer beholden to the output format from zframe_fprint(). A more clear format for debugging can be output. Solution: Update flux_msg_fprint() to output all fields in a more clear format, with many fields output with key=value output and output string representations of integer values when valuable. In addition, output portion of the payload up to a line limit. Add additional unit tests for coverage.
d2e77e8
to
a0d3dbb
Compare
Codecov Report
@@ Coverage Diff @@
## master #3742 +/- ##
==========================================
+ Coverage 83.25% 83.27% +0.01%
==========================================
Files 334 334
Lines 50909 50967 +58
==========================================
+ Hits 42385 42443 +58
Misses 8524 8524
|
Per discussion in #3701. With the removal of
zmsg
internally within theflux_msg_t
data structure, we are no longer beholden to follow the output format defined byzframe_fprint()
. The hex output can be somewhat confusing and not the most helpful for debugging at times. Also, we can get rid of a call tomsg_proto_setup()
, which we really don't need influx_msg_copy()
anymore.I had no strong feelings on what to update the output to, so I just picked this:
We could remove the
prefix
notation (i.e.>
vs<
for request/reply), but I like it and left it in there. I don't know if using the brackets around the "section" would be confusing b/c that's what previously held frame length in thezframe
format.I could add some extra "if userid == UNKNOWN output "unknown"" kind of logic as well, but left that out as I felt it was unnecessary.
This is built on top of #3701. Mostly just posting so we can debate output format.