Skip to content
17 changes: 7 additions & 10 deletions src/platforms/apple/common/configuration/metric-kit.mdx
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
---
title: Metric Kit
title: MetricKit
sidebar_order: 20
description: "This feature, once enabled, subscribes to MXDiagnosticPayload data of MetricKit and it to Sentry."
---

<Include name="feature-stage-alpha.mdx" />
The [MetricKit](https://developer.apple.com/documentation/metrickit) integration subscribes to [MXHangDiagnostic](https://developer.apple.com/documentation/metrickit/mxhangdiagnostic), [MXDiskWriteExceptionDiagnostic](https://developer.apple.com/documentation/metrickit/mxdiskwriteexceptiondiagnostic)
and [MXCPUExceptionDiagnostic](https://developer.apple.com/documentation/metrickit/mxcpuexceptiondiagnostic), which it converts to Sentry events.

Once enabled, this feature subscribes to [MetricKit's](https://developer.apple.com/documentation/metrickit) [MXDiagnosticPayload](https://developer.apple.com/documentation/metrickit/mxdiagnosticpayload) data, converts it to events, and sends it to Sentry. This feature is available on Cocoa 8.0.0 and up.
This feature is available on Cocoa 8.14.0 and up. The SDK supports this feature from iOS 15 and up and macOS 12 and up because in these versions, MetricKit delivers diagnostic reports immediately, which allows the Sentry SDK to apply current data from the scope.

The MetricKit integration subscribes to:
Note that the Cocoa SDK has no control over the stack traces provided by MetricKit. Some only offer a couple of frames. If these aren't useful to you, you can drop them in <PlatformLink to="/configuration/filtering/#filtering-error-events/">`beforeSend`</PlatformLink>.

- [MXHangDiagnostic](https://developer.apple.com/documentation/metrickit/mxhangdiagnostic)
- [MXDiskWriteExceptionDiagnostic](https://developer.apple.com/documentation/metrickit/mxdiskwriteexceptiondiagnostic)
- [MXCPUExceptionDiagnostic](https://developer.apple.com/documentation/metrickit/mxcpuexceptiondiagnostic)
You can identify MetricKit events by looking at the `mx_hang_diagnostic`, `mx_cpu_exception`, and `mx_disk_write_exception` `mechanism.type`.

The SDK supports this feature from iOS 15 and up and macOS 12 and up because in these versions, MetricKit delivers diagnostic reports immediately, which allows the Sentry SDK to apply current data from the scope.

This is an experimental feature requiring opt-in, and can be enabled by setting the `enableMetricKit` option to `true`:
Enable this feature by setting the `enableMetricKit` option to `true`:

<SignInNote />

Expand Down