bugsnag-cocoa icon indicating copy to clipboard operation
bugsnag-cocoa copied to clipboard

Support for MetricKit reports

Open robmaceachern opened this issue 5 years ago • 9 comments

Description

MetricKit exposes a lot of valuable information related to crashes, UI hangs, and things like memory/cpu/network/battery usage. It would be very valuable if Bugsnag coalesced this information into useful statistics for each app release so developers could identify issues or trends over time.

Describe the solution you'd like I'd like to be able to send the MetricKit payloads to Bugsnag and have aggregate data/visualizations for the metrics for each app release. I'd also like to examine individual MetricKit payloads for individual users.

Describe alternatives you've considered

  • Manually mapping MetricKit data to Bugsnag error reports
  • Ingesting and processing the data on a custom server
  • Finding another service that supports MetricKit

Additional context Getting access to this data is going to be very important to us when iOS 14 rolls out to end users later this fall.

robmaceachern avatar Jul 29 '20 21:07 robmaceachern

Hi @robmaceachern thanks for bringing this up. I can see that you have also raised a support request for this. We'll take a look into how we could leverage MetricKit's features.

abigailbramble avatar Jul 30 '20 08:07 abigailbramble

Hi @phillipsam. Just checking in on this. Is there anything on the roadmap for better MetricKit support?

robmaceachern avatar Sep 15 '20 16:09 robmaceachern

Hi @robmaceachern

It's on our roadmap but we don't have a planned timeframe for this yet.

mattdyoung avatar Sep 15 '20 22:09 mattdyoung

Hi @mattdyoung, are you folks open to contributions from the community to support this? If so, is there any particular process you would like us to follow other than just submitting a PR?

sethfri avatar Sep 25 '20 18:09 sethfri

Hi @sethfri

Although in general we do consider PRs from the community, in the case of support for MetricKit this would be a reasonably significant product change. We're planning to think carefully about which aspects we build support for and maintain and the best way to align what's possible with other items on our roadmap so I'm afraid we're unlikely to accept an external PR for this.

mattdyoung avatar Sep 28 '20 16:09 mattdyoung

Hi @mattdyoung, any update on this? It seems that with iOS 15, app hang diagnostics with stack traces can be received immediately (as opposed to only every 24 hours) on-device. Seems like this could be a substantial improvement over the current app hang heuristics.

https://developer.apple.com/documentation/metrickit/mxmetricmanager

sethfri avatar Aug 26 '21 07:08 sethfri

Hey @sethfri, definitely, the updates to MetricKit look promising. We'll take a look into the viability of this :)

For clarity of other readers: Our current App Hang detection reports immediately for handled (recovered) app hangs, and on relaunch of the application for unhandled (app force quit by system watchdog or user) app hangs for iOS versions up to, and including 15.

xljones avatar Aug 26 '21 13:08 xljones

@phillipsam @mattdyoung @xljones Would love to hear your thoughts about how metric kit should or should not integrate with bugsnag. We currently depend both on:

  1. metrickit-ish data in xcode organizer which catches some crashes inside ios itself bugsnag doesn't appear to (that we still want to work around in our app), and also reports of stack traces driving the most disk writes, energy, hangs and aggregate metrics by version to locate non-crashing regressions in battery/disk/hangs/launch time/memory/scrolling/terminations but still significantly delayed especially the metrics which don't seem to settle for about a month so all new releases look like regressions initially.

  2. bugsnag for real-time data that allows us to catch actual regressions during phased rollout of new versions and also a bit more context like the breadcrumbs.

If it would be possible to gather any of the metric kit data FASTER than xcode organizer it would definitely be worth adding to bugsnag. This sounds like the case from what was just added to sentry via https://github.com/getsentry/sentry-cocoa/pull/2519 "The enableMetricKit option sends MXDiskWriteExceptionDiagnostic, MXCPUExceptionDiagnostic and MXHangDiagnostic to Sentry. The SDK supports this feature from iOS 15 and later and macOS 12 and later because, on these versions, MetricKit delivers diagnostic reports immediately."

The only other solution to upload metrickit events I can find is https://github.com/ChimeHQ/MeterReporter but all it does is upload (symbolicated yay!) json to S3 without aggregation although you can spot-check individual ones with their mac app https://github.com/ChimeHQ/MetricKitViewer

ericcj avatar Jan 10 '23 14:01 ericcj

Hi @ericcj,

We don't have a huge amount to share on this, it is still very much on our backlog but as yet has not been worked on, due to other priorities. At this stage we have not ruled anything in or out as such. Thanks for the additional context of how you use Bugsnag/MetricKit, I'm sure that will prove useful when we do get to work on this. We will post here as soon as we have any updates.

johnkiely1 avatar Jan 12 '23 11:01 johnkiely1