-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add support to trace defer function calls under trace follow option #3978
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
base: master
Are you sure you want to change the base?
Conversation
4d7a687
to
5dc7e54
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.
I don't really get what this PR is trying to achieve. Right now the trace with depth thing is determining statically from the call graph which functions to trace. This PR seems to change that so that deferred functions are added, at runtime, to the traced functions. Why are we doing this and why only deferred functions and not any other kind of dynamic dispatch?
2fa0860
to
ba6f2b3
Compare
Hi @aarzilli Thank you for reviewing the patch in detail and also suggesting improvements to optimize the code |
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.
All new code should be gofmt'd.
Defers are an explicit feature of Go just like function variables and interfaces, I'm not even sure that they really are the most common type of dynamic dispatch compared to the others (or by how much if they are), but even if they were I'm not sure it's enough to single them out. Or even how you would explain that to users, i.e. this changes the behavior of |
…return first level only
more defer cases
ba6f2b3
to
84335b4
Compare
Thank you for the detailed comment @aarzilli, it appears that with minimal modifications the code can trace functions that are dynamically passed as procedure parameters or returned from functions. Made changes to documentation and added couple of test cases for the same, kindly let us know your thoughts on this, Thanks again for your time on this! |
Is an extension of the basic support added to mention depth upto which functions and their descendants need to be traced #3594
The same option can now trace defer functions and their descendants
Fixes #3743