Skip to content
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

IgnoreMatch() Option #30

Closed
wants to merge 3 commits into from
Closed

IgnoreMatch() Option #30

wants to merge 3 commits into from

Conversation

ryanrhee
Copy link

@ryanrhee ryanrhee commented May 2, 2019

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.)

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.)
@CLAassistant
Copy link

CLAassistant commented May 2, 2019

CLA assistant check
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
Copy link

codecov bot commented May 2, 2019

Codecov Report

Merging #30 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            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%> (ø) ⬆️

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.

@prashantv
Copy link
Collaborator

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.

@ryanrhee
Copy link
Author

ryanrhee commented May 8, 2019

@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
Copy link
Collaborator

@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.

@ryanrhee
Copy link
Author

ryanrhee commented May 8, 2019 via email

@frioux
Copy link

frioux commented Feb 21, 2020

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)

@prashantv
Copy link
Collaborator

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!

@abhinav
Copy link
Collaborator

abhinav commented Oct 23, 2023

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.

@abhinav abhinav closed this Oct 23, 2023
@ryanrhee ryanrhee deleted the patch-1 branch November 27, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants