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
Add allow_partial_usdt_init param so partial init of USDT vector is possible #2476
Add allow_partial_usdt_init param so partial init of USDT vector is possible #2476
Conversation
[buildbot, test this please] |
[buildbot, ok to test] |
Would it be better to have BPF::init and BPF::init_usdt (called for each USDT separately) better and more flexible solution? That way application can decide for itself which USDTs are critical and which can be ignored, etc. |
@anakryiko This sounds better to me, I was optimizing for "least change to API surface". Some clarification questions:
I'm going to take a stab at the approach proposed in "Alternatively," unless you're opposed. |
@davemarchevsky, yeah, I was thinking about second approach, no need to break existing behavior. Thanks! |
The only reason we do the I'm OK with Andrii's idea. We can also add a |
New commit implements @anakryiko's suggestion.
TODO:
|
I looked at the code. Looks good to me. Function name init_fail_reset() is okay to me. We do need some doc about what is the typical way to use the new API and a test case to actually show how the new API is used. |
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 I like this, there is just this convoluted piece I commented separately on.
45e8c99
to
4b1bd63
Compare
6e487a4
to
9691700
Compare
Addressed comments. Added a test and some docs. Re-validated against my usecase successfully. @yonghong-song ready for final pass. Will squash+rebase after you give it the go-ahead. |
LGTM. Only one minor typo. |
… partial init failure of list of USDTs. modify BPF::init so that failure doesn't leave the BPF object in a broken state such that subsequent inits will also fail
9691700
to
fc3328d
Compare
@yonghong-song fixed typo, squashed, added descriptive commit msg. Ready for merge IMO |
LGTM. Thanks! |
Looking for early feedback here before I write tests / flesh this out more.
Consider this scenario: I'm hoping to attach USDTs to many short-lived processes, let's say 30. I want to gather data from USDT handlers on these processes for 5 seconds. It's guaranteed that at least one of the processes that was alive when I constructed the vector of USDTs to pass into
BPF::init
will not be alive by the time the 5 seconds are up. I'm OK with this and would still like to gather as much data as possible.If the process dies after
USDT::init()
is successful but beforeattach_usdt
is called, we're already OK because we can handle eachStatusTuple
independently outside ofbcc
. Similarly, if process dies betweenattach_usdt
anddetach_usdt
calls, we're fine for same reason.But if it dies between construction of
USDT
object andUSDT::init()
being called byBPF::init()
, we currently consider failure to init anyUSDT
critical enough to stop the wholeBPF::init()
.This PR adds a
allow_partial_usdt_init
param toBPF::init
to let users ofbcc
signal that they're OK withUSDT::init()
failures.USDT::initialized()
getter is added sobcc
user can check whichUSDT
s succeeded / failed.One downside of this initial pass is that the info in
StatusTuple
s forUSDT::init
is lost. So if we have someUSDT::init
failures whenallow_partial_usdt_init
istrue
it'll be hard to get visibility into them./cc @yonghong-song