-
Notifications
You must be signed in to change notification settings - Fork 253
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
Correctly handle --first/--last when reading flows from a stdin #958
Conversation
Closes #957 |
a08f910
to
708310b
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.
Thanks for the PR @chancez, couple of nitpicking comments but overall LGTM. Requesting changes because I would like to see tests covering the --first
and --last
case.
Also the patch introduce a lot of state tracking in ioReaderClient.Recv
in the --last
case (scanning, c.resps
is empty, popping up flows) in addition to handling non --last
cases. Have you considered splitting --first
, --last
, and "default" in their own helper func
?
708310b
to
a67172e
Compare
@kaworu PR updated based on review and tests added. Thanks! |
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 for the update and the tests @chancez! One last comment/question about checking --last n
bound.
1413762
to
600c069
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.
Thank you @chancez! Patch LGTM once CI is passing and commit history cleaned up.
cmd/observe/io_reader_observer.go
Outdated
// Used for --last | ||
buffer *container.RingBuffer | ||
resps []*observer.GetFlowsResponse | ||
// Used for --first/--last | ||
flowsReturned uint64 |
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.
👍
600c069
to
7718220
Compare
7718220
to
b2d5e3b
Compare
Signed-off-by: Chance Zibolski <[email protected]>
b2d5e3b
to
10feccf
Compare
As the title says, when reading flows from stdin, hubble CLI does not correctly handle --first/--last, but this fixes it.
here's a rough demonstration (pardon the jq, it's to condense the JSON output so it's a bit easier to see).