goleak
goleak copied to clipboard
IgnoreMatch() Option
Option to ignore stack traces that have the full substring inside it. (Can't be done in user-space because the opts struct is private.)
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Codecov Report
Merging #30 into master will increase coverage by
0.13%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #30 +/- ##
==========================================
+ Coverage 95.03% 95.17% +0.13%
==========================================
Files 4 4
Lines 141 145 +4
==========================================
+ Hits 134 138 +4
Misses 4 4
Partials 3 3
Impacted Files | Coverage Δ | |
---|---|---|
options.go | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 71b3642...d19a1b8. Read the comment docs.
Thanks for the contribution @ryanrhee
Can you provide some additional context on what exactly you're trying to do? Ignore a substring match in the full stack is a pretty broad feature, typically exclusions are a little more fine-grained (based on the top function on the stack, or looking for a specific function).
This sub-string match will also match filenames, which can vary across environments, which could have unexpected results.
@prashantv ideally each stack frame would be parsed and i could match against it, but it seems such parsing isn't easily doable in the current codebase. Sub-string match will give us a reasonable way of continuing to run goleak without investing in a way to properly parse stack frames; the alternative for us would be to just stop using it, and we prefer not to do so.
@prashantv ideally each stack frame would be parsed and i could match against it, but it seems such parsing isn't easily doable in the current codebase. Sub-string match will give us a reasonable way of continuing to run goleak without investing in a way to properly parse stack frames; the alternative for us would be to just stop using it, and we prefer not to do so.
Are you trying to ignore a specific function in the call stack? Will it be the full function name, or is there a use-case for a sub-string? We can ignore the top function already, we could extend the parsing to ignore a function anywhere in the frame. It would be a little more work, but I'd prefer to make this library API safer for the long-term.
We are planning to cut a 1.0 soon, after which we'll maintain the API going forward, so I want to be careful about the APIs we are adding.
Full function name.
On Wed, May 8, 2019 at 2:04 PM Prashant Varanasi [email protected] wrote:
@prashantv https://github.com/prashantv ideally each stack frame would be parsed and i could match against it, but it seems such parsing isn't easily doable in the current codebase. Sub-string match will give us a reasonable way of continuing to run goleak without investing in a way to properly parse stack frames; the alternative for us would be to just stop using it, and we prefer not to do so.
Are you trying to ignore a specific function in the call stack? Will it be the full function name, or is there a use-case for a sub-string? We can ignore the top function already, we could extend the parsing to ignore a function anywhere in the frame. It would be a little more work, but I'd prefer to make this library API safer for the long-term.
We are planning to cut a 1.0 soon, after which we'll maintain the API going forward, so I want to be careful about the APIs we are adding.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/uber-go/goleak/pull/30#issuecomment-490589823, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB3G5CJGTCJAJQAY4MOOVTPUMIZ5ANCNFSM4HJ4DCKA .
I would like to be able to us this at least to ignore the eternal goroutine that glog starts up at init time. (search for init in https://github.com/golang/glog/blob/master/glog.go)
I think extending the stack parsing code to parse the function names, and then allowing an ignore if a function shows up anywhere in the stack trace is a better API to support, rather than allowing matching against the filename which is arbitrary.
I was hoping to spend some time improving the stack parsing functionality, but did not get around to it, but would appreciate any contributions on that front, thanks!
Update: There's stack trace parsing code now, and #113 added a new IgnoreAnyFunction option to ignore a function anywhere in the stack trace.
Closing this PR since ignoring a specific function was the goal here too. Thanks for opening the PR and the discussion, @ryanrhee, and thanks for suggestions on how to fix this @prashantv.