-
Notifications
You must be signed in to change notification settings - Fork 254
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
Support reading flows from stdin #524
Conversation
c3de54b
to
3716cc2
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.
This is pretty neat, I like it! 🚀 Please, see some suggestions for improvements below.
Have you considered reading from a (several) file(s) as well? Maybe via optional positional arguments to the observe
command.
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.
Nice work! 🚀 Just one question in addition to what Robin already pointed out.
reading from multiple files are already supported in a way. you can do:
you can also pre-process files before sending to
we could add positional arguments, but i thought it might get a bit more confusing to users. right now the separation is pretty clear i think: if stdin is a pipe, read flows from there. else connect to hubble server. |
b24842e
to
28754b2
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.
Lgtm besides a missing error check.
Implement an ObserverClient that reads jsonpb flows from an io.Reader instead of connecting to Hubble, and modify `hubble observe` command to use it when stdin is a pipe. For example, hubble observe -o jsonpb --last 1000 > flows.log cat flows.log | hubble observe -n kube-system A few things to note for observing flows from stdin: - --follow, --last, and server flags are ignored. - Flows are processed in the order they are read from stdin without sorting them by timestamp. Fixes #523 Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
28754b2
to
d03660c
Compare
hubble observe now supports [1] reading flows from stdin if they are in jsonpb format. We should therefore emit jsonpb artifact files for tests, to be able to feed those files back into hubble observe. That will allow us to use hubble observe's filters and different output format. 1 - cilium/hubble#524 Signed-off-by: Paul Chaignon <paul@cilium.io>
hubble observe now supports [1] reading flows from stdin if they are in jsonpb format. We should therefore emit jsonpb artifact files for tests, to be able to feed those files back into hubble observe. That will allow us to use hubble observe's filters and different output format. 1 - cilium/hubble#524 Signed-off-by: Paul Chaignon <paul@cilium.io>
Implement an ObserverClient that reads jsonpb flows from an io.Reader
instead of connecting to Hubble, and modify
hubble observe
commandto use it when stdin is a pipe. For example,
A few things to note for observing flows from stdin:
sorting them by timestamp.
Fixes #523
Signed-off-by: Michi Mutsuzaki michi@isovalent.com