@sentry/react-native 6.10.0 → 6.11.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/src/main/java/io/sentry/react/RNSentryModuleImpl.java +43 -21
- package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +82 -51
- package/android/src/main/java/io/sentry/react/RNSentryTimeToDisplay.java +37 -0
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +16 -6
- package/dist/js/NativeRNSentry.d.ts +2 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/index.d.ts +1 -1
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/appRegistry.d.ts +8 -0
- package/dist/js/integrations/appRegistry.d.ts.map +1 -0
- package/dist/js/integrations/appRegistry.js +43 -0
- package/dist/js/integrations/appRegistry.js.map +1 -0
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +5 -1
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +2 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +2 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js +2 -3
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/nativeTypes.d.ts +1 -1
- package/dist/js/profiling/nativeTypes.d.ts.map +1 -1
- package/dist/js/profiling/nativeTypes.js.map +1 -1
- package/dist/js/replay/CustomMask.d.ts.map +1 -1
- package/dist/js/replay/CustomMask.js +3 -2
- package/dist/js/replay/CustomMask.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +38 -7
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts +4 -0
- package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -0
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js +193 -0
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -0
- package/dist/js/tracing/ops.d.ts +2 -0
- package/dist/js/tracing/ops.d.ts.map +1 -1
- package/dist/js/tracing/ops.js +2 -0
- package/dist/js/tracing/ops.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +12 -1
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +20 -2
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +68 -40
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/semanticAttributes.d.ts +2 -0
- package/dist/js/tracing/semanticAttributes.d.ts.map +1 -1
- package/dist/js/tracing/semanticAttributes.js +2 -0
- package/dist/js/tracing/semanticAttributes.js.map +1 -1
- package/dist/js/tracing/timeToDisplayFallback.d.ts +3 -0
- package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -0
- package/dist/js/tracing/timeToDisplayFallback.js +21 -0
- package/dist/js/tracing/timeToDisplayFallback.js.map +1 -0
- package/dist/js/tracing/timetodisplay.d.ts +29 -0
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +43 -20
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplaynative.js +2 -1
- package/dist/js/tracing/timetodisplaynative.js.map +1 -1
- package/dist/js/tracing/timetodisplaynative.types.d.ts +1 -3
- package/dist/js/tracing/timetodisplaynative.types.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplaynative.types.js.map +1 -1
- package/dist/js/utils/rnlibraries.d.ts +1 -1
- package/dist/js/utils/rnlibraries.d.ts.map +1 -1
- package/dist/js/utils/rnlibraries.js +5 -3
- package/dist/js/utils/rnlibraries.js.map +1 -1
- package/dist/js/utils/rnlibrariesinterface.d.ts +1 -0
- package/dist/js/utils/rnlibrariesinterface.d.ts.map +1 -1
- package/dist/js/utils/rnlibrariesinterface.js.map +1 -1
- package/dist/js/vendor/react-native/index.d.ts +3 -0
- package/dist/js/vendor/react-native/index.d.ts.map +1 -1
- package/dist/js/vendor/react-native/index.js.map +1 -1
- package/dist/js/vendor/react-navigation/types.d.ts +27 -0
- package/dist/js/vendor/react-navigation/types.d.ts.map +1 -0
- package/dist/js/vendor/react-navigation/types.js +3 -0
- package/dist/js/vendor/react-navigation/types.js.map +1 -0
- 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 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +24 -0
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +15 -6
- package/ios/RNSentryFramesTrackerListener.h +7 -3
- package/ios/RNSentryOnDrawReporter.h +6 -2
- package/ios/RNSentryOnDrawReporter.m +47 -20
- package/ios/RNSentryTimeToDisplay.h +7 -0
- package/ios/RNSentryTimeToDisplay.m +69 -2
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +4 -4
- package/scripts/sentry-xcode-debug-files.sh +1 -4
- package/scripts/sentry-xcode.sh +6 -4
- package/sentry.gradle +4 -2
- package/src/js/NativeRNSentry.ts +2 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
- package/ts3.8/dist/js/index.d.ts +1 -1
- package/ts3.8/dist/js/integrations/appRegistry.d.ts +8 -0
- package/ts3.8/dist/js/integrations/exports.d.ts +2 -0
- package/ts3.8/dist/js/profiling/nativeTypes.d.ts +1 -1
- package/ts3.8/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts +4 -0
- package/ts3.8/dist/js/tracing/ops.d.ts +2 -0
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +20 -2
- package/ts3.8/dist/js/tracing/semanticAttributes.d.ts +2 -0
- package/ts3.8/dist/js/tracing/timeToDisplayFallback.d.ts +3 -0
- package/ts3.8/dist/js/tracing/timetodisplay.d.ts +29 -0
- package/ts3.8/dist/js/tracing/timetodisplaynative.types.d.ts +1 -3
- package/ts3.8/dist/js/utils/rnlibraries.d.ts +1 -1
- package/ts3.8/dist/js/utils/rnlibrariesinterface.d.ts +1 -0
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +3 -0
- package/ts3.8/dist/js/vendor/react-navigation/types.d.ts +27 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +2 -0
- package/dist/js/utils/sentryeventemitter.d.ts +0 -24
- package/dist/js/utils/sentryeventemitter.d.ts.map +0 -1
- package/dist/js/utils/sentryeventemitter.js +0 -82
- package/dist/js/utils/sentryeventemitter.js.map +0 -1
- package/dist/js/utils/sentryeventemitterfallback.d.ts +0 -19
- package/dist/js/utils/sentryeventemitterfallback.d.ts.map +0 -1
- package/dist/js/utils/sentryeventemitterfallback.js +0 -78
- package/dist/js/utils/sentryeventemitterfallback.js.map +0 -1
- package/ts3.8/dist/js/utils/sentryeventemitter.d.ts +0 -24
- package/ts3.8/dist/js/utils/sentryeventemitterfallback.d.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,aAAa,EACb,MAAM,EACN,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBA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e,CAAC,MAAM,GAAG,2BAA2B,CAAC,CAAC;SAC/F;IACH,CAAC,CAAC;IAEF,wEAAwE;IACxE,MAAM,yBAAyB,GAAG,GAAS,EAAE;QAC3C,IAAI,oBAAoB,EAAE;YACxB,IAAI,YAAY,CAAC,oBAAoB,CAAC,EAAE;gBACtC,oBAAoB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC;aAC1C;YACD,qCAAqC;YACrC,oBAAoB,CAAC,GAAG,EAAE,CAAC;YAC3B,oBAAoB,GAAG,SAAS,CAAC;SAClC;QACD,IAAI,wBAAwB,EAAE;YAC5B,wBAAwB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC,CAAC;IAEF,MAAM,uBAAuB,GAAG,GAAS,EAAE;QACzC,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;YAC7C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;SAChC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;QACb,2BAA2B;KAC5B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, Integration, Span } from '@sentry/core';\nimport {\n addBreadcrumb,\n getActiveSpan,\n getClient,\n isPlainObject,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\n\nimport type { NewFrameEvent } from '../utils/sentryeventemitter';\nimport type { SentryEventEmitterFallback } from '../utils/sentryeventemitterfallback';\nimport { createSentryFallbackEventEmitter } from '../utils/sentryeventemitterfallback';\nimport { isSentrySpan } from '../utils/span';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport { ignoreEmptyBackNavigation } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport { setSpanDurationAsMeasurementOnSpan } from './utils';\nexport const INTEGRATION_NAME = 'ReactNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\ninterface ReactNavigationIntegrationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * @default true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n}\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNavigationIntegration = ({\n routeChangeTimeoutMs = 1_000,\n enableTimeToInitialDisplay = false,\n ignoreEmptyBackNavigationTransactions = true,\n}: Partial<ReactNavigationIntegrationOptions> = {}): Integration & {\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n registerNavigationContainer: (navigationContainerRef: unknown) => void;\n} => {\n let navigationContainer: NavigationContainer | undefined;\n let newScreenFrameEventEmitter: SentryEventEmitterFallback | undefined;\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n let latestRoute: NavigationRoute | undefined;\n\n let latestNavigationSpan: Span | undefined;\n let navigationProcessingSpan: Span | undefined;\n\n let initialStateHandled: boolean = false;\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let recentRouteKeys: string[] = [];\n\n if (enableTimeToInitialDisplay) {\n newScreenFrameEventEmitter = createSentryFallbackEventEmitter();\n newScreenFrameEventEmitter.initAsync();\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n\n /**\n * Set the initial state and start initial navigation span for the current screen.\n */\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n\n if (initialStateHandled) {\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n return undefined;\n }\n\n startIdleNavigationSpan();\n\n if (!navigationContainer) {\n // This is expected as navigation container is registered after the root component is mounted.\n return undefined;\n }\n\n // Navigation container already registered, just populate with route state\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n const registerNavigationContainer = (navigationContainerRef: unknown): void => {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n logger.log(\n `${INTEGRATION_NAME} Instrumentation already exists, but register has been called again, doing nothing.`,\n );\n return undefined;\n }\n\n if (isPlainObject(navigationContainerRef) && 'current' in navigationContainerRef) {\n navigationContainer = navigationContainerRef.current as NavigationContainer;\n } else {\n navigationContainer = navigationContainerRef as NavigationContainer;\n }\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);\n return undefined;\n }\n\n // This action is emitted on every dispatch\n navigationContainer.addListener('__unsafe_action__', startIdleNavigationSpan);\n navigationContainer.addListener('state', updateLatestNavigationSpanWithCurrentRoute);\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n\n if (initialStateHandled) {\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} Navigation container registered, but integration has not been setup yet.`);\n return undefined;\n }\n\n // Navigation Container is registered after the first navigation\n // Initial navigation span was started, after integration setup,\n // so now we populate it with the current route.\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see updateLatestNavigationSpanWithCurrentRoute\n */\n const startIdleNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`);\n _discardLatestTransaction();\n clearStateChangeTimeout();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing && tracing.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n idleSpanOptions,\n );\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n\n if (enableTimeToInitialDisplay) {\n navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation dispatch to navigation cancelled or screen mounted',\n startTime: latestNavigationSpan && spanToJSON(latestNavigationSpan).start_timestamp,\n });\n navigationProcessingSpan.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION,\n );\n }\n\n stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);\n };\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n const updateLatestNavigationSpanWithCurrentRoute = (): void => {\n const stateChangedTimestamp = timestampInSeconds();\n const previousRoute = latestRoute;\n\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`);\n return undefined;\n }\n\n const route = navigationContainer.getCurrentRoute();\n if (!route) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`);\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.debug(\n `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`,\n );\n return undefined;\n }\n\n if (previousRoute && previousRoute.key === route.key) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);\n pushRecentRouteKey(route.key);\n latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n return undefined;\n }\n\n const routeHasBeenSeen = recentRouteKeys.includes(route.key);\n const latestTtidSpan =\n !routeHasBeenSeen &&\n enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n const navigationSpanWithTtid = latestNavigationSpan;\n if (!routeHasBeenSeen && latestTtidSpan) {\n newScreenFrameEventEmitter?.onceNewFrame(({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn('[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.');\n return;\n }\n\n latestTtidSpan.setStatus({ code: SPAN_STATUS_OK });\n latestTtidSpan.end(newFrameTimestampInSeconds);\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', latestTtidSpan, navigationSpanWithTtid);\n });\n }\n\n navigationProcessingSpan?.updateName(`Navigation dispatch to screen ${route.name} mounted`);\n navigationProcessingSpan?.setStatus({ code: SPAN_STATUS_OK });\n navigationProcessingSpan?.end(stateChangedTimestamp);\n navigationProcessingSpan = undefined;\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(route.name);\n }\n latestNavigationSpan.setAttributes({\n 'route.name': route.name,\n 'route.key': route.key,\n // TODO: filter PII params instead of dropping them all\n // 'route.params': {},\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': previousRoute?.name,\n 'previous_route.key': previousRoute?.key,\n // TODO: filter PII params instead of dropping them all\n // 'previous_route.params': {},\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n // Clear the timeout so the transaction does not get cancelled.\n clearStateChangeTimeout();\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${route.name}`,\n data: {\n from: previousRoute?.name,\n to: route.name,\n },\n });\n\n tracing?.setCurrentRoute(route.name);\n\n pushRecentRouteKey(route.key);\n latestRoute = route;\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n };\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n const pushRecentRouteKey = (key: string): void => {\n recentRouteKeys.push(key);\n\n if (recentRouteKeys.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentRouteKeys = recentRouteKeys.slice(recentRouteKeys.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n const _discardLatestTransaction = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n if (navigationProcessingSpan) {\n navigationProcessingSpan = undefined;\n }\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n registerNavigationContainer,\n };\n};\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: () => void) => void;\n getCurrentRoute: () => NavigationRoute;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,MAAM,EACN,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,yCAAyC,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,mCAAmC,EACnC,uBAAuB,IAAI,8BAA8B,GAC1D,MAAM,QAAQ,CAAC;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Ae,CAAC,MAAM,GAAG,2BAA2B,CAAC,CAAC;SAC/F;IACH,CAAC,CAAC;IAEF,wEAAwE;IACxE,MAAM,yBAAyB,GAAG,GAAS,EAAE;QAC3C,IAAI,oBAAoB,EAAE;YACxB,IAAI,YAAY,CAAC,oBAAoB,CAAC,EAAE;gBACtC,oBAAoB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC;aAC1C;YACD,qCAAqC;YACrC,oBAAoB,CAAC,GAAG,EAAE,CAAC;YAC3B,oBAAoB,GAAG,SAAS,CAAC;SAClC;QACD,IAAI,wBAAwB,EAAE;YAC5B,wBAAwB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC,CAAC;IAEF,MAAM,uBAAuB,GAAG,GAAS,EAAE;QACzC,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;YAC7C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;SAChC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;QACb,2BAA2B;QAC3B,OAAO,EAAE;YACP,oBAAoB;YACpB,0BAA0B;YAC1B,qCAAqC;YACrC,4CAA4C;YAC5C,uBAAuB;SACxB;KACF,CAAC;AACJ,CAAC,CAAC;AAcF;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAc;IAEd,OAAO,MAAM,CAAC,oBAAoB,CAAgD,gBAAgB,CAAC,CAAC;AACtG,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, Integration, Span } from '@sentry/core';\nimport {\n addBreadcrumb,\n getClient,\n isPlainObject,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\n\nimport { getAppRegistryIntegration } from '../integrations/appRegistry';\nimport { isSentrySpan } from '../utils/span';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { UnsafeAction } from '../vendor/react-navigation/types';\nimport { NATIVE } from '../wrapper';\nimport { ignoreEmptyBackNavigation } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport { SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\nimport { addTimeToInitialDisplayFallback } from './timeToDisplayFallback';\nexport const INTEGRATION_NAME = 'ReactNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\ninterface ReactNavigationIntegrationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * @default true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * Enabled measuring Time to Initial Display for routes that are already loaded in memory.\n * (a.k.a., Routes that the navigation integration has already seen.)\n *\n * @default false\n */\n enableTimeToInitialDisplayForPreloadedRoutes: boolean;\n\n /**\n * Whether to use the dispatched action data to populate the transaction metadata.\n *\n * @default false\n */\n useDispatchedActionData: boolean;\n}\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNavigationIntegration = ({\n routeChangeTimeoutMs = 1_000,\n enableTimeToInitialDisplay = false,\n ignoreEmptyBackNavigationTransactions = true,\n enableTimeToInitialDisplayForPreloadedRoutes = false,\n useDispatchedActionData = false,\n}: Partial<ReactNavigationIntegrationOptions> = {}): Integration & {\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n registerNavigationContainer: (navigationContainerRef: unknown) => void;\n options: ReactNavigationIntegrationOptions;\n} => {\n let navigationContainer: NavigationContainer | undefined;\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n let latestRoute: NavigationRoute | undefined;\n\n let latestNavigationSpan: Span | undefined;\n let navigationProcessingSpan: Span | undefined;\n\n let initialStateHandled: boolean = false;\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let recentRouteKeys: string[] = [];\n\n if (enableTimeToInitialDisplay) {\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n\n /**\n * Set the initial state and start initial navigation span for the current screen.\n */\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n\n if (initialStateHandled) {\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n // This assumes that the Sentry.init() call is made before the first route mounts.\n // If this is not the case, the first transaction will be nameless 'Route Changed'\n return undefined;\n }\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (initialStateHandled) {\n // To avoid conflict with the initial transaction we check if it was already handled.\n // This ensures runApplication calls after the initial start are correctly traced.\n // This is used for example when Activity is (re)started on Android.\n logger.log('[ReactNavigationIntegration] Starting new idle navigation span based on runApplication call.');\n startIdleNavigationSpan();\n }\n });\n\n startIdleNavigationSpan();\n\n if (!navigationContainer) {\n // This is expected as navigation container is registered after the root component is mounted.\n return undefined;\n }\n\n // Navigation container already registered, just populate with route state\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n const registerNavigationContainer = (maybeNewNavigationContainer: unknown): void => {\n if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n logger.debug(`${INTEGRATION_NAME} Instrumentation already exists, but registering again...`);\n // In the past we have not allowed re-registering the navigation container to avoid unexpected behavior.\n // But this doesn't work for Android and re-recreating application main activity.\n // Where new navigation container is created and the old one is discarded. We need to re-register to\n // trace the new navigation container navigation.\n }\n\n let newNavigationContainer: NavigationContainer | undefined;\n if (isPlainObject(maybeNewNavigationContainer) && 'current' in maybeNewNavigationContainer) {\n newNavigationContainer = maybeNewNavigationContainer.current as NavigationContainer;\n } else {\n newNavigationContainer = maybeNewNavigationContainer as NavigationContainer;\n }\n\n if (navigationContainer === newNavigationContainer) {\n logger.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`);\n return;\n }\n navigationContainer = newNavigationContainer as NavigationContainer;\n\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);\n return undefined;\n }\n\n // This action is emitted on every dispatch\n navigationContainer.addListener('__unsafe_action__', startIdleNavigationSpan);\n navigationContainer.addListener('state', updateLatestNavigationSpanWithCurrentRoute);\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n\n if (initialStateHandled) {\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} Navigation container registered, but integration has not been setup yet.`);\n return undefined;\n }\n\n // Navigation Container is registered after the first navigation\n // Initial navigation span was started, after integration setup,\n // so now we populate it with the current route.\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see updateLatestNavigationSpanWithCurrentRoute\n */\n const startIdleNavigationSpan = (unknownEvent?: unknown): void => {\n const event = unknownEvent as UnsafeAction | undefined;\n if (useDispatchedActionData && event?.data.noop) {\n logger.debug(`${INTEGRATION_NAME} Navigation action is a noop, not starting navigation span.`);\n return;\n }\n\n const navigationActionType = useDispatchedActionData ? event?.data.action.type : undefined;\n if (\n useDispatchedActionData &&\n [\n // Process common actions\n 'PRELOAD',\n 'SET_PARAMS',\n // Drawer actions\n 'OPEN_DRAWER',\n 'CLOSE_DRAWER',\n 'TOGGLE_DRAWER',\n ].includes(navigationActionType)\n ) {\n logger.debug(`${INTEGRATION_NAME} Navigation action is ${navigationActionType}, not starting navigation span.`);\n return;\n }\n\n if (latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`);\n _discardLatestTransaction();\n clearStateChangeTimeout();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing && tracing.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n idleSpanOptions,\n );\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, navigationActionType);\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n\n if (enableTimeToInitialDisplay) {\n NATIVE.setActiveSpanId(latestNavigationSpan?.spanContext().spanId);\n navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation dispatch to navigation cancelled or screen mounted',\n startTime: latestNavigationSpan && spanToJSON(latestNavigationSpan).start_timestamp,\n });\n navigationProcessingSpan.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION,\n );\n }\n\n stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);\n };\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n const updateLatestNavigationSpanWithCurrentRoute = (): void => {\n const stateChangedTimestamp = timestampInSeconds();\n const previousRoute = latestRoute;\n\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`);\n return undefined;\n }\n\n const route = navigationContainer.getCurrentRoute();\n if (!route) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`);\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.debug(\n `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`,\n );\n return undefined;\n }\n\n addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay());\n\n if (previousRoute && previousRoute.key === route.key) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);\n pushRecentRouteKey(route.key);\n latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n return undefined;\n }\n\n const routeHasBeenSeen = recentRouteKeys.includes(route.key);\n\n navigationProcessingSpan?.updateName(`Navigation dispatch to screen ${route.name} mounted`);\n navigationProcessingSpan?.setStatus({ code: SPAN_STATUS_OK });\n navigationProcessingSpan?.end(stateChangedTimestamp);\n navigationProcessingSpan = undefined;\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(route.name);\n }\n latestNavigationSpan.setAttributes({\n 'route.name': route.name,\n 'route.key': route.key,\n // TODO: filter PII params instead of dropping them all\n // 'route.params': {},\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': previousRoute?.name,\n 'previous_route.key': previousRoute?.key,\n // TODO: filter PII params instead of dropping them all\n // 'previous_route.params': {},\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n // Clear the timeout so the transaction does not get cancelled.\n clearStateChangeTimeout();\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${route.name}`,\n data: {\n from: previousRoute?.name,\n to: route.name,\n },\n });\n\n tracing?.setCurrentRoute(route.name);\n\n pushRecentRouteKey(route.key);\n latestRoute = route;\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n };\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n const pushRecentRouteKey = (key: string): void => {\n recentRouteKeys.push(key);\n\n if (recentRouteKeys.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentRouteKeys = recentRouteKeys.slice(recentRouteKeys.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n const _discardLatestTransaction = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n if (navigationProcessingSpan) {\n navigationProcessingSpan = undefined;\n }\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n registerNavigationContainer,\n options: {\n routeChangeTimeoutMs,\n enableTimeToInitialDisplay,\n ignoreEmptyBackNavigationTransactions,\n enableTimeToInitialDisplayForPreloadedRoutes,\n useDispatchedActionData,\n },\n };\n};\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: (event?: unknown) => void) => void;\n getCurrentRoute: () => NavigationRoute;\n}\n\n/**\n * Returns React Navigation integration of the given client.\n */\nexport function getReactNavigationIntegration(\n client: Client,\n): ReturnType<typeof reactNavigationIntegration> | undefined {\n return client.getIntegrationByName<ReturnType<typeof reactNavigationIntegration>>(INTEGRATION_NAME);\n}\n"]}
|
|
@@ -9,4 +9,6 @@ export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_NAME = "previous_route.na
|
|
|
9
9
|
export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_KEY = "previous_route.key";
|
|
10
10
|
export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_ID = "previous_route.component_id";
|
|
11
11
|
export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_TYPE = "previous_route.component_type";
|
|
12
|
+
export declare const SEMANTIC_ATTRIBUTE_TIME_TO_INITIAL_DISPLAY_FALLBACK = "route.initial_display_fallback";
|
|
13
|
+
export declare const SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE = "navigation.action_type";
|
|
12
14
|
//# sourceMappingURL=semanticAttributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticAttributes.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/semanticAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,4BAA4B,EAC5B,qCAAqC,EACrC,iDAAiD,GAClD,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,0CAA0C,4BAA4B,CAAC;AACpF,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAC1D,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,qCAAqC,uBAAuB,CAAC;AAC1E,eAAO,MAAM,uCAAuC,yBAAyB,CAAC;AAC9E,eAAO,MAAM,sCAAsC,wBAAwB,CAAC;AAC5E,eAAO,MAAM,sCAAsC,wBAAwB,CAAC;AAC5E,eAAO,MAAM,qCAAqC,uBAAuB,CAAC;AAC1E,eAAO,MAAM,8CAA8C,gCAAgC,CAAC;AAC5F,eAAO,MAAM,gDAAgD,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"semanticAttributes.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/semanticAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,4BAA4B,EAC5B,qCAAqC,EACrC,iDAAiD,GAClD,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,0CAA0C,4BAA4B,CAAC;AACpF,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAC1D,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,qCAAqC,uBAAuB,CAAC;AAC1E,eAAO,MAAM,uCAAuC,yBAAyB,CAAC;AAC9E,eAAO,MAAM,sCAAsC,wBAAwB,CAAC;AAC5E,eAAO,MAAM,sCAAsC,wBAAwB,CAAC;AAC5E,eAAO,MAAM,qCAAqC,uBAAuB,CAAC;AAC1E,eAAO,MAAM,8CAA8C,gCAAgC,CAAC;AAC5F,eAAO,MAAM,gDAAgD,kCAAkC,CAAC;AAChG,eAAO,MAAM,mDAAmD,mCAAmC,CAAC;AACpG,eAAO,MAAM,yCAAyC,2BAA2B,CAAC"}
|
|
@@ -9,4 +9,6 @@ export const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_NAME = 'previous_route.name';
|
|
|
9
9
|
export const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_KEY = 'previous_route.key';
|
|
10
10
|
export const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_ID = 'previous_route.component_id';
|
|
11
11
|
export const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_TYPE = 'previous_route.component_type';
|
|
12
|
+
export const SEMANTIC_ATTRIBUTE_TIME_TO_INITIAL_DISPLAY_FALLBACK = 'route.initial_display_fallback';
|
|
13
|
+
export const SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE = 'navigation.action_type';
|
|
12
14
|
//# sourceMappingURL=semanticAttributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticAttributes.js","sourceRoot":"","sources":["../../../src/js/tracing/semanticAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,4BAA4B,EAC5B,qCAAqC,EACrC,iDAAiD,GAClD,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,0CAA0C,GAAG,yBAAyB,CAAC;AACpF,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CAAC;AAC1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,WAAW,CAAC;AACxD,MAAM,CAAC,MAAM,qCAAqC,GAAG,oBAAoB,CAAC;AAC1E,MAAM,CAAC,MAAM,uCAAuC,GAAG,sBAAsB,CAAC;AAC9E,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC;AAC5E,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC;AAC5E,MAAM,CAAC,MAAM,qCAAqC,GAAG,oBAAoB,CAAC;AAC1E,MAAM,CAAC,MAAM,8CAA8C,GAAG,6BAA6B,CAAC;AAC5F,MAAM,CAAC,MAAM,gDAAgD,GAAG,+BAA+B,CAAC","sourcesContent":["export {\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,\n SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON,\n} from '@sentry/core';\n\nexport const SEMANTIC_ATTRIBUTE_ROUTING_INSTRUMENTATION = 'routing.instrumentation';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_NAME = 'route.name';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_KEY = 'route.key';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_COMPONENT_ID = 'route.component_id';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_COMPONENT_TYPE = 'route.component_type';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_HAS_BEEN_SEEN = 'route.has_been_seen';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_NAME = 'previous_route.name';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_KEY = 'previous_route.key';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_ID = 'previous_route.component_id';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_TYPE = 'previous_route.component_type';\n"]}
|
|
1
|
+
{"version":3,"file":"semanticAttributes.js","sourceRoot":"","sources":["../../../src/js/tracing/semanticAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,4BAA4B,EAC5B,qCAAqC,EACrC,iDAAiD,GAClD,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,0CAA0C,GAAG,yBAAyB,CAAC;AACpF,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CAAC;AAC1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,WAAW,CAAC;AACxD,MAAM,CAAC,MAAM,qCAAqC,GAAG,oBAAoB,CAAC;AAC1E,MAAM,CAAC,MAAM,uCAAuC,GAAG,sBAAsB,CAAC;AAC9E,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC;AAC5E,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC;AAC5E,MAAM,CAAC,MAAM,qCAAqC,GAAG,oBAAoB,CAAC;AAC1E,MAAM,CAAC,MAAM,8CAA8C,GAAG,6BAA6B,CAAC;AAC5F,MAAM,CAAC,MAAM,gDAAgD,GAAG,+BAA+B,CAAC;AAChG,MAAM,CAAC,MAAM,mDAAmD,GAAG,gCAAgC,CAAC;AACpG,MAAM,CAAC,MAAM,yCAAyC,GAAG,wBAAwB,CAAC","sourcesContent":["export {\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,\n SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON,\n} from '@sentry/core';\n\nexport const SEMANTIC_ATTRIBUTE_ROUTING_INSTRUMENTATION = 'routing.instrumentation';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_NAME = 'route.name';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_KEY = 'route.key';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_COMPONENT_ID = 'route.component_id';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_COMPONENT_TYPE = 'route.component_type';\nexport const SEMANTIC_ATTRIBUTE_ROUTE_HAS_BEEN_SEEN = 'route.has_been_seen';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_NAME = 'previous_route.name';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_KEY = 'previous_route.key';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_ID = 'previous_route.component_id';\nexport const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_TYPE = 'previous_route.component_type';\nexport const SEMANTIC_ATTRIBUTE_TIME_TO_INITIAL_DISPLAY_FALLBACK = 'route.initial_display_fallback';\nexport const SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE = 'navigation.action_type';\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const addTimeToInitialDisplayFallback: (spanId: string, timestampSeconds: Promise<number | undefined | null>) => void;
|
|
2
|
+
export declare const getTimeToInitialDisplayFallback: (spanId: string) => Promise<number | undefined>;
|
|
3
|
+
//# sourceMappingURL=timeToDisplayFallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeToDisplayFallback.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timeToDisplayFallback.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,+BAA+B,WAClC,MAAM,oBACI,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,KACnD,IAEF,CAAC;AAEF,eAAO,MAAM,+BAA+B,WAAkB,MAAM,KAAG,QAAQ,MAAM,GAAG,SAAS,CAEhG,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { AsyncExpiringMap } from '../utils/AsyncExpiringMap';
|
|
11
|
+
const TIME_TO_DISPLAY_FALLBACK_TTL_MS = 60000;
|
|
12
|
+
const spanIdToTimeToInitialDisplayFallback = new AsyncExpiringMap({
|
|
13
|
+
ttl: TIME_TO_DISPLAY_FALLBACK_TTL_MS,
|
|
14
|
+
});
|
|
15
|
+
export const addTimeToInitialDisplayFallback = (spanId, timestampSeconds) => {
|
|
16
|
+
spanIdToTimeToInitialDisplayFallback.set(spanId, timestampSeconds);
|
|
17
|
+
};
|
|
18
|
+
export const getTimeToInitialDisplayFallback = (spanId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
return spanIdToTimeToInitialDisplayFallback.get(spanId);
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=timeToDisplayFallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeToDisplayFallback.js","sourceRoot":"","sources":["../../../src/js/tracing/timeToDisplayFallback.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,+BAA+B,GAAG,KAAM,CAAC;AAE/C,MAAM,oCAAoC,GAAwD,IAAI,gBAAgB,CAAC;IACrH,GAAG,EAAE,+BAA+B;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,MAAc,EACd,gBAAoD,EAC9C,EAAE;IACR,oCAAoC,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAO,MAAc,EAA+B,EAAE;IACnG,OAAO,oCAAoC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAA,CAAC","sourcesContent":["import { AsyncExpiringMap } from '../utils/AsyncExpiringMap';\n\nconst TIME_TO_DISPLAY_FALLBACK_TTL_MS = 60_000;\n\nconst spanIdToTimeToInitialDisplayFallback: AsyncExpiringMap<string, number | undefined | null> = new AsyncExpiringMap({\n ttl: TIME_TO_DISPLAY_FALLBACK_TTL_MS,\n});\n\nexport const addTimeToInitialDisplayFallback = (\n spanId: string,\n timestampSeconds: Promise<number | undefined | null>,\n): void => {\n spanIdToTimeToInitialDisplayFallback.set(spanId, timestampSeconds);\n};\n\nexport const getTimeToInitialDisplayFallback = async (spanId: string): Promise<number | undefined> => {\n return spanIdToTimeToInitialDisplayFallback.get(spanId);\n};\n"]}
|
|
@@ -28,6 +28,8 @@ export declare function TimeToFullDisplay(props: TimeToDisplayProps): React.Reac
|
|
|
28
28
|
* Starts a new span for the initial display.
|
|
29
29
|
*
|
|
30
30
|
* Returns current span if already exists in the currently active span.
|
|
31
|
+
*
|
|
32
|
+
* @deprecated Use `<TimeToInitialDisplay record={boolean}/>` component instead.
|
|
31
33
|
*/
|
|
32
34
|
export declare function startTimeToInitialDisplaySpan(options?: Omit<StartSpanOptions, 'op' | 'name'> & {
|
|
33
35
|
name?: string;
|
|
@@ -37,10 +39,37 @@ export declare function startTimeToInitialDisplaySpan(options?: Omit<StartSpanOp
|
|
|
37
39
|
* Starts a new span for the full display.
|
|
38
40
|
*
|
|
39
41
|
* Returns current span if already exists in the currently active span.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Use `<TimeToFullDisplay record={boolean}/>` component instead.
|
|
40
44
|
*/
|
|
41
45
|
export declare function startTimeToFullDisplaySpan(options?: Omit<StartSpanOptions, 'op' | 'name'> & {
|
|
42
46
|
name?: string;
|
|
43
47
|
timeoutMs?: number;
|
|
44
48
|
isAutoInstrumented?: boolean;
|
|
45
49
|
}): Span | undefined;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export declare function updateInitialDisplaySpan(frameTimestampSeconds: number, { activeSpan, span, }?: {
|
|
54
|
+
activeSpan?: Span;
|
|
55
|
+
/**
|
|
56
|
+
* Time to initial display span to update.
|
|
57
|
+
*/
|
|
58
|
+
span?: Span;
|
|
59
|
+
}): void;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new TimeToFullDisplay component which triggers the full display recording every time the component is focused.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createTimeToFullDisplay({ useFocusEffect, }: {
|
|
64
|
+
/**
|
|
65
|
+
* `@react-navigation/native` useFocusEffect hook.
|
|
66
|
+
*/
|
|
67
|
+
useFocusEffect: (callback: () => void) => void;
|
|
68
|
+
}): React.ComponentType<TimeToDisplayProps>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new TimeToInitialDisplay component which triggers the initial display recording every time the component is focused.
|
|
71
|
+
*/
|
|
72
|
+
export declare function createTimeToInitialDisplay({ useFocusEffect, }: {
|
|
73
|
+
useFocusEffect: (callback: () => void) => void;
|
|
74
|
+
}): React.ComponentType<TimeToDisplayProps>;
|
|
46
75
|
//# sourceMappingURL=timetodisplay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetodisplay.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAC,gBAAgB,EAAG,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAA4B,CAAC;AAOnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAQlF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"timetodisplay.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAC,gBAAgB,EAAG,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAA4B,CAAC;AAOnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,S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cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CAC/C,GAAG,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAE1C"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fill, getActiveSpan, getSpanDescendants, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import { isTurboModuleEnabled } from '../utils/environment';
|
|
4
5
|
import { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin';
|
|
5
6
|
import { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';
|
|
6
|
-
import { setSpanDurationAsMeasurement } from './utils';
|
|
7
|
+
import { setSpanDurationAsMeasurement, setSpanDurationAsMeasurementOnSpan } from './utils';
|
|
7
8
|
let nativeComponentMissingLogged = false;
|
|
8
9
|
/**
|
|
9
10
|
* Flags of active spans with manual initial display.
|
|
@@ -24,9 +25,9 @@ export function TimeToInitialDisplay(props) {
|
|
|
24
25
|
const activeSpan = getActiveSpan();
|
|
25
26
|
if (activeSpan) {
|
|
26
27
|
manualInitialDisplaySpans.set(activeSpan, true);
|
|
27
|
-
startTimeToInitialDisplaySpan();
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;
|
|
30
|
+
return React.createElement(TimeToDisplay, { initialDisplay: props.record, parentSpanId: parentSpanId }, props.children);
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Component to measure time to full display.
|
|
@@ -36,8 +37,9 @@ export function TimeToInitialDisplay(props) {
|
|
|
36
37
|
* <TimeToInitialDisplay record />
|
|
37
38
|
*/
|
|
38
39
|
export function TimeToFullDisplay(props) {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const activeSpan = getActiveSpan();
|
|
41
|
+
const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;
|
|
42
|
+
return React.createElement(TimeToDisplay, { fullDisplay: props.record, parentSpanId: parentSpanId }, props.children);
|
|
41
43
|
}
|
|
42
44
|
function TimeToDisplay(props) {
|
|
43
45
|
const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();
|
|
@@ -49,15 +51,16 @@ function TimeToDisplay(props) {
|
|
|
49
51
|
logger.warn('TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');
|
|
50
52
|
}, 0);
|
|
51
53
|
}
|
|
52
|
-
const onDraw = (event) => onDrawNextFrame(event);
|
|
53
54
|
return (React.createElement(React.Fragment, null,
|
|
54
|
-
React.createElement(RNSentryOnDrawReporter, {
|
|
55
|
+
React.createElement(RNSentryOnDrawReporter, { initialDisplay: props.initialDisplay, fullDisplay: props.fullDisplay, parentSpanId: props.parentSpanId }),
|
|
55
56
|
props.children));
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
58
59
|
* Starts a new span for the initial display.
|
|
59
60
|
*
|
|
60
61
|
* Returns current span if already exists in the currently active span.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Use `<TimeToInitialDisplay record={boolean}/>` component instead.
|
|
61
64
|
*/
|
|
62
65
|
export function startTimeToInitialDisplaySpan(options) {
|
|
63
66
|
const activeSpan = getActiveSpan();
|
|
@@ -87,6 +90,8 @@ export function startTimeToInitialDisplaySpan(options) {
|
|
|
87
90
|
* Starts a new span for the full display.
|
|
88
91
|
*
|
|
89
92
|
* Returns current span if already exists in the currently active span.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated Use `<TimeToFullDisplay record={boolean}/>` component instead.
|
|
90
95
|
*/
|
|
91
96
|
export function startTimeToFullDisplaySpan(options = {
|
|
92
97
|
timeoutMs: 30000,
|
|
@@ -132,22 +137,14 @@ export function startTimeToFullDisplaySpan(options = {
|
|
|
132
137
|
}
|
|
133
138
|
return fullDisplaySpan;
|
|
134
139
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
if (event.nativeEvent.type === 'initialDisplay') {
|
|
141
|
-
return updateInitialDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function updateInitialDisplaySpan(frameTimestampSeconds) {
|
|
145
|
-
const span = startTimeToInitialDisplaySpan();
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
export function updateInitialDisplaySpan(frameTimestampSeconds, { activeSpan = getActiveSpan(), span = startTimeToInitialDisplaySpan(), } = {}) {
|
|
146
144
|
if (!span) {
|
|
147
145
|
logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);
|
|
148
146
|
return;
|
|
149
147
|
}
|
|
150
|
-
const activeSpan = getActiveSpan();
|
|
151
148
|
if (!activeSpan) {
|
|
152
149
|
logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);
|
|
153
150
|
return;
|
|
@@ -168,7 +165,7 @@ function updateInitialDisplaySpan(frameTimestampSeconds) {
|
|
|
168
165
|
logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);
|
|
169
166
|
updateFullDisplaySpan(frameTimestampSeconds, span);
|
|
170
167
|
}
|
|
171
|
-
|
|
168
|
+
setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);
|
|
172
169
|
}
|
|
173
170
|
function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan) {
|
|
174
171
|
const activeSpan = getActiveSpan();
|
|
@@ -207,4 +204,30 @@ function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan)
|
|
|
207
204
|
logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);
|
|
208
205
|
setSpanDurationAsMeasurement('time_to_full_display', span);
|
|
209
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Creates a new TimeToFullDisplay component which triggers the full display recording every time the component is focused.
|
|
209
|
+
*/
|
|
210
|
+
export function createTimeToFullDisplay({ useFocusEffect, }) {
|
|
211
|
+
return createTimeToDisplay({ useFocusEffect, Component: TimeToFullDisplay });
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Creates a new TimeToInitialDisplay component which triggers the initial display recording every time the component is focused.
|
|
215
|
+
*/
|
|
216
|
+
export function createTimeToInitialDisplay({ useFocusEffect, }) {
|
|
217
|
+
return createTimeToDisplay({ useFocusEffect, Component: TimeToInitialDisplay });
|
|
218
|
+
}
|
|
219
|
+
function createTimeToDisplay({ useFocusEffect, Component, }) {
|
|
220
|
+
const TimeToDisplayWrapper = (props) => {
|
|
221
|
+
const [focused, setFocused] = useState(false);
|
|
222
|
+
useFocusEffect(() => {
|
|
223
|
+
setFocused(true);
|
|
224
|
+
return () => {
|
|
225
|
+
setFocused(false);
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
return React.createElement(Component, Object.assign({}, props, { record: focused && props.record }));
|
|
229
|
+
};
|
|
230
|
+
TimeToDisplayWrapper.displayName = `TimeToDisplayWrapper`;
|
|
231
|
+
return TimeToDisplayWrapper;
|
|
232
|
+
}
|
|
210
233
|
//# sourceMappingURL=timetodisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetodisplay.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,EAAE,gCAAgC,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnL,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,o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CAAC,qBAAqB,CAAC,CAAC;KACjC;IAED,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,oCAAoC,CAAC,CAAC;IAE/G,4BAA4B,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import type { Span,StartSpanOptions } from '@sentry/core';\nimport { fill, getActiveSpan, getSpanDescendants, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport * as React from 'react';\n\nimport { isTurboModuleEnabled } from '../utils/environment';\nimport { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin';\nimport { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';\nimport type {RNSentryOnDrawNextFrameEvent } from './timetodisplaynative.types';\nimport { setSpanDurationAsMeasurement } from './utils';\n\nlet nativeComponentMissingLogged = false;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n startTimeToInitialDisplaySpan();\n }\n\n return <TimeToDisplay initialDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n startTimeToFullDisplaySpan();\n return <TimeToDisplay fullDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n const isNewArchitecture = isTurboModuleEnabled();\n\n if (__DEV__ && (isNewArchitecture || (!nativeComponentExists && !nativeComponentMissingLogged))){\n nativeComponentMissingLogged = true;\n // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.\n setTimeout(() => {\n logger.warn(\n 'TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');\n }, 0);\n }\n\n const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event);\n\n return (\n <>\n <RNSentryOnDrawReporter\n onDrawNextFrame={onDraw}\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return undefined;\n }\n\n const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTime: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return undefined;\n }\n\n if (options?.isAutoInstrumented) {\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n manualInitialDisplaySpans.set(activeSpan, true);\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string,\n timeoutMs?: number,\n isAutoInstrumented?: boolean\n } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);\n return undefined;\n }\n\n const descendantSpans = getSpanDescendants(activeSpan);\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);\n return undefined;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTime: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return undefined;\n }\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: Span['end']) => (endTimestamp?: Parameters<Span['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n if (options?.isAutoInstrumented) {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return fullDisplaySpan;\n}\n\nfunction onDrawNextFrame(event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void {\n logger.debug(`[TimeToDisplay] onDrawNextFrame: ${JSON.stringify(event.nativeEvent)}`);\n if (event.nativeEvent.type === 'fullDisplay') {\n return updateFullDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n if (event.nativeEvent.type === 'initialDisplay') {\n return updateInitialDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n}\n\nfunction updateInitialDisplaySpan(frameTimestampSeconds: number): void {\n const span = startTimeToInitialDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n logger.warn(`[TimeToDisplay] Initial display span is not a child of current active span.`);\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurement('time_to_initial_display', span);\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan({\n isAutoInstrumented: true,\n });\n if (!span) {\n logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n logger.warn(`[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.`);\n span.end(initialDisplayEndTimestamp);\n } else {\n span.end(frameTimestampSeconds);\n }\n\n span.setStatus({ code: SPAN_STATUS_OK });\n logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n}\n"]}
|
|
1
|
+
{"version":3,"file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StartSpanOptions } from '@sentry/core';\nimport { fill, getActiveSpan, getSpanDescendants, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport * as React from 'react';\nimport { useState } from 'react';\n\nimport { isTurboModuleEnabled } from '../utils/environment';\nimport { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin';\nimport { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';\nimport { setSpanDurationAsMeasurement, setSpanDurationAsMeasurementOnSpan } from './utils';\n\nlet nativeComponentMissingLogged = false;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n\n const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;\n return <TimeToDisplay initialDisplay={props.record} parentSpanId={parentSpanId}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;\n return <TimeToDisplay fullDisplay={props.record} parentSpanId={parentSpanId}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n parentSpanId?: string;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n const isNewArchitecture = isTurboModuleEnabled();\n\n if (__DEV__ && (isNewArchitecture || (!nativeComponentExists && !nativeComponentMissingLogged))){\n nativeComponentMissingLogged = true;\n // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.\n setTimeout(() => {\n logger.warn(\n 'TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');\n }, 0);\n }\n\n return (\n <>\n <RNSentryOnDrawReporter\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay}\n parentSpanId={props.parentSpanId} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n *\n * @deprecated Use `<TimeToInitialDisplay record={boolean}/>` component instead.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return undefined;\n }\n\n const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTime: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return undefined;\n }\n\n if (options?.isAutoInstrumented) {\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n manualInitialDisplaySpans.set(activeSpan, true);\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n *\n * @deprecated Use `<TimeToFullDisplay record={boolean}/>` component instead.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string,\n timeoutMs?: number,\n isAutoInstrumented?: boolean\n } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);\n return undefined;\n }\n\n const descendantSpans = getSpanDescendants(activeSpan);\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);\n return undefined;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTime: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return undefined;\n }\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: Span['end']) => (endTimestamp?: Parameters<Span['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n if (options?.isAutoInstrumented) {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return fullDisplaySpan;\n}\n\n/**\n *\n */\nexport function updateInitialDisplaySpan(\n frameTimestampSeconds: number,\n {\n activeSpan = getActiveSpan(),\n span = startTimeToInitialDisplaySpan(),\n }: {\n activeSpan?: Span;\n /**\n * Time to initial display span to update.\n */\n span?: Span;\n } = {}): void {\n if (!span) {\n logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);\n return;\n }\n\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n logger.warn(`[TimeToDisplay] Initial display span is not a child of current active span.`);\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan({\n isAutoInstrumented: true,\n });\n if (!span) {\n logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n logger.warn(`[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.`);\n span.end(initialDisplayEndTimestamp);\n } else {\n span.end(frameTimestampSeconds);\n }\n\n span.setStatus({ code: SPAN_STATUS_OK });\n logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n}\n\n/**\n * Creates a new TimeToFullDisplay component which triggers the full display recording every time the component is focused.\n */\nexport function createTimeToFullDisplay({\n useFocusEffect,\n}: {\n /**\n * `@react-navigation/native` useFocusEffect hook.\n */\n useFocusEffect: (callback: () => void) => void\n}): React.ComponentType<TimeToDisplayProps> {\n return createTimeToDisplay({ useFocusEffect, Component: TimeToFullDisplay });\n}\n\n/**\n * Creates a new TimeToInitialDisplay component which triggers the initial display recording every time the component is focused.\n */\nexport function createTimeToInitialDisplay({\n useFocusEffect,\n}: {\n useFocusEffect: (callback: () => void) => void\n}): React.ComponentType<TimeToDisplayProps> {\n return createTimeToDisplay({ useFocusEffect, Component: TimeToInitialDisplay });\n}\n\nfunction createTimeToDisplay({\n useFocusEffect,\n Component,\n}: {\n /**\n * `@react-navigation/native` useFocusEffect hook.\n */\n useFocusEffect: (callback: () => void) => void;\n Component: typeof TimeToFullDisplay | typeof TimeToInitialDisplay;\n}): React.ComponentType<TimeToDisplayProps> {\n const TimeToDisplayWrapper = (props: TimeToDisplayProps): React.ReactElement => {\n const [focused, setFocused] = useState(false);\n\n useFocusEffect(() => {\n setFocused(true);\n return () => {\n setFocused(false);\n };\n });\n\n return <Component {...props} record={focused && props.record} />;\n };\n\n TimeToDisplayWrapper.displayName = `TimeToDisplayWrapper`;\n return TimeToDisplayWrapper;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAKjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,6BAO5C,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UIManager, View } from 'react-native';
|
|
3
|
+
import { isExpoGo } from '../utils/environment';
|
|
3
4
|
import { ReactNativeLibraries } from '../utils/rnlibraries';
|
|
4
5
|
const RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';
|
|
5
6
|
export const nativeComponentExists = UIManager.hasViewManagerConfig
|
|
@@ -20,7 +21,7 @@ let RNSentryOnDrawReporter;
|
|
|
20
21
|
export const getRNSentryOnDrawReporter = () => {
|
|
21
22
|
var _a;
|
|
22
23
|
if (!RNSentryOnDrawReporter) {
|
|
23
|
-
RNSentryOnDrawReporter = nativeComponentExists && ((_a = ReactNativeLibraries.ReactNative) === null || _a === void 0 ? void 0 : _a.requireNativeComponent)
|
|
24
|
+
RNSentryOnDrawReporter = !isExpoGo() && nativeComponentExists && ((_a = ReactNativeLibraries.ReactNative) === null || _a === void 0 ? void 0 : _a.requireNativeComponent)
|
|
24
25
|
? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass)
|
|
25
26
|
: RNSentryOnDrawReporterNoop;
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetodisplaynative.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,oBAAoB;IACjE,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,2BAA2B,CAAC;IAC7D,CAAC,CAAC,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,0BAA2B,SAA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vH,CAAC,CAAC,oBAAoB,CAAC,WAAW,CAAC,sBAAsB,CAAC,2BAA2B,CAAC;YACtF,CAAC,CAAC,0BAA0B,CAAC;KAChC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAA","sourcesContent":["import * as React from 'react';\nimport type { HostComponent } from 'react-native';\nimport { UIManager, View } from 'react-native';\n\nimport { isExpoGo } from '../utils/environment';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';\n\nconst RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';\n\nexport const nativeComponentExists = UIManager.hasViewManagerConfig\n ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)\n : false;\n\n/**\n * This is a fallback component for environments where the native component is not available.\n */\nclass RNSentryOnDrawReporterNoop extends React.Component<RNSentryOnDrawReporterProps> {\n public render(): React.ReactNode {\n return (\n <View {...this.props} />\n );\n }\n}\n\nlet RNSentryOnDrawReporter: HostComponent<RNSentryOnDrawReporterProps> | typeof RNSentryOnDrawReporterNoop;\n\n/**\n * Native component that reports the on draw timestamp.\n */\nexport const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporter => {\n if (!RNSentryOnDrawReporter) {\n RNSentryOnDrawReporter = !isExpoGo() && nativeComponentExists && ReactNativeLibraries.ReactNative?.requireNativeComponent\n ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass)\n : RNSentryOnDrawReporterNoop;\n }\n return RNSentryOnDrawReporter;\n}\n"]}
|
|
@@ -5,10 +5,8 @@ export interface RNSentryOnDrawNextFrameEvent {
|
|
|
5
5
|
}
|
|
6
6
|
export interface RNSentryOnDrawReporterProps {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
onDrawNextFrame: (event: {
|
|
9
|
-
nativeEvent: RNSentryOnDrawNextFrameEvent;
|
|
10
|
-
}) => void;
|
|
11
8
|
initialDisplay?: boolean;
|
|
12
9
|
fullDisplay?: boolean;
|
|
10
|
+
parentSpanId?: string;
|
|
13
11
|
}
|
|
14
12
|
//# sourceMappingURL=timetodisplaynative.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetodisplaynative.types.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.types.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,4BAA4B;IAC3C,0BAA0B,EAAE,MAAM,CAAC;IACnC,IAAI,EAAE,gBAAgB,GAAG,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,
|
|
1
|
+
{"version":3,"file":"timetodisplaynative.types.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.types.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,4BAA4B;IAC3C,0BAA0B,EAAE,MAAM,CAAC;IACnC,IAAI,EAAE,gBAAgB,GAAG,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetodisplaynative.types.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface RNSentryOnDrawNextFrameEvent {\n newFrameTimestampInSeconds: number;\n type: 'initialDisplay' | 'fullDisplay';\n}\n\nexport interface RNSentryOnDrawReporterProps {\n children?: React.ReactNode;\n
|
|
1
|
+
{"version":3,"file":"timetodisplaynative.types.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface RNSentryOnDrawNextFrameEvent {\n newFrameTimestampInSeconds: number;\n type: 'initialDisplay' | 'fullDisplay';\n}\n\nexport interface RNSentryOnDrawReporterProps {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n parentSpanId?: string;\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';
|
|
2
|
-
export declare const ReactNativeLibraries:
|
|
2
|
+
export declare const ReactNativeLibraries: ReactNativeLibrariesInterface;
|
|
3
3
|
//# sourceMappingURL=rnlibraries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rnlibraries.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rnlibraries.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAwC5E,eAAO,MAAM,oBAAoB,EAAE,6BAAqE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
1
|
var _a;
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
+
import { AppRegistry, Platform, TurboModuleRegistry } from 'react-native';
|
|
4
|
+
const InternalReactNativeLibrariesInterface = {
|
|
5
5
|
Devtools: {
|
|
6
6
|
parseErrorStack: (errorStack) => {
|
|
7
7
|
const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');
|
|
@@ -27,6 +27,7 @@ export const ReactNativeLibraries = {
|
|
|
27
27
|
version: (_a = Platform.constants) === null || _a === void 0 ? void 0 : _a.reactNativeVersion,
|
|
28
28
|
},
|
|
29
29
|
TurboModuleRegistry,
|
|
30
|
+
AppRegistry,
|
|
30
31
|
ReactNative: {
|
|
31
32
|
requireNativeComponent: (viewName) => {
|
|
32
33
|
const { requireNativeComponent } = require('react-native');
|
|
@@ -34,4 +35,5 @@ export const ReactNativeLibraries = {
|
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
37
|
};
|
|
38
|
+
export const ReactNativeLibraries = InternalReactNativeLibrariesInterface;
|
|
37
39
|
//# sourceMappingURL=rnlibraries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rnlibraries.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAAA,uDAAuD
|
|
1
|
+
{"version":3,"file":"rnlibraries.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAK1E,MAAM,qCAAqC,GAA4C;IACrF,QAAQ,EAAE;QACR,eAAe,EAAE,CAAC,UAAkB,EAAiC,EAAE;YACrE,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YACxF,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;QACD,qBAAqB,EAAE,CACrB,KAAoC,EACpC,SAAmC,EACU,EAAE;YAC/C,MAAM,qBAAqB,GAAG,OAAO,CAAC,4DAA4D,CAAC,CAAC;YACpG,OAAO,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,YAAY,EAAE,GAA8B,EAAE;YAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;YAClF,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;KACF;IACD,OAAO,EAAE,OAAO,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE;QACT,cAAc,EAAE,CAAI,IAAY,EAAE,QAAiB,EAAQ,EAAE;YAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;YACzF,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF;IACD,kBAAkB,EAAE;QAClB,OAAO,EAAE,MAAA,QAAQ,CAAC,SAAS,0CAAE,kBAAkB;KAChD;IACD,mBAAmB;IACnB,WAAW;IACX,WAAW,EAAE;QACX,sBAAsB,EAAE,CAAI,QAAgB,EAAgC,EAAE;YAC5E,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;YAC3D,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAkC,qCAAqC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { AppRegistry, Platform, TurboModuleRegistry } from 'react-native';\n\nimport type * as ReactNative from '../vendor/react-native';\nimport type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';\n\nconst InternalReactNativeLibrariesInterface: Required<ReactNativeLibrariesInterface> = {\n Devtools: {\n parseErrorStack: (errorStack: string): Array<ReactNative.StackFrame> => {\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n return parseErrorStack(errorStack);\n },\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> => {\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n return symbolicateStackTrace(stack, extraData);\n },\n getDevServer: (): ReactNative.DevServerInfo => {\n const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n return getDevServer();\n },\n },\n Promise: require('react-native/Libraries/Promise'),\n Utilities: {\n polyfillGlobal: <T>(name: string, getValue: () => T): void => {\n const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n polyfillGlobal(name, getValue);\n },\n },\n ReactNativeVersion: {\n version: Platform.constants?.reactNativeVersion,\n },\n TurboModuleRegistry,\n AppRegistry,\n ReactNative: {\n requireNativeComponent: <T>(viewName: string): ReactNative.HostComponent<T> => {\n const { requireNativeComponent } = require('react-native');\n return requireNativeComponent(viewName);\n },\n },\n};\n\nexport const ReactNativeLibraries: ReactNativeLibrariesInterface = InternalReactNativeLibrariesInterface;\n"]}
|
|
@@ -13,6 +13,7 @@ export interface ReactNativeLibrariesInterface {
|
|
|
13
13
|
Promise?: typeof Promise;
|
|
14
14
|
ReactNativeVersion?: ReactNative.ReactNativeVersion;
|
|
15
15
|
TurboModuleRegistry?: ReactNative.TurboModuleRegistry;
|
|
16
|
+
AppRegistry?: ReactNative.AppRegistry;
|
|
16
17
|
ReactNative?: {
|
|
17
18
|
requireNativeComponent?: <T>(viewName: string) => ReactNative.HostComponent<T>;
|
|
18
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rnlibrariesinterface.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,WAAW,MAAM,wBAAwB,CAAC;AAE3D,YAAY,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,YAAY,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAE9F,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE;QACT,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACvE,qBAAqB,EAAE,CACrB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;QACjD,YAAY,EAAE,MAAM,WAAW,CAAC,aAAa,CAAC;KAC/C,CAAC;IACF,SAAS,CAAC,EAAE;QACV,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MA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