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

Callback that always runs, regardless of whether report should be ignored? #643

Open
stitchfixsam opened this issue Dec 7, 2020 · 2 comments
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature

Comments

@stitchfixsam
Copy link

stitchfixsam commented Dec 7, 2020

Description

The underlying motivation: I'd like to ignore certain exceptions via discard_classes but nonetheless report information about them to a metrics store (e.g. if I see FooException, we shouldn't report it to Bugsnag but should tell Prometheus, Datadog, or whatever).

In implementing this, I discovered that notify bails out before the add_on_error code runs when that exception is marked to be ignored. This, of course, makes good sense! But also blocks what I was trying to do.

So basically, I'd like to see if we could add a hook that runs, regardless of whether exception is marked to be ignored, whether the release stage is marked to be ignored, and so on.

I'm happy to do the legwork on this one if you all are ok with adding it to the library.

I'd also love to be told that this is possible through other means that I don't know about!

Describe the solution you'd like

Re-institute configuration.before_notify_callbacks or some other hook that lets you run arbitrary code against a report prior to the filtering process.

Describe alternatives you've considered

  • Using add_on_error: doesn't work AFAICT, since notify bails before it hits the callbacks
  • Adding user middleware: doesn't work AFAICT, since notify bails before it hits the callbacks
  • Doing this outside of the bugsnag-ruby library is certainly plausible, but I wanted to see if we might get it in here.
@mattdyoung
Copy link

Hi @stitchfixsam

What we'd recommend for your scenario it to not use discard_classes but instead store your own list of classes to discard. Then in add_on_error once you've run your other code return false if the exception class is in your own list to prevent it being reported to Bugsnag.

Keeping this issue open though as we may be able to support this a better way within bugsnag-ruby in the future.

@mattdyoung mattdyoung added backlog We hope to fix this feature/bug in the future feature request Request for a new feature labels Dec 11, 2020
@stitchfixsam
Copy link
Author

@mattdyoung clever! I'll give it a go. Thanks for the reply, and please do @ me if you need hands to implement the feature in due time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants