MetricKit

RSS for tag

Aggregate and analyze per-device reports on power and performance metrics using MetricKit.

MetricKit Documentation

Posts under MetricKit tag

21 Posts
Sort by:
Post not yet marked as solved
1 Replies
247 Views
The MetricKit implementation is pretty straight forward. I am testing it now for a couple of days, but I never saw any report passed to my test apps. (implemented it in an empty app that just crashes every now and then and in a product of ours) The function 'didReceive' is never called and each time I am asking 'MXMetricManager.shared.pastDiagnosticPayloads' I get an empty collection. So that is the secret here? Is MetricKit not working for development builds? Or are there other factors/requirements not meet? import Foundation import MetricKit class CrashDetection: NSObject, MXMetricManagerSubscriber { @objc static let shared = CrashDetection() @objc private override init() { } internal static var crashDidOccur: Bool { get { UserDefaults.standard.bool(forKey: crashDidOccurKey) ?? false } set { UserDefaults.standard.set(newValue, forKey: crashDidOccurKey) } } @objc func start() { MXMetricManager.shared.add(self) } @objc func stop() { MXMetricManager.shared.remove(self) } func didReceive(_ payloads: [MXDiagnosticPayload]) { let crashDiagnostics = payloads.compactMap({ $0.crashDiagnostics }) CrashDetection.crashDidOccur = crashDiagnostics.isEmpty == false } }
Posted
by HelgeBB.
Last updated
.
Post not yet marked as solved
3 Replies
232 Views
Hi all, my company is looking more into MetricKit's MXAppExitMetric. The existing breakdown of exit reasons is very helpful but we are hoping to find a way to link these exits with a timestamp. This would help us to correlate app exits with other events that we are tracking on our side. Are there plans currently plans to add more granularity to this payload? If not, how can I submit an official request to do so?
Posted Last updated
.
Post not yet marked as solved
1 Replies
134 Views
Hi folks! My iOS app has the MetricKit integration, and I'm processing the reports on my server. While looking at some MXCrashDiagnostic reports, I saw certain reports that has threadAttributed property as true, but callStackRootFrames is just an empty array. So the report looks like the following example "callStacks" : [ { "threadAttributed" : true, "callStackRootFrames" : [ ] }, // ... // other callstacks where threadAttributed is false // but callStackRootFrames is not empty ] Looking at the documentation I can see threadAttributed is used to determine if the crash/exception occurred in this crash. So I can't understand how callStackRootFrames can be empty when threadAttributed is true. Is this a bug or an expected behavior? Also, is there a case where the crash/exception report does not have any callstack with threadAttributed as true? From the definition, it feels like there should always be exactly one attributed thread on each crash report. Thanks for the help!
Posted Last updated
.
Post not yet marked as solved
2 Replies
867 Views
Hello guys! I'm trying to collect metrics for each UIViewController in my iOS app. I can see all aggregated metrics except the cumulativeHitchTimeRatio one. I created a sample project and run UI test for more than 2 hours to allow Apple MetricKit to collect the metrics. When I run measure UI test it collects needed data well (look attached screenshots), but, unfortunately, I receive empty signpostMetrics array next day (json attached) in the didReceive(_:) method. Could you help me to understand how to get the cumulativeHitchTimeRatio metric from the MetricKit framework?
Posted
by adnako.
Last updated
.
Post not yet marked as solved
0 Replies
254 Views
The crash data opt in rate is 36% for my app. I have another crash reporting framework PLC in the app. The total number of crashes reported by MetricKit health report was 43% of the total crash count from PLC in May. This almost matched the 36% opt in rate. In the month of June we fixed a series of crashes. Now the total number of crashes reported by MetricKit health report is 80% of the total crash count from PLC. The crash data opt in rate has stayed at 36% for the past 90 days and I am not able to understand how the ratio flipped from 43% to 80%. Looking for guidance here.
Posted
by dkvijay.
Last updated
.
Post not yet marked as solved
0 Replies
447 Views
Hello all, I wanted to get MXMetricPayload to analyse some App metrics. And for some reason the method func didReceive(_ payloads: [MXMetricPayload]) from mxMetricManager is not being executed. For this I created a Class: import MetricKit public final class MetricKitManagerImpl: NSObject, MetricKitManager { public static let shared: MetricKitManager = MetricKitManagerImpl(mxMetricManager: MXMetricManager.shared) private let mxMetricManager: MXMetricManager private init( mxMetricManager: MXMetricManager ) { self.mxMetricManager = mxMetricManager super.init() mxMetricManager.add(self) } deinit { mxMetricManager.remove(self) } public func didReceive(_ payloads: [MXMetricPayload]) { payloads.forEach { if let scrollHitchTimeRatio = $0.animationMetrics?.scrollHitchTimeRatio.value { sendToSomeWhere(scrollHitchTimeRatio) } } } } Then on the AppDelegate on didFinishLaunchingWithOptions I do: private(set) var metricsManager: MetricKitManager! func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil ) -> Bool { self.metricsManager = MetricKitManagerImpl.shared ... } With this setUp I am able to receive the debug playload (triggered from Xcode Menu. Debug -> Simulate Metrik Kit Payload). However, after using the app for some days, I did not receive any real payload. Did anyone experience this? What am I doing wrong? Thanks a lot in advance! Miguel Franco
Posted Last updated
.
Post not yet marked as solved
0 Replies
440 Views
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!
Posted
by ErichK.
Last updated
.
Post not yet marked as solved
1 Replies
645 Views
This is related to my post https://developer.apple.com/forums/thread/724698 where I submitted an issue that MetricKit reports didn't work for System Extensions on mac. I've come to realize that this is also true for Launch Daemons/Agents in the system domain (and so it probably also explains the System Extension case as I understand System Extensions are somewhat like Launch Daemons). I have a "thin executable" (a Command Line Tool target) that registers with MetricKit reports and then just crashes itself. Here's the scenarios I've tested - If I launch this executable as the current user, I receive the crash reports from MetricKit. If I launch this executable as root, I also receive the crash reports. If I register it as a Launch Agent in a "user", or a "gui" domain, I still receive the crash reports. However, if I register it as a Launch Agent in the "system" domain, or as a Launch Daemon, I got this error from the CrashReport process. <<bundle ID>> is not a MetricKit client (I noticed the same error from MetricKit APIs in our system extension targets as well) I decided to open this new post here, because the solution we were talking about in post 724698 - delivering metric reports from system extensions to their host apps - may not apply here, since a Launch Daemon/Agent may not have a host app at all. What is the guidance if we want to receive these reports?
Posted
by qb_s.
Last updated
.
Post not yet marked as solved
2 Replies
672 Views
I saw another post https://developer.apple.com/forums/thread/652719 where it was mentioned at this point MetricKit is not meant to be enabled within the App Extension targets and it's up to the container app to receive the payloads on behalf of the extensions. But what's the guidance to use MetricKit for System Extension targets on macOS? I've tried subscribing to diagnostic reports from both a container app and its system extension on macOS, neither could receive any payload from the system extension. (The subscriber within the container app did receive payloads for its own reports - e.g. when the container app crashed itself, so I'm somewhat sure my test code was set up properly)
Posted
by qb_s.
Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
I'm posting signposts using the mxSignpost(...) calls. My MXMetricManagerSubscriber is receiving standard metrics, but never my signposts. Is this a known bug? If not, what could be causing them to be missing? My iPhone is running iOS 14.4. Thanks, Tom
Posted
by tompmtv.
Last updated
.
Post not yet marked as solved
1 Replies
3.4k Views
My test flight application crashed while doing a disk writing operation. I saw the following error in crash log 1073.76 MB of file backed memory dirtied over 705 seconds (1522.14 KB per second average), exceeding limit of 12.43 KB per second over 86400 seconds\ After a little bit of research I found from Apple documentation that System will throw an exception if disk writes from the app exceeds a certain limit in 24 hours window [https://developer.apple.com/documentation/xcode/reducing-disk-writes) But the threshold is not documented. But looking at the crash log we can reverse calculate this threshold as 12.43KB * 86400 ~ 1 GB Does this means that iOS application won't be able to write data more than this limit (1 GB) per day?
Posted Last updated
.
Post not yet marked as solved
0 Replies
764 Views
Hello, I am trying to analyse the hang logs stacktrace which are reported via xcode organiser for my app. The json .xchanglog files which are generated are not symbolicated. I was trying out the the recommendations which are used to symbolicate .crash logs but it did not work for me. Is there an apple recommendation on how we can symbolicate/analyse .xchanglog logs locally? Note: I have dSYM files available on my mac. The uuid are matched. Command i am using is replacing the correct values: % atos -arch BinaryArchitecture -o PathToDSYMFile/Contents/Resources/DWARF/BinaryName -l LoadAddress AddressesToSymbolicate Things tried: https://developer.apple.com/documentation/xcode/interpreting-the-json-format-of-a-crash-report https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report Thanks!
Posted
by ropal.
Last updated
.
Post not yet marked as solved
1 Replies
827 Views
We are building a framework which will be used by other apps. Want to integrate crash reporting and diagnostics for our framework. Want to report crashes to our backend happening inside our framework only and ignore app level crashes. Is it possible to filter crashes like that ?
Posted
by mnive93.
Last updated
.
Post not yet marked as solved
0 Replies
785 Views
I want to obtain diagnostic payloads for my Unity iOS application. I intentionally crashed (by calling abort) the unity app to invoke didReceiveDiagnosticPayloads but nothing happens. However, when I do this for a sample iOS project that I created in the xcode, didReceiveDiagnosticPayloads works fine. Is there any additional requirements or settings to use MetricKit with Unity?
Posted Last updated
.
Post not yet marked as solved
1 Replies
946 Views
I want to obtain the hanging diagnostics for my app. In order to simulate receiving them I use Debug > Simulate MetricKit Payloads in Xcode (14.0.1, 14A400), but the didReceive(_ payloads: [MXDiagnosticPayload]) method is not invoked. It works for the didReceive(_ payloads: [MXMetricPayload]) method. Is this a correct behavior? If so, how can I simulate receiving the diagnostic payloads?
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
Xcode throw an error when i call the api finishExtendedLaunchMeasurement :  [General] Couldn't find persisted ALM/FrontBoard launch signpost id when finishing an ext launch task. Error Domain=MXErrorDomain Code=5 "Internal failures happened inside of MetricKit." UserInfo={NSLocalizedDescription=Internal failures happened inside of MetricKit.} how i can fix this problem?
Posted
by moonmd.
Last updated
.
Post marked as solved
11 Replies
1.9k Views
We have use MetricKit API when app was launched. [[MXMetricManager sharedManager] addSubscriber:self]; the exception is here. Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Triggered by Thread: 27 Last Exception Backtrace: 0 CoreFoundation 0x18dbae248 __exceptionPreprocess + 164 (NSException.m:202) 1 libobjc.A.dylib 0x186fc3a68 objc_exception_throw + 60 (objc-exception.mm:356) 2 CoreFoundation 0x18dd19fec __NSFastEnumerationMutationHandler + 116 (NSEnumerator.m:130) 3 Foundation 0x18804d828 -[NSConcreteHashTable countByEnumeratingWithState:objects:count:] + 76 (NSHashTable.m:577) 4 MetricKit 0x1fddf8868 -[MXMetricManager deliverMetricPayload:] + 408 (MXMetricManager.m:336) 5 Foundation 0x1880b66c8 __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S1__ + 16 (NSXPCConnection.m:189) 6 Foundation 0x188686e34 -[NSXPCConnection _decodeAndInvokeMessageWithEvent:reply:flags:] + 1644 (NSXPCConnection.m:705) 7 Foundation 0x188688608 message_handler_message + 88 (NSXPCConnection.m:826) 8 Foundation 0x188688074 message_handler + 152 (NSXPCConnection.m:797) 9 libxpc.dylib 0x1da21a18c _xpc_connection_call_event_handler + 152 (connection.c:834) 10 libxpc.dylib 0x1da21a5bc _xpc_connection_mach_event + 992 (connection.c:1445) 11 libdispatch.dylib 0x194ff609c _dispatch_client_callout4 + 20 (object.m:600) 12 libdispatch.dylib 0x195012830 _dispatch_mach_msg_invoke + 468 (mach.c:2462) 13 libdispatch.dylib 0x194ffd56c _dispatch_lane_serial_drain + 376 (inline_internal.h:0) 14 libdispatch.dylib 0x19501354c _dispatch_mach_invoke + 448 (mach.c:2784) 15 libdispatch.dylib 0x194ffd56c _dispatch_lane_serial_drain + 376 (inline_internal.h:0) 16 libdispatch.dylib 0x194ffe214 _dispatch_lane_invoke + 436 (queue.c:3940) 17 libdispatch.dylib 0x195008e10 _dispatch_workloop_worker_thread + 652 (queue.c:6846) 18 libsystem_pthread.dylib 0x1da1c5df8 _pthread_wqthread + 288 (pthread.c:2618) 19 libsystem_pthread.dylib 0x1da1c5b98 start_wqthread + 8 how to fix this issues?
Posted
by rbbtsn0w.
Last updated
.
Post not yet marked as solved
0 Replies
731 Views
In the official documentation offsetIntoBinaryTextSegment The offset of the stack frame into the text segment of the binary. But in fact,On iOS 15 and below, the meaning of offsetIntoBinaryTextSegment is load address of image. I found that iOS 16 has a fix for its calculation
Posted Last updated
.