feat(ios): Introduce enableMetricKit option - #6540
Merged
Merged
Conversation
Expose `enableMetricKit` in the React Native SDK options so the Cocoa MetricKit integration can be enabled from `Sentry.init()` instead of only through native initialization. The option name matches the Cocoa `SentryOptions` property, so it is decoded by `SentryOptionsInternal initWithDict:` and needs no additional mapping in `RNSentryStart.m`. Fixes #6457
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
alwx
marked this pull request as ready for review
July 30, 2026 09:49
antonis
reviewed
Jul 30, 2026
Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io>
antonis
approved these changes
Jul 30, 2026
Contributor
|
6 tasks
Contributor
Author
|
@antonis did the docs PR: getsentry/sentry-docs#18881 |
alwx
commented
Jul 30, 2026
|
|
||
| ### Features | ||
|
|
||
| - Add `enableMetricKit` option to enable the iOS MetricKit integration ([#6540](https://github.com/getsentry/sentry-react-native/pull/6540)) |
antonis
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Adds
enableMetricKitto the React Native SDK options, forwarding it to the Cocoa SDK.The option name matches the Cocoa
SentryOptionsproperty, so it is decoded bySentryOptionsInternal initWithDict:and needs no mapping inRNSentryStart.m— same asenableAppHangTracking/appHangTimeoutInterval. No production code changes, only the type declaration plus tests.Notes:
sentry.options.jsoninit can still own it.RNSentryStart.javais per-keyhasKey()opt-in).BaseReactNativeOptionsisn't exported from the entry point.💡 Motivation and Context
enableMetricKitcould only be enabled through native initialization. This makes it officially configurable from RN.MetricKit hang diagnostics (
MXHangDiagnostic) are reported by the OS and are distinct from App Hangs V2, so this is not a substitute forenableAppHangTracking— enabling both can double-report a hang. Documented in the JSDoc.Fixes #6457
💚 How did you test it?
packages/core/test/wrapper.test.ts— option is forwarded when set, absent when unset.RNSentryTests.m— enabled / disabled / default cases assertingSentryOptions.enableMetricKit. This is what verifies Cocoa's dict decoder actually maps the key.yarn build,yarn test(2073 passing),yarn lint,yarn circularDepCheck,yarn api-report(no diff).xcodebuild test -configuration Releaseon iPhone 17 / iOS 26.1 — 49 tests, 0 failures.Not verified end-to-end against Sentry: iOS delivers MetricKit payloads on a ~24h cadence, so that needs a TestFlight build.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
getsentry/sentry-docsfor the new option.enableMetricKitRawPayloadis intentionally out of scope; still native-init only.