-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
cilium/cmd: improve 'bpf metrics list' JSON output #13731
Conversation
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.
Overall, LGTM.
One thing I wonder is whether we are breaking any existing user scripts with this change.
Yup, there was some discussion for that on slack and the conclusion was that it was fine as:
|
test-me-please |
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 undoubtedly an improvement! The parsing is a little too fragile for my taste but there's unit test coverage and it seems to do the job.
However, the output differs from the suggested format in #13492. Would you mind explaining the rationale for choosing a map with the reason number as string for keys rather than a list of objects which include the reason as in #13492?
I agree with that, but making it more robust would require changing how the
No strong reason (and I'm happy to switch to a list of objects if you think that would be better 👍 ).
(or even more compact: vs
|
Disclaimer: I'm don't consume the output of
This sounds like a good reason. The main reason I prefer the version suggested by @qmonnet in #13492 is that it is more descriptive. When I look at it, |
I think that's also a good argument 👍
vs
So the map based approach would led to a more concise jq command. But beside that I don't feel strongly about any of the 2 options 🤔 |
I don't feel strongly about either approaches as well although the list version looks more like what I would expect. |
Let's go for the list approach then 👍 |
Switched to a list ✔️ |
test-me-please |
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.
Output looks good to me, I like the list. A few comments below.
Signed-off-by: Gilberto Bertin <gilberto@isovalent.com>
I should have addressed all comments 👍 |
test-me-please |
This commit changes the JSON output for the 'bpf metrics list' command from the current format: ```js { "reason:0 dir:1": [ "count:63752 bytes:20913476" ], "reason:0 dir:2": [ "count:29697 bytes:2489416" ], "reason:132 dir:2": [ "count:27 bytes:1930" ] } ``` which is hard to parse even with tools such as jq to a more structured format: ```js [ { "reason": 0, "description": "Success", "values": { "egress": { "packets": 29921, "bytes": 2508163 }, "ingress": { "packets": 64220, "bytes": 21064892 } } }, { "reason": 132, "description": "Invalid source ip", "values": { "egress": { "packets": 27, "bytes": 1930 } } } ] ``` Fixes: #13492 Signed-off-by: Gilberto Bertin <gilberto@isovalent.com>
test-me-please |
test-gke |
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.
Thanks a lot!
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 commit changes the JSON output for the 'bpf metrics list' command from the current format:
which is hard to parse even with tools such as jq to a more structured format: