Using MetricKit for Hangs on macOS

Hallo all, I did a test integration of MetricKit into one of our apps...I'am on macOS Ventura 13.3.1 (a). The app is not distributed via the App Store.

I subscribed to the MXMetricManager and implemented the didReceiveDiagnosticPayloads function.

So far everything seems to work, when I use in Xcode: Debug -> Simulate MetricKit Payload I get a callback and the payload.

So I did some further testing. When I build the app debug version with a test crash and then run the Debug Version (without Xcode) and let it crash the next time I start the app I get a callback to didReceiveDiagnosticPayloads with all the information about the crash.

But I'am not able to get a hang report. I tested it by adding a sleep (60) and adding some intensive computation work on the main thread so that it is busy for several seconds, I get no hang reports :-(

I'am using the Debug version and run it without Xcode.

Are hang reports expected to be reported immediately? I also get after 24 hours no hang reports.

Can someone help me?

Thanks and have a nice day!

Answered by DTS Engineer in 858948022

I unearthed ErichK’s bug report about this issue (FB12844381) and learnt an interesting titbits from that: Hang metrics work very differently on macOS and iOS. On macOS you only get a hang metric if the app hangs and never recovers, for example, if the user force quits it while it’s hung. Please try that and let me know if you see the metric in that case.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have exactly the same problem, and would appreciate some guidance on whether hang diagnostics on macOS actually work.

The same as the original poster above, the Simulate MetricKit Payload debug option works fine, and a crash is delivered immediately on restarting the app. No sign of any real hang reports though, even after deliberately causing hangs in the app. It’s my understanding that they should be delivered immediately, but even after waiting several days there’s still nothing. I’ve tried debug, release, and TestFlight builds.

Any guidance as to what I could possibly be missing would be great! Thank you.

I unearthed ErichK’s bug report about this issue (FB12844381) and learnt an interesting titbits from that: Hang metrics work very differently on macOS and iOS. On macOS you only get a hang metric if the app hangs and never recovers, for example, if the user force quits it while it’s hung. Please try that and let me know if you see the metric in that case.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Using MetricKit for Hangs on macOS
 
 
Q