@sentry/react-native 7.8.0 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +65 -5
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +2 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +3 -2
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/options.d.ts +49 -1
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +26 -0
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +14 -0
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/tools/metroMiddleware.d.ts +1 -1
- package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
- package/dist/js/tools/metroMiddleware.js +2 -2
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +12 -7
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +2 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +5 -1
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +13 -0
- package/ios/RNSentryReplay.mm +5 -0
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +10 -10
- package/ts3.8/dist/js/options.d.ts +49 -1
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +26 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAoG7D,MAAM,cAAc,GAAwB;IAC1C,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,8BAA8B,EAAE,KAAK;IACrC,oBAAoB,EAAE,IAAI;IAC1B,uBAAuB,EAAE,KAAK;IAC9B,kBAAkB,EAAE,WAAW;CAChC,CAAC;AAEF,SAAS,YAAY,CAAC,WAAyC;IAC7D,MAAM,MAAM,mCACP,cAAc,GACd,WAAW,CACf,CAAC;IAEF,IAAI,WAAW,CAAC,oBAAoB,KAAK,SAAS,IAAI,WAAW,CAAC,8BAA8B,KAAK,SAAS,EAAE;QAC9G,MAAM,CAAC,oBAAoB,GAAG,WAAW,CAAC,8BAA8B,CAAC;KAC1E;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,cAAmC,cAAc,EAA2B,EAAE;IACpH,IAAI,QAAQ,EAAE,EAAE;QACd,KAAK,CAAC,IAAI,CACR,YAAY,8BAA8B,gFAAgF,CAC3H,CAAC;KACH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AqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,SAAS,WAAW;QAClB,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, EventHint, Integration } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\n/**\n * Screenshot strategy type for Android Session Replay.\n *\n * - `'canvas'`: Canvas-based screenshot strategy. This strategy does **not** support any masking options, it always masks text and images. Use this if your application has strict PII requirements.\n * - `'pixelCopy'`: Pixel copy screenshot strategy (default). Supports all masking options.\n */\nexport type ScreenshotStrategy = 'canvas' | 'pixelCopy';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n * @platform ios\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n * @platform ios\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n * @platform ios\n */\n enableFastViewRendering?: boolean;\n\n /**\n * Sets the screenshot strategy used by the Session Replay integration on Android.\n *\n * If your application has strict PII requirements we recommend using `'canvas'`.\n * This strategy does **not** support any masking options, it always masks text and images.\n *\n * - Experiment: In case you are noticing issues with the canvas screenshot strategy, please report the issue on [GitHub](https://github.com/getsentry/sentry-java).\n *\n * @default 'pixelCopy'\n * @platform android\n */\n screenshotStrategy?: ScreenshotStrategy;\n\n /**\n * Callback to determine if a replay should be captured for a specific error.\n * When this callback returns `false`, no replay will be captured for the error.\n * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.\n *\n * @param event The error event\n * @param hint Additional event information\n * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling\n */\n beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;\n}\n\nconst defaultOptions: MobileReplayOptions = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n screenshotStrategy: 'pixelCopy',\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): MobileReplayOptions {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: MobileReplayOptions;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n // Cache the replay ID in JavaScript to avoid excessive bridge calls\n // This will be updated when we know the replay ID changes (e.g., after captureReplay)\n let cachedReplayId: string | null = null;\n\n function updateCachedReplayId(replayId: string | null): void {\n cachedReplayId = replayId;\n }\n\n function getCachedReplayId(): string | null {\n if (cachedReplayId !== null) {\n return cachedReplayId;\n }\n const nativeReplayId = NATIVE.getCurrentReplayId();\n if (nativeReplayId) {\n cachedReplayId = nativeReplayId;\n }\n return nativeReplayId;\n }\n\n async function processEvent(event: Event, hint: EventHint): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n // Check if beforeErrorSampling callback filters out this error\n if (initOptions.beforeErrorSampling) {\n try {\n if (initOptions.beforeErrorSampling(event, hint) === false) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sent; beforeErrorSampling conditions not met for event ${event.event_id}.`,\n );\n return event;\n }\n } catch (error) {\n debug.error(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} beforeErrorSampling callback threw an error, proceeding with replay capture`,\n error,\n );\n // Continue with replay capture if callback throws\n }\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (replayId) {\n updateCachedReplayId(replayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n } else {\n // Check if there's an ongoing recording and update cache if found\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n updateCachedReplayId(recordingReplayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n } else {\n updateCachedReplayId(null);\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n // Initialize the cached replay ID on setup\n cachedReplayId = NATIVE.getCurrentReplayId();\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // Use cached replay ID to avoid bridge calls\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n function getReplayId(): string | null {\n return getCachedReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAgI7D,MAAM,cAAc,GAAwB;IAC1C,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,8BAA8B,EAAE,KAAK;IACrC,oBAAoB,EAAE,IAAI;IAC1B,uBAAuB,EAAE,KAAK;IAC9B,kBAAkB,EAAE,WAAW;CAChC,CAAC;AAEF,SAAS,YAAY,CAAC,WAAyC;IAC7D,MAAM,MAAM,mCACP,cAAc,GACd,WAAW,CACf,CAAC;IAEF,IAAI,WAAW,CAAC,oBAAoB,KAAK,SAAS,IAAI,WAAW,CAAC,8B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AO,EAAE,OAAO;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, EventHint, Integration, Metric } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\n/**\n * Screenshot strategy type for Android Session Replay.\n *\n * - `'canvas'`: Canvas-based screenshot strategy. This strategy does **not** support any masking options, it always masks text and images. Use this if your application has strict PII requirements.\n * - `'pixelCopy'`: Pixel copy screenshot strategy (default). Supports all masking options.\n */\nexport type ScreenshotStrategy = 'canvas' | 'pixelCopy';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n * @platform ios\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n * @platform ios\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n * @platform ios\n */\n enableFastViewRendering?: boolean;\n\n /**\n * Array of view class names to include in subtree traversal during session replay and screenshot capture on iOS.\n *\n * Only views that are instances of these classes (or subclasses) will be traversed.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly include only safe view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n includedViewClasses?: string[];\n\n /**\n * Array of view class names to exclude from subtree traversal during session replay and screenshot capture on iOS.\n *\n * Views of these classes (or subclasses) will be skipped entirely, including all their children.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly exclude problematic view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n excludedViewClasses?: string[];\n\n /**\n * Sets the screenshot strategy used by the Session Replay integration on Android.\n *\n * If your application has strict PII requirements we recommend using `'canvas'`.\n * This strategy does **not** support any masking options, it always masks text and images.\n *\n * - Experiment: In case you are noticing issues with the canvas screenshot strategy, please report the issue on [GitHub](https://github.com/getsentry/sentry-java).\n *\n * @default 'pixelCopy'\n * @platform android\n */\n screenshotStrategy?: ScreenshotStrategy;\n\n /**\n * Callback to determine if a replay should be captured for a specific error.\n * When this callback returns `false`, no replay will be captured for the error.\n * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.\n *\n * @param event The error event\n * @param hint Additional event information\n * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling\n */\n beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;\n}\n\nconst defaultOptions: MobileReplayOptions = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n screenshotStrategy: 'pixelCopy',\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): MobileReplayOptions {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: MobileReplayOptions;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n // Cache the replay ID in JavaScript to avoid excessive bridge calls\n // This will be updated when we know the replay ID changes (e.g., after captureReplay)\n let cachedReplayId: string | null = null;\n\n function updateCachedReplayId(replayId: string | null): void {\n cachedReplayId = replayId;\n }\n\n function getCachedReplayId(): string | null {\n if (cachedReplayId !== null) {\n return cachedReplayId;\n }\n const nativeReplayId = NATIVE.getCurrentReplayId();\n if (nativeReplayId) {\n cachedReplayId = nativeReplayId;\n }\n return nativeReplayId;\n }\n\n async function processEvent(event: Event, hint: EventHint): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n // Check if beforeErrorSampling callback filters out this error\n if (initOptions.beforeErrorSampling) {\n try {\n if (initOptions.beforeErrorSampling(event, hint) === false) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sent; beforeErrorSampling conditions not met for event ${event.event_id}.`,\n );\n return event;\n }\n } catch (error) {\n debug.error(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} beforeErrorSampling callback threw an error, proceeding with replay capture`,\n error,\n );\n // Continue with replay capture if callback throws\n }\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (replayId) {\n updateCachedReplayId(replayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: replayId,\n };\n } else {\n // Check if there's an ongoing recording and update cache if found\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n updateCachedReplayId(recordingReplayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: recordingReplayId,\n };\n } else {\n updateCachedReplayId(null);\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n // Initialize the cached replay ID on setup\n cachedReplayId = NATIVE.getCurrentReplayId();\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // Use cached replay ID to avoid bridge calls\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('processMetric', (metric: Metric) => {\n // Add replay_id to metric attributes to link metrics to replays\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n metric.attributes = metric.attributes || {};\n metric.attributes.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n function getReplayId(): string | null {\n return getCachedReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
|
|
@@ -7,7 +7,7 @@ export declare const stackFramesContextMiddleware: Middleware;
|
|
|
7
7
|
/**
|
|
8
8
|
* Creates a middleware that adds source context to the Sentry formatted stack frames.
|
|
9
9
|
*/
|
|
10
|
-
export declare const createSentryMetroMiddleware: (middleware:
|
|
10
|
+
export declare const createSentryMetroMiddleware: (middleware: Middleware) => Middleware;
|
|
11
11
|
/**
|
|
12
12
|
* Adds the Sentry middleware to the Metro server config.
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK7D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,
|
|
1
|
+
{"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK7D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,UAgC1C,CAAC;AA2CF;;GAEG;AACH,eAAO,MAAM,2BAA2B,eAAgB,UAAU,KAAG,UAWpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WAAY,YAAY,KAAG,YAY3D,CAAC"}
|
|
@@ -18,7 +18,7 @@ const readFileAsync = (0, util_1.promisify)(fs_1.readFile);
|
|
|
18
18
|
* Accepts Sentry formatted stack frames and
|
|
19
19
|
* adds source context to the in app frames.
|
|
20
20
|
*/
|
|
21
|
-
const stackFramesContextMiddleware = (request, response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const stackFramesContextMiddleware = (request, response, _next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
22
|
core_1.debug.log('[@sentry/react-native/metro] Received request for stack frames context.');
|
|
23
23
|
request.setEncoding('utf8');
|
|
24
24
|
const rawBody = yield getRawBody(request);
|
|
@@ -89,7 +89,7 @@ const createSentryMetroMiddleware = (middleware) => {
|
|
|
89
89
|
return (request, response, next) => {
|
|
90
90
|
var _a;
|
|
91
91
|
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith(SENTRY_CONTEXT_REQUEST_PATH)) {
|
|
92
|
-
return (0, exports.stackFramesContextMiddleware)(request, response);
|
|
92
|
+
return (0, exports.stackFramesContextMiddleware)(request, response, next);
|
|
93
93
|
}
|
|
94
94
|
return middleware(request, response, next);
|
|
95
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroMiddleware.js","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uCAAwD;AACxD,2BAA8B;AAG9B,+BAAiC;AAEjC,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,aAAQ,CAAC,CAAC;AAE1C;;;GAGG;AACI,MAAM,4BAA4B,GAAe,CACtD,OAAwB,EACxB,QAAwB,
|
|
1
|
+
{"version":3,"file":"metroMiddleware.js","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uCAAwD;AACxD,2BAA8B;AAG9B,+BAAiC;AAEjC,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,aAAQ,CAAC,CAAC;AAE1C;;;GAGG;AACI,MAAM,4BAA4B,GAAe,CACtD,OAAwB,EACxB,QAAwB,EACxB,KAAiB,EACF,EAAE;IACjB,YAAK,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACrF,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,IAAI,GAEJ,EAAE,CAAC;IACP,IAAI;QACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5B;IAAC,OAAO,CAAC,EAAE;QACV,YAAK,CAAC,GAAG,CAAC,4DAA4D,EAAE,CAAC,CAAC,CAAC;QAC3E,UAAU,CAAC,QAAQ,EAAE,+CAA+C,CAA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GAAG,CAAC,MAAoB,EAAgB,EAAE;IACzE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,6CAA6C;QAC7C,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;KACpB;IAED,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAClE,MAAM,CAAC,MAAM,CAAC,iBAAiB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE;QACvD,MAAM,gBAAgB,GAAG,IAAA,mCAA2B,EAAC,UAAU,CAAC,CAAC;QACjE,OAAO,yBAAyB,CAAC,CAAC,CAAC,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC5G,CAAC,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["import type { StackFrame } from '@sentry/core';\nimport { addContextToFrame, debug } from '@sentry/core';\nimport { readFile } from 'fs';\nimport type { IncomingMessage, ServerResponse } from 'http';\nimport type { InputConfigT, Middleware } from 'metro-config';\nimport { promisify } from 'util';\n\nconst readFileAsync = promisify(readFile);\n\n/**\n * Accepts Sentry formatted stack frames and\n * adds source context to the in app frames.\n */\nexport const stackFramesContextMiddleware: Middleware = async (\n request: IncomingMessage,\n response: ServerResponse,\n _next: () => void,\n): Promise<void> => {\n debug.log('[@sentry/react-native/metro] Received request for stack frames context.');\n request.setEncoding('utf8');\n const rawBody = await getRawBody(request);\n\n let body: {\n stack?: Partial<StackFrame>[];\n } = {};\n try {\n body = JSON.parse(rawBody);\n } catch (e) {\n debug.log('[@sentry/react-native/metro] Could not parse request body.', e);\n badRequest(response, 'Invalid request body. Expected a JSON object.');\n return;\n }\n\n const stack = body.stack;\n if (!Array.isArray(stack)) {\n debug.log('[@sentry/react-native/metro] Invalid stack frames.', stack);\n badRequest(response, 'Invalid stack frames. Expected an array.');\n return;\n }\n\n const stackWithSourceContext = await Promise.all(stack.map(addSourceContext));\n response.setHeader('Content-Type', 'application/json');\n response.statusCode = 200;\n response.end(JSON.stringify({ stack: stackWithSourceContext }));\n debug.log('[@sentry/react-native/metro] Sent stack frames context.');\n};\n\nasync function addSourceContext(frame: StackFrame): Promise<StackFrame> {\n if (!frame.in_app) {\n return frame;\n }\n\n try {\n if (typeof frame.filename !== 'string') {\n debug.warn('[@sentry/react-native/metro] Could not read source context for frame without filename.');\n return frame;\n }\n\n const source = await readFileAsync(frame.filename, { encoding: 'utf8' });\n const lines = source.split('\\n');\n addContextToFrame(lines, frame);\n } catch (error) {\n debug.warn('[@sentry/react-native/metro] Could not read source context for frame.', error);\n }\n return frame;\n}\n\nfunction badRequest(response: ServerResponse, message: string): void {\n response.statusCode = 400;\n response.end(message);\n}\n\nfunction getRawBody(request: IncomingMessage): Promise<string> {\n return new Promise((resolve, reject) => {\n let data = '';\n request.on('data', chunk => {\n data += chunk;\n });\n request.on('end', () => {\n resolve(data);\n });\n request.on('error', reject);\n });\n}\n\nconst SENTRY_MIDDLEWARE_PATH = '/__sentry';\nconst SENTRY_CONTEXT_REQUEST_PATH = `${SENTRY_MIDDLEWARE_PATH}/context`;\n\n/**\n * Creates a middleware that adds source context to the Sentry formatted stack frames.\n */\nexport const createSentryMetroMiddleware = (middleware: Middleware): Middleware => {\n return (request: IncomingMessage, response: ServerResponse, next: () => void) => {\n if (request.url?.startsWith(SENTRY_CONTEXT_REQUEST_PATH)) {\n return stackFramesContextMiddleware(request, response, next);\n }\n return (middleware as (req: IncomingMessage, res: ServerResponse, next: () => void) => void)(\n request,\n response,\n next,\n );\n };\n};\n\n/**\n * Adds the Sentry middleware to the Metro server config.\n */\nexport const withSentryMiddleware = (config: InputConfigT): InputConfigT => {\n if (!config.server) {\n // @ts-expect-error server is typed read only\n config.server = {};\n }\n\n const originalEnhanceMiddleware = config.server.enhanceMiddleware;\n config.server.enhanceMiddleware = (middleware, server) => {\n const sentryMiddleware = createSentryMetroMiddleware(middleware);\n return originalEnhanceMiddleware ? originalEnhanceMiddleware(sentryMiddleware, server) : sentryMiddleware;\n };\n return config;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appStart.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,WAAW,EAAoC,MAAM,cAAc,CAAC;AAgBjG,OAAO,KAAK,EAA0B,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAgBzF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,yBAAyB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC;AAeF,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACxC;AAQD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BzF;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAK7E;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,SAAU,eAAe,KAAG,IAG3D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAyBD;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAG9B;;;;;OAKG;;MAEI,
|
|
1
|
+
{"version":3,"file":"appStart.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,WAAW,EAAoC,MAAM,cAAc,CAAC;AAgBjG,OAAO,KAAK,EAA0B,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAgBzF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,yBAAyB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC;AAeF,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACxC;AAQD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BzF;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAK7E;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,SAAU,eAAe,KAAG,IAG3D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAyBD;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAG9B;;;;;OAKG;;MAEI,mBA0SR,CAAC"}
|
|
@@ -251,17 +251,22 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
|
|
|
251
251
|
// App start data is only relevant for the first transaction of the app run
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
|
-
if (!firstStartedActiveRootSpanId) {
|
|
255
|
-
debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
254
|
if (!((_a = event.contexts) === null || _a === void 0 ? void 0 : _a.trace)) {
|
|
259
255
|
debug.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');
|
|
260
256
|
return;
|
|
261
257
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
258
|
+
// When standalone is true, we create our own transaction and don't need to verify
|
|
259
|
+
// it matches the first navigation transaction. When standalone is false, we need to
|
|
260
|
+
// ensure we're attaching app start to the first transaction (not a later one).
|
|
261
|
+
if (!standalone) {
|
|
262
|
+
if (!firstStartedActiveRootSpanId) {
|
|
263
|
+
debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {
|
|
267
|
+
debug.warn('[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.');
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
265
270
|
}
|
|
266
271
|
const appStart = yield NATIVE.fetchNativeAppStart();
|
|
267
272
|
if (!appStart) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gCAAgC,EAChC,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,cAAc,IAAI,0BAA0B,EAC5C,cAAc,IAAI,0BAA0B,GAC7C,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EACL,cAAc,IAAI,iBAAiB,EACnC,cAAc,IAAI,iBAAiB,EACnC,OAAO,IAAI,UAAU,GACtB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MA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ACjE,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,6BAA6B;YAC1C,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,WAAW,GAAG,IAAI;YAC7B,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,YAAY;YACzB,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["/* eslint-disable complexity, max-lines */\nimport type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core';\nimport {\n debug,\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\nimport { getAppRegistryIntegration } from '../../integrations/appRegistry';\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse, NativeFramesResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { setMainThreadInfo } from '../span';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\n\n/**\n * We filter out app start more than 60s.\n * This could be due to many different reasons.\n * We've seen app starts with hours, days and even months.\n */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\ninterface AppStartEndData {\n timestampMs: number;\n endFrames: NativeFramesResponse | null;\n}\n\nlet appStartEndData: AppStartEndData | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n const client = getClient();\n if (!client) {\n debug.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n\n const timestampMs = timestampInSeconds() * 1000;\n let endFrames: NativeFramesResponse | null = null;\n\n if (NATIVE.enableNative) {\n try {\n endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for app start.', endFrames);\n } catch (error) {\n debug.log('[AppStart] Failed to capture end frames for app start.', error);\n }\n }\n\n _setAppStartEndData({\n timestampMs,\n endFrames,\n });\n\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n appStartEndData?.timestampMs && debug.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && debug.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndData = (data: AppStartEndData): void => {\n appStartEndData && debug.warn('Overwriting already set app start end data.');\n appStartEndData = data;\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Attaches frame data to a span's data object.\n */\nfunction attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): void {\n if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.totalFrames <= 0) {\n debug.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`);\n return;\n }\n span.data = span.data || {};\n span.data['frames.total'] = frames.totalFrames;\n span.data['frames.slow'] = frames.slowFrames;\n span.data['frames.frozen'] = frames.frozenFrames;\n\n debug.log('[AppStart] Attached frame data to span.', {\n spanId: span.span_id,\n frameData: {\n total: frames.totalFrames,\n slow: frames.slowFrames,\n frozen: frames.frozenFrames,\n },\n });\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n let afterAllSetupCalled = false;\n let firstStartedActiveRootSpanId: string | undefined = undefined;\n\n const setup = (client: Client): void => {\n _client = client;\n const { enableAppStartTracking } = client.getOptions() as ReactNativeClientOptions;\n\n if (!enableAppStartTracking) {\n isEnabled = false;\n debug.warn('[AppStart] App start tracking is disabled.');\n }\n\n client.on('spanStart', recordFirstStartedActiveRootSpanId);\n };\n\n const afterAllSetup = (client: Client): void => {\n if (afterAllSetupCalled) {\n return;\n }\n afterAllSetupCalled = true;\n\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (appStartDataFlushed) {\n debug.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.');\n appStartDataFlushed = false;\n firstStartedActiveRootSpanId = undefined;\n } else {\n debug.log(\n '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.',\n );\n }\n });\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n const recordFirstStartedActiveRootSpanId = (rootSpan: Span): void => {\n if (firstStartedActiveRootSpanId) {\n return;\n }\n\n if (!isRootSpan(rootSpan)) {\n return;\n }\n\n setFirstStartedActiveRootSpanId(rootSpan.spanContext().spanId);\n };\n\n /**\n * For testing purposes only.\n * @private\n */\n const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => {\n firstStartedActiveRootSpanId = spanId;\n debug.log('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId);\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!_client) {\n // If client is not set, SDK was not initialized, logger is thus disabled\n // eslint-disable-next-line no-console\n console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');\n return;\n }\n\n if (!standalone) {\n debug.log(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n debug.log('[AppStart] App start tracking standalone root span (transaction).');\n\n if (!appStartEndData?.endFrames && NATIVE.enableNative) {\n try {\n const endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for standalone app start.', endFrames);\n\n const currentTimestamp = appStartEndData?.timestampMs || timestampInSeconds() * 1000;\n _setAppStartEndData({\n timestampMs: currentTimestamp,\n endFrames,\n });\n } catch (error) {\n debug.log('[AppStart] Failed to capture frames for standalone app start.', error);\n }\n }\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n debug.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction of the app run\n return;\n }\n\n if (!firstStartedActiveRootSpanId) {\n debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');\n return;\n }\n\n if (!event.contexts?.trace) {\n debug.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {\n debug.warn(\n '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.',\n );\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n debug.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n return;\n }\n if (appStart.has_fetched) {\n debug.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n debug.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartEndTimestampMs = appStartEndData?.timestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n debug.warn(\n '[AppStart] Javascript failed to record app start end. `_setAppStartEndData` was not called nor could the bundle start be found.',\n );\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n debug.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n debug.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n if (appStartDurationMs < 0) {\n // This can happen when MainActivity on Android is recreated,\n // and the app start end timestamp is not updated, for example\n // due to missing `Sentry.wrap(RootComponent)` call.\n debug.warn(\n '[AppStart] Last recorded app start end timestamp is before the app start timestamp.',\n 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.',\n );\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n debug.log(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold Start' : 'Warm Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n\n if (appStartEndData?.endFrames) {\n attachFrameDataToSpan(appStartSpanJSON, appStartEndData.endFrames);\n }\n\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n debug.log('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n debug.log(\n '[AppStart] Added app start measurement to transaction event.',\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n setFirstStartedActiveRootSpanId,\n } as AppStartIntegration;\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n debug.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000;\n if (bundleStartTimestampSeconds < parentSpan.start_timestamp) {\n debug.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.');\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n debug.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: bundleStartTimestampSeconds,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans\n .filter(span => span.start_timestamp_ms / 1000 >= parentSpan.start_timestamp)\n .map(span => {\n if (span.description === 'UIKit init') {\n return setMainThreadInfo(createUIKitSpan(parentSpan, span));\n }\n\n return setMainThreadInfo(\n createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n }),\n );\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gCAAgC,EAChC,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,cAAc,IAAI,0BAA0B,EAC5C,cAAc,IAAI,0BAA0B,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;YAC7B,eAAe,EAAE,IAAI,CAAC,kBAAkB,GAAG,IAAI;YAC/C,SAAS,EAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI;YACvC,MAAM,EAAE,0BAA0B;SACnC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,UAAoB,EAAE,eAAwD;IACrG,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD,iFAAiF;IACjF,yCAAyC;IACzC,6DAA6D;IAC7D,IAAI,WAAW,IAAI,WAAW,GAAG,eAAe,CAAC,gBAAgB,EAAE;QACjE,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,6BAA6B;YAC1C,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,WAAW,GAAG,IAAI;YAC7B,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,YAAY;YACzB,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["/* eslint-disable complexity, max-lines */\nimport type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core';\nimport {\n debug,\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\nimport { getAppRegistryIntegration } from '../../integrations/appRegistry';\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse, NativeFramesResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { setMainThreadInfo } from '../span';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\n\n/**\n * We filter out app start more than 60s.\n * This could be due to many different reasons.\n * We've seen app starts with hours, days and even months.\n */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\ninterface AppStartEndData {\n timestampMs: number;\n endFrames: NativeFramesResponse | null;\n}\n\nlet appStartEndData: AppStartEndData | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n const client = getClient();\n if (!client) {\n debug.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n\n const timestampMs = timestampInSeconds() * 1000;\n let endFrames: NativeFramesResponse | null = null;\n\n if (NATIVE.enableNative) {\n try {\n endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for app start.', endFrames);\n } catch (error) {\n debug.log('[AppStart] Failed to capture end frames for app start.', error);\n }\n }\n\n _setAppStartEndData({\n timestampMs,\n endFrames,\n });\n\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n appStartEndData?.timestampMs && debug.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && debug.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndData = (data: AppStartEndData): void => {\n appStartEndData && debug.warn('Overwriting already set app start end data.');\n appStartEndData = data;\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Attaches frame data to a span's data object.\n */\nfunction attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): void {\n if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.totalFrames <= 0) {\n debug.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`);\n return;\n }\n span.data = span.data || {};\n span.data['frames.total'] = frames.totalFrames;\n span.data['frames.slow'] = frames.slowFrames;\n span.data['frames.frozen'] = frames.frozenFrames;\n\n debug.log('[AppStart] Attached frame data to span.', {\n spanId: span.span_id,\n frameData: {\n total: frames.totalFrames,\n slow: frames.slowFrames,\n frozen: frames.frozenFrames,\n },\n });\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n let afterAllSetupCalled = false;\n let firstStartedActiveRootSpanId: string | undefined = undefined;\n\n const setup = (client: Client): void => {\n _client = client;\n const { enableAppStartTracking } = client.getOptions() as ReactNativeClientOptions;\n\n if (!enableAppStartTracking) {\n isEnabled = false;\n debug.warn('[AppStart] App start tracking is disabled.');\n }\n\n client.on('spanStart', recordFirstStartedActiveRootSpanId);\n };\n\n const afterAllSetup = (client: Client): void => {\n if (afterAllSetupCalled) {\n return;\n }\n afterAllSetupCalled = true;\n\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (appStartDataFlushed) {\n debug.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.');\n appStartDataFlushed = false;\n firstStartedActiveRootSpanId = undefined;\n } else {\n debug.log(\n '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.',\n );\n }\n });\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n const recordFirstStartedActiveRootSpanId = (rootSpan: Span): void => {\n if (firstStartedActiveRootSpanId) {\n return;\n }\n\n if (!isRootSpan(rootSpan)) {\n return;\n }\n\n setFirstStartedActiveRootSpanId(rootSpan.spanContext().spanId);\n };\n\n /**\n * For testing purposes only.\n * @private\n */\n const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => {\n firstStartedActiveRootSpanId = spanId;\n debug.log('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId);\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!_client) {\n // If client is not set, SDK was not initialized, logger is thus disabled\n // eslint-disable-next-line no-console\n console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');\n return;\n }\n\n if (!standalone) {\n debug.log(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n debug.log('[AppStart] App start tracking standalone root span (transaction).');\n\n if (!appStartEndData?.endFrames && NATIVE.enableNative) {\n try {\n const endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for standalone app start.', endFrames);\n\n const currentTimestamp = appStartEndData?.timestampMs || timestampInSeconds() * 1000;\n _setAppStartEndData({\n timestampMs: currentTimestamp,\n endFrames,\n });\n } catch (error) {\n debug.log('[AppStart] Failed to capture frames for standalone app start.', error);\n }\n }\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n debug.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction of the app run\n return;\n }\n\n if (!event.contexts?.trace) {\n debug.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n // When standalone is true, we create our own transaction and don't need to verify\n // it matches the first navigation transaction. When standalone is false, we need to\n // ensure we're attaching app start to the first transaction (not a later one).\n if (!standalone) {\n if (!firstStartedActiveRootSpanId) {\n debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');\n return;\n }\n\n if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {\n debug.warn(\n '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.',\n );\n return;\n }\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n debug.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n return;\n }\n if (appStart.has_fetched) {\n debug.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n debug.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartEndTimestampMs = appStartEndData?.timestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n debug.warn(\n '[AppStart] Javascript failed to record app start end. `_setAppStartEndData` was not called nor could the bundle start be found.',\n );\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n debug.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n debug.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n if (appStartDurationMs < 0) {\n // This can happen when MainActivity on Android is recreated,\n // and the app start end timestamp is not updated, for example\n // due to missing `Sentry.wrap(RootComponent)` call.\n debug.warn(\n '[AppStart] Last recorded app start end timestamp is before the app start timestamp.',\n 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.',\n );\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n debug.log(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold Start' : 'Warm Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n\n if (appStartEndData?.endFrames) {\n attachFrameDataToSpan(appStartSpanJSON, appStartEndData.endFrames);\n }\n\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n debug.log('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n debug.log(\n '[AppStart] Added app start measurement to transaction event.',\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n setFirstStartedActiveRootSpanId,\n } as AppStartIntegration;\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n debug.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000;\n if (bundleStartTimestampSeconds < parentSpan.start_timestamp) {\n debug.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.');\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n debug.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: bundleStartTimestampSeconds,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans\n .filter(span => span.start_timestamp_ms / 1000 >= parentSpan.start_timestamp)\n .map(span => {\n if (span.description === 'UIKit init') {\n return setMainThreadInfo(createUIKitSpan(parentSpan, span));\n }\n\n return setMainThreadInfo(\n createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n }),\n );\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '7.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '7.9.0';\n"]}
|
package/dist/js/wrapper.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Breadcrumb, Envelope, EnvelopeItem, Event, Package, Primitive, SeverityLevel, User } from '@sentry/core';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import type { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFramesResponse, NativeReleaseResponse, NativeStackFrames, Spec } from './NativeRNSentry';
|
|
4
|
-
import type { ReactNativeClientOptions } from './options';
|
|
4
|
+
import type { AndroidProfilingOptions, ReactNativeClientOptions } from './options';
|
|
5
5
|
import type * as Hermes from './profiling/hermes';
|
|
6
6
|
import type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';
|
|
7
7
|
import type { MobileReplayOptions } from './replay/mobilereplay';
|
|
@@ -21,6 +21,7 @@ export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
|
|
|
21
21
|
ignoreErrorsRegex?: string[] | undefined;
|
|
22
22
|
} & {
|
|
23
23
|
mobileReplayOptions: MobileReplayOptions | undefined;
|
|
24
|
+
androidProfilingOptions?: AndroidProfilingOptions | undefined;
|
|
24
25
|
};
|
|
25
26
|
interface SentryNativeWrapper {
|
|
26
27
|
enableNative: boolean;
|
package/dist/js/wrapper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,SAAS,EACT,aAAa,EACb,IAAI,EACL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EAErB,iBAAiB,EACjB,IAAI,EACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,SAAS,EACT,aAAa,EACb,IAAI,EACL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EACV,sBAAs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AC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACxD,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IAErE,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEzD,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;CAC9C;AAID;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,mBAiwBpB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAE5E"}
|
package/dist/js/wrapper.js
CHANGED
|
@@ -155,8 +155,12 @@ export const NATIVE = {
|
|
|
155
155
|
}
|
|
156
156
|
// filter out all the options that would crash native.
|
|
157
157
|
/* eslint-disable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */
|
|
158
|
-
const { beforeSend, beforeBreadcrumb, beforeSendTransaction, beforeSendMetric, integrations, ignoreErrors, logsOrigin } = options, filteredOptions = __rest(options, ["beforeSend", "beforeBreadcrumb", "beforeSendTransaction", "beforeSendMetric", "integrations", "ignoreErrors", "logsOrigin"]);
|
|
158
|
+
const { beforeSend, beforeBreadcrumb, beforeSendTransaction, beforeSendMetric, integrations, ignoreErrors, logsOrigin, androidProfilingOptions } = options, filteredOptions = __rest(options, ["beforeSend", "beforeBreadcrumb", "beforeSendTransaction", "beforeSendMetric", "integrations", "ignoreErrors", "logsOrigin", "androidProfilingOptions"]);
|
|
159
159
|
/* eslint-enable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */
|
|
160
|
+
// Move androidProfilingOptions into _experiments
|
|
161
|
+
if (androidProfilingOptions) {
|
|
162
|
+
filteredOptions._experiments = Object.assign(Object.assign({}, filteredOptions._experiments), { androidProfilingOptions });
|
|
163
|
+
}
|
|
160
164
|
const nativeIsReady = yield RNSentry.initNativeSdk(filteredOptions);
|
|
161
165
|
this.nativeIsReady = nativeIsReady;
|
|
162
166
|
this.enableNative = true;
|