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

Non-fatal errors (using Bugsnag.notify) are all grouped together if there's a helper function involved #207

Closed
edenman opened this issue Oct 31, 2017 · 3 comments

Comments

@edenman
Copy link
Contributor

edenman commented Oct 31, 2017

Expected behavior

Non-fatals with a different callsite (even if it's one or two levels up in the stacktrace) should be grouped by callsite.

Observed behavior

Non-fatals with different callsites are all grouped together.

Steps to reproduce

  • Add a helper "logNonFatalToBugsnag" method, and call that instead of calling Bugsnag.notify directly
  • Add calls to your helper method from a few different places.
  • Trigger errors from each of those places.
  • Note that they are are all grouped together.

Version

bugsnag-android:4.0.0

Additional information

I'm guessing we need something like iOS's report.depth to tell bugsnag how to group non-fatals when there's a helper method involved.

Example issue:
https://app.bugsnag.com/recharge-labs/android/errors/59dfe2b4855ea5001993998c

@fractalwrench
Copy link
Contributor

Thanks for the report @edenman - it would definitely make sense to offer something similar to the report.depth functionality on iOS.

There are a couple of ways to achieve the desired behaviour in the SDK currently. The first approach would be to specify a custom grouping hash, e.g. using the log message. The other approach would be to modify the stacktrace in a callback and remove the number of frames required.

I think it makes sense to add this functionality into the SDK, as it's a common usecase. Perhaps we could expose something like the following:

Bugsnag.beforeNotify(new BeforeNotify() {
    @Override
    public boolean run(Error error) {
        error.discardTopStackFrames(5);
        return true;
    }
});

@edenman
Copy link
Contributor Author

edenman commented Nov 1, 2017

Custom grouping hash doesn't work for me. The helper method exists to take care of the nitty-gritty details, but still get grouping by stacktrace.

It'd be a little weird to have beforeNotify be a top-level hook, bc then I'd have to branch on whether the error was a manually logged one vs an uncaught exception (we don't want to remove any stack elements for the latter).

I just realized there's a Bugsnag.notify(name, message, stacktrace, callback) so I think I can just manually grab the stacktrace and remove the top element myself. Gonna try that.

@edenman
Copy link
Contributor Author

edenman commented Nov 9, 2017

The "manually pruning the stacktrace" approach seems to be working so I'm just gonna do that. Feel free to close this (or leave open if you're planning on doing something more like the depth approach on iOS)

@kattrali kattrali added the scheduled Work is starting on this feature/bug label Nov 15, 2017
@johnkiely1 johnkiely1 removed the scheduled Work is starting on this feature/bug label May 19, 2020
rich-bugsnag pushed a commit that referenced this issue Sep 3, 2021
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

No branches or pull requests

4 participants