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
hubble/recorder: Extend the API to allow stopping a recording automatically #16473
hubble/recorder: Extend the API to allow stopping a recording automatically #16473
Conversation
This comment has been minimized.
This comment has been minimized.
1ec77a5
to
426d55c
Compare
test-me-please |
api/v1/recorder/recorder.proto
Outdated
// bytes_captured stops the recording after at least this many bytes have | ||
// been captured. Note: The resulting file might be slightly larger due | ||
// to added pcap headers. | ||
uint64 bytes_captured = 1; | ||
// bytes_captured stops the recording after at least this many packets have | ||
// been captured. | ||
uint64 packets_captured = 2; |
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.
nit: I think that bytes_captured_count
and packets_captured_count
would be better names because the current ones sound a bit like they'd be boolean values.
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.
also num_bytes
and num_captured
could work or even bytes/packets
one word
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.
Sure, will change!
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.
Going with packets/bytes_captured_count
. The reason I prefer to actually include captured
is to make clear that it refers to these values here:
cilium/api/v1/recorder/recorder.proto
Lines 110 to 121 in 6f9b875
message RecordingStatistics { | |
// bytes_captured is the total amount of bytes captured in the recording | |
uint64 bytes_captured = 1; | |
// packets_captured is the total amount of packets captured the recording | |
uint64 packets_captured = 2; | |
// packets_lost is the total amount of packets matching the filter during | |
// the recording, but never written to the sink because it was overloaded. | |
uint64 packets_lost = 3; | |
// bytes_lost is the total amount of bytes matching the filter during | |
// the recording, but never written to the sink because it was overloaded. | |
uint64 bytes_lost = 4; | |
} |
We might want to add other filters in the futures, e.g. bytes_lost_count
or maybe even bytes_written_count
(for the actual bytes written to disk, which includes things like pcap headers)
api/v1/recorder/recorder.proto
Outdated
// bytes_captured stops the recording after at least this many bytes have | ||
// been captured. Note: The resulting file might be slightly larger due | ||
// to added pcap headers. | ||
uint64 bytes_captured = 1; | ||
// bytes_captured stops the recording after at least this many packets have | ||
// been captured. | ||
uint64 packets_captured = 2; |
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.
also num_bytes
and num_captured
could work or even bytes/packets
one word
test-1.19-5.4 hit #16479 - which is about to be fixed, so I will restart the tests after I addressed the above feedback. |
/mlh new-flake Cilium-PR-K8s-1.19-kernel-5.4 👍 created #17010 |
This defines an additional set of conditions which can be submitted when a recording is started to automatically stop it after any of the conditions have been hit. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This implements a feature to stop a recording as soon as one of the three stop conditions are hit. We push the conditions into the sink, to ensure they are hit as early as possible, e.g. to avoid writing more bytes or packets than necessary. While this can also be implemented client-side by observing the statistics of the running recording and issuing an explicit stop request, it can be useful to implement some basic stop conditions server-side as a fail-safe in case the client becomes unresponsive but is still connected. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This ensures the stop timer is not started before it can receive any data. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
426d55c
to
427caea
Compare
test-me-please |
This pulls in the Hubble API definitions from cilium/cilium#16473 Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This pulls in the Hubble API definitions from cilium/cilium#16473 Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This pulls in the Hubble API definitions from cilium/cilium#16473 Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This implements a feature to stop a recording as soon as one of
three optional stop conditions are hit. If a stop condition is hit, the
RecordingStoppedResponse
is sent to the client the same wayit would if the client requested an explicit stop request.
The
StartRecording
API message is extended with a new (optional)StopCondition
field:We ensure that the stop conditions are hit as early as possible,
to avoid writing more bytes or packets than necessary.
While this can also be implemented client-side by observing the
statistics of the running recording and issuing an explicit stop
request, it can be useful to implement some basic stop conditions
server-side as a fail-safe in case the client becomes unresponsive but
is still connected.