diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eb448395a..ef1642af7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ - 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 `reportAccessibilityIdentifier` (iOS) to omit PII accessibility identifiers from the view hierarchy ([#6771](https://github.com/getsentry/sentry-react-native/pull/6771)) +- 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 diff --git a/packages/core/etc/sentry-react-native.api.md b/packages/core/etc/sentry-react-native.api.md index a172cb95d9..6228c2f58e 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 b77b0dc115..491f10065e 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 @@ -456,6 +467,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 5501c45146..1d4b90d111 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -291,6 +291,40 @@ describe('Tests Native Wrapper', () => { expect(initParameter.reportAccessibilityIdentifier).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,