From 5f84c3a8dc056598c4a2384cf71347b124162c72 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 23 Sep 2026 14:45:16 +0200 Subject: [PATCH 1/2] feat(core): Expose remaining iOS native options Expose enablePreWarmedAppStartTracing (app-start tracing for pre-warmed starts) and enableMetricKitRawPayload (attach the raw MetricKit diagnostic payload to MetricKit events), both iOS. Read by cocoa's dictionary parser and forwarded as plain booleans. Part of #6747. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 2 ++ packages/core/etc/sentry-react-native.api.md | 2 ++ packages/core/src/js/options.ts | 23 +++++++++++++ packages/core/test/wrapper.test.ts | 34 ++++++++++++++++++++ 4 files changed, 61 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29b8df1fc6..e76a1e4e76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - Expose `enableNetworkBreadcrumbs` (iOS) to disable native HTTP request breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose `enableNetworkEventBreadcrumbs` (Android) to disable native network connectivity breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose native breadcrumb off-switches: `enableAutoBreadcrumbTracking` (iOS); `enableActivityLifecycleBreadcrumbs`, `enableAppLifecycleBreadcrumbs`, `enableSystemEventBreadcrumbs`, `enableAppComponentBreadcrumbs` (Android) ([#6768](https://github.com/getsentry/sentry-react-native/pull/6768)) +- Expose `enablePreWarmedAppStartTracing` (iOS) to opt out of app-start tracing for pre-warmed starts ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) +- Expose `enableMetricKitRawPayload` (iOS) to attach the raw MetricKit diagnostic payload to MetricKit events ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) ### Fixes diff --git a/packages/core/etc/sentry-react-native.api.md b/packages/core/etc/sentry-react-native.api.md index 81d56e48d9..3f17d5cc4a 100644 --- a/packages/core/etc/sentry-react-native.api.md +++ b/packages/core/etc/sentry-react-native.api.md @@ -173,6 +173,7 @@ export interface BaseReactNativeOptions { enableHistoricalTombstoneReporting?: boolean; enableMemoryIntrospection?: boolean; enableMetricKit?: boolean; + enableMetricKitRawPayload?: boolean; enableNative?: boolean; enableNativeCrashHandling?: boolean; enableNativeFramesTracking?: boolean; @@ -182,6 +183,7 @@ export interface BaseReactNativeOptions { enableNdkScopeSync?: boolean; enableNetworkBreadcrumbs?: boolean; enableNetworkEventBreadcrumbs?: boolean; + enablePreWarmedAppStartTracing?: boolean; enableStallTracking?: boolean; enableSystemEventBreadcrumbs?: boolean; enableTombstone?: boolean; diff --git a/packages/core/src/js/options.ts b/packages/core/src/js/options.ts index 8b735588a0..f1deeeff4b 100644 --- a/packages/core/src/js/options.ts +++ b/packages/core/src/js/options.ts @@ -336,6 +336,17 @@ export interface BaseReactNativeOptions { */ enableMetricKit?: boolean; + /** + * When enabled, the native iOS SDK attaches the raw MetricKit diagnostic payload (as received + * from the operating system) to the events it creates from MetricKit diagnostics. + * + * Only has an effect when `enableMetricKit` is `true`. + * + * @default false + * @platform ios + */ + enableMetricKitRawPayload?: boolean; + /** * When enabled, `SentryCrash` reads memory near the crash site while capturing a native crash * (e.g. `EXC_BAD_ACCESS`) and embeds string-based stack contents in the event. This can help @@ -442,6 +453,18 @@ export interface BaseReactNativeOptions { */ enableAppStartTracking?: boolean; + /** + * When enabled, the native iOS SDK also measures app start for pre-warmed app starts, where the + * operating system starts parts of the app ahead of time. + * + * Enabled by default in the native SDK; the default already accounts for pre-warm skew. Set this + * to `false` to opt out of app-start tracing for pre-warmed starts. + * + * @default true + * @platform ios + */ + enablePreWarmedAppStartTracing?: boolean; + /** * Track the slow and frozen frames in the application. Enabling this options will add * slow and frozen frames measurements to all created root spans (transactions). diff --git a/packages/core/test/wrapper.test.ts b/packages/core/test/wrapper.test.ts index d536db278f..2cdd8b0f99 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -274,6 +274,40 @@ describe('Tests Native Wrapper', () => { expect(initParameter.enableAppComponentBreadcrumbs).toBe(false); }); + test('forwards enableMetricKitRawPayload to the Native SDK', async () => { + await NATIVE.initNativeSdk({ + dsn: VALID_DSN, + enableNative: true, + autoInitializeNativeSdk: true, + enableMetricKitRawPayload: true, + devServerUrl: undefined, + defaultSidecarUrl: undefined, + mobileReplayOptions: undefined, + }); + + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); + // @ts-expect-error mock value + const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; + expect(initParameter.enableMetricKitRawPayload).toBe(true); + }); + + test('forwards enablePreWarmedAppStartTracing to the Native SDK', async () => { + await NATIVE.initNativeSdk({ + dsn: VALID_DSN, + enableNative: true, + autoInitializeNativeSdk: true, + enablePreWarmedAppStartTracing: false, + devServerUrl: undefined, + defaultSidecarUrl: undefined, + mobileReplayOptions: undefined, + }); + + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); + // @ts-expect-error mock value + const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; + expect(initParameter.enablePreWarmedAppStartTracing).toBe(false); + }); + test('filter beforeSend when initializing Native SDK', async () => { await NATIVE.initNativeSdk({ dsn: VALID_DSN, From 6bf12f98e549cc591a21eea9b2dba51dbcc70c94 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 23 Sep 2026 14:45:59 +0200 Subject: [PATCH 2/2] docs: Point CHANGELOG entries at PR #6772 Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e76a1e4e76..0b97a55286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,8 @@ - Expose `enableNetworkBreadcrumbs` (iOS) to disable native HTTP request breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose `enableNetworkEventBreadcrumbs` (Android) to disable native network connectivity breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose native breadcrumb off-switches: `enableAutoBreadcrumbTracking` (iOS); `enableActivityLifecycleBreadcrumbs`, `enableAppLifecycleBreadcrumbs`, `enableSystemEventBreadcrumbs`, `enableAppComponentBreadcrumbs` (Android) ([#6768](https://github.com/getsentry/sentry-react-native/pull/6768)) -- Expose `enablePreWarmedAppStartTracing` (iOS) to opt out of app-start tracing for pre-warmed starts ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) -- Expose `enableMetricKitRawPayload` (iOS) to attach the raw MetricKit diagnostic payload to MetricKit events ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) +- Expose `enablePreWarmedAppStartTracing` (iOS) to opt out of app-start tracing for pre-warmed starts ([#6772](https://github.com/getsentry/sentry-react-native/pull/6772)) +- Expose `enableMetricKitRawPayload` (iOS) to attach the raw MetricKit diagnostic payload to MetricKit events ([#6772](https://github.com/getsentry/sentry-react-native/pull/6772)) ### Fixes