-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Fix Bugsnag call to notify #12967
Fix Bugsnag call to notify #12967
Conversation
Make sure we add metadata as expected: https://docs.bugsnag.com/platforms/ruby/rails/reporting-handled-errors/#add_metadata
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.
Good one!
A couple of thoughts, but not worth changing.
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.
Interesting, I would have thought that this worked before. Maybe Bugsnag used to convert objects into hashes automatically before? Maybe it broke in an upgrade?
I'm wondering if we should have our own service object to call Bugsnag. I was against it in the past because I don't want to invest work into replicating something that's already there but interfaces change. And maybe our use case is slightly different. I could imagine a DSL like this:
Alert.raise("This shouldn't happen").add_record(current_order)
def add_record(record)
payload.add_metadata(record.class.name, record.attributes)
self
end
Then we can chain method calls to add more data as needed. But mostly it's very simple.
Bugsnag uses a lambda for lazy evaluation but we mostly don't compute anything and have the object on hand. We can wrap that in our service object for an easier API that fits most of our use cases.
Hm, is there a gem for that?
Looks like there was some similar thinking at some point : https://github.com/openfoodfoundation/openfoodnetwork/blob/master/lib/open_food_network/error_logger.rb
|
What? Why?
Looking at some Bugsnag report, I noticed the metadata wasn't showing up. It turned out we are using
add_metadata
as expected. Doc: https://docs.bugsnag.com/platforms/ruby/rails/reporting-handled-errors/#add_metadataWhat should we test?
Green specs 🟢
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.