-
Notifications
You must be signed in to change notification settings - Fork 252
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
cmd/record: Add stop condition flags #607
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.
🚢
This pulls in the Hubble API definitions from cilium/cilium#16473 Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This adds three new flags to the `hubble record` subcommand: - `packet-limit`: Stops the recording after a specified number of packets have been recorded. - `bytes-limit`: Stops the recording after a specified number of bytes have been recorded. - `time-limit`: Stops the recording after a specified duration has elapsed. The first limit to hit will stop the recording. If none of the three flags are specified, then the recording needs to be stopped manually. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
e2245b3
to
6722b09
Compare
@@ -80,6 +86,10 @@ protocols are TCP, UDP and ANY.`, | |||
recorderFlags.StringVar(&fileSinkPrefix, "file-prefix", "hubble", "File prefix of the resulting pcap file") | |||
recorderFlags.Uint32Var(&maxCaptureLength, "max-capture-len", 0, "Sets the maximum capture length (zero for full capture)") | |||
|
|||
recorderFlags.Uint64Var(&packetLimit, "packet-limit", 0, "Sets a limit on how many packets to capture on each node") | |||
recorderFlags.Uint64Var(&bytesLimit, "bytes-limit", 0, "Sets a limit on how many bytes to capture on each node") | |||
recorderFlags.DurationVar(&timeLimit, "time-limit", 0, "Sets a limit on how long to capture on each node") |
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.
does this do the relative nifty things like 10s
, 5m
etc?
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.
Yes. This is using the same mechanism as --since
Duration flags accept any input valid for time.ParseDuration.
https://pkg.go.dev/flag
This adds three new flags to the
hubble record
subcommand:packet-limit
: Stops the recording after a specified number ofpackets have been recorded.
bytes-limit
: Stops the recording after a specified number ofbytes have been recorded.
time-limit
: Stops the recording after a specified durationhas elapsed.
The first limit to hit will stop the recording. If none of the three
flags are specified, then the recording needs to be stopped manually.
These flags are only supported by Cilium master at the moment, see
cilium/cilium#16473 for the API implementation.