bugsnag / bugsnag-cocoa

BugSnag error monitoring & exception reporter for iOS, macOS, tvOS and watchOS
https://docs.bugsnag.com/platforms/ios
MIT License
236 stars 129 forks source link

Expose "launch reason" or OOM state #866

Open bolsinga opened 3 years ago

bolsinga commented 3 years ago

Description

It would be nice to know "why is the app launching?" Basically we'd like to know if we're re-launching due to a crash, or an OOM, etc. This will allow us to monitor what is going wrong more closely.

Describe the solution you'd like Right now there is +[Bugsnag appDidCrashLastLaunch]. How about an enumeration about why the application launched? Something along the lines of https://eng.uber.com/startup-reason-reporter/

Describe alternatives you've considered Right now we use private interfaces in Bugsnag to get -[BSGOutOfMemoryWatchdog didOOMLastLaunch] in v5, and -[BugsnagClient shouldReportOOM] in v6

Related requests with #570.

Additional context We basically just want to monitor with our own services if Bugsnag believes an OOM has occurred.

xljones commented 3 years ago

Hey @bolsinga, thanks for the suggestion! Would you expect this to look like a more nuanced version of appDidCrashLastLaunch()? Such that it would return something like: none, unhandledError, appUpdated, osUpdatedoom rather than just a BOOL?

bolsinga commented 3 years ago

Yes, that is what I was thinking. The -appDidCrashLastLaunch method could remain for backwards compatibility. The enum could be returned for apps that may want to dig into more of the why. Thanks for your consideration.