@sentry/react-native 5.31.1 → 5.32.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +18 -1
  3. package/dist/js/client.d.ts.map +1 -1
  4. package/dist/js/client.js +2 -2
  5. package/dist/js/client.js.map +1 -1
  6. package/dist/js/index.d.ts +1 -1
  7. package/dist/js/index.d.ts.map +1 -1
  8. package/dist/js/index.js +1 -3
  9. package/dist/js/index.js.map +1 -1
  10. package/dist/js/integrations/default.d.ts.map +1 -1
  11. package/dist/js/integrations/default.js +2 -1
  12. package/dist/js/integrations/default.js.map +1 -1
  13. package/dist/js/options.d.ts +34 -2
  14. package/dist/js/options.d.ts.map +1 -1
  15. package/dist/js/options.js.map +1 -1
  16. package/dist/js/profiling/integration.d.ts.map +1 -1
  17. package/dist/js/profiling/integration.js +6 -3
  18. package/dist/js/profiling/integration.js.map +1 -1
  19. package/dist/js/tools/metroconfig.d.ts +10 -1
  20. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  21. package/dist/js/tools/metroconfig.js +42 -2
  22. package/dist/js/tools/metroconfig.js.map +1 -1
  23. package/dist/js/tracing/index.d.ts +3 -3
  24. package/dist/js/tracing/index.d.ts.map +1 -1
  25. package/dist/js/tracing/index.js +3 -3
  26. package/dist/js/tracing/index.js.map +1 -1
  27. package/dist/js/tracing/reactnativenavigation.d.ts +6 -0
  28. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  29. package/dist/js/tracing/reactnativenavigation.js +6 -0
  30. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  31. package/dist/js/tracing/reactnativetracing.d.ts +6 -8
  32. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  33. package/dist/js/tracing/reactnativetracing.js +23 -15
  34. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  35. package/dist/js/tracing/reactnavigation.d.ts +4 -0
  36. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  37. package/dist/js/tracing/reactnavigation.js +6 -0
  38. package/dist/js/tracing/reactnavigation.js.map +1 -1
  39. package/dist/js/tracing/reactnavigationv4.d.ts +2 -0
  40. package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
  41. package/dist/js/tracing/reactnavigationv4.js +2 -0
  42. package/dist/js/tracing/reactnavigationv4.js.map +1 -1
  43. package/dist/js/tracing/routingInstrumentation.d.ts +8 -2
  44. package/dist/js/tracing/routingInstrumentation.d.ts.map +1 -1
  45. package/dist/js/tracing/routingInstrumentation.js +3 -2
  46. package/dist/js/tracing/routingInstrumentation.js.map +1 -1
  47. package/dist/js/version.d.ts +1 -1
  48. package/dist/js/version.js +1 -1
  49. package/dist/js/version.js.map +1 -1
  50. package/package.json +2 -2
  51. package/ts3.8/dist/js/index.d.ts +1 -1
  52. package/ts3.8/dist/js/options.d.ts +34 -2
  53. package/ts3.8/dist/js/tracing/index.d.ts +3 -3
  54. package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +6 -0
  55. package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +6 -8
  56. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +4 -0
  57. package/ts3.8/dist/js/tracing/reactnavigationv4.d.ts +2 -0
  58. package/ts3.8/dist/js/tracing/routingInstrumentation.d.ts +8 -2
  59. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASrG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cA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AC,WAAW,CAAC,YAAY;wBACxB,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CACnC,IAAI,CAAC,EAAE,CACL,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM;4BAClC,IAAI,CAAC,EAAE,KAAK,yBAAyB;4BACrC,IAAI,CAAC,EAAE,KAAK,uBAAuB,CACtC,CAAC,MAAM,KAAK,CAAC,CAAC,EACjB;oBACA,MAAM,CAAC,GAAG,CACR,0JAA0J,CAC3J,CAAC;oBACF,qDAAqD;oBACrD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC7B;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,OAA2B;;QACvD,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACvD,MAAM,GAAG,GAAG,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,aAAa,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QACnF,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;;AA/kBD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC;AAC5C,4FAA4F;AAC7E,kDAA+B,GAAW,KAAK,CAAC;AA2kBjE;;;GAGG;AACH,SAAS,8BAA8B,CAAC,WAAwB;IAC9D,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;AAC/D,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { RequestInstrumentationOptions } from '@sentry/browser';\nimport { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry/browser';\nimport type { Hub, IdleTransaction, Transaction } from '@sentry/core';\nimport { getActiveTransaction, getCurrentHub, spanToJSON, startIdleTransaction } from '@sentry/core';\nimport type {\n Event,\n EventProcessor,\n Integration,\n Span,\n Transaction as TransactionType,\n TransactionContext,\n} from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { APP_START_COLD, APP_START_WARM } from '../measurements';\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport { cancelInBackground, onlySampleIfChildSpans } from './transaction';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport {\n adjustTransactionDuration,\n getBundleStartTimestampMs,\n getTimeOriginMilliseconds,\n isNearToNow,\n setSpanDurationAsMeasurement,\n} from './utils';\n\nexport interface ReactNativeTracingOptions extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\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 * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n */\n enableUserInteractionTracing: boolean;\n}\n\nconst DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\\/(?!\\/)/];\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: context => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /** We filter out App starts which timestamp is 60s and more before the transaction start */\n private static _maxAppStartBeforeTransactionMs: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _inflightInteractionTransaction?: IdleTransaction;\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n private _currentRoute?: string;\n private _hasSetTracePropagationTargets: boolean;\n private _hasSetTracingOrigins: boolean;\n private _currentViewName: string | undefined;\n private _firstConstructorCallTimestampMs: number | undefined;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this._hasSetTracePropagationTargets = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracePropagationTargets\n );\n this._hasSetTracingOrigins = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracingOrigins\n );\n\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs:\n options.finalTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n (typeof options.maxTransactionDuration === 'number'\n ? // eslint-disable-next-line deprecation/deprecation\n options.maxTransactionDuration * 1000\n : undefined) ??\n defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs:\n options.idleTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n options.idleTimeout ??\n defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public async setupOnce(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub,\n ): Promise<void> {\n const hub = getCurrentHub();\n const client = hub.getClient();\n const clientOptions = client && client.getOptions();\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n shouldCreateSpanForRequest,\n // eslint-disable-next-line deprecation/deprecation\n tracePropagationTargets: thisOptionsTracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;\n // There are three ways to configure tracePropagationTargets:\n // 1. via top level client option `tracePropagationTargets`\n // 2. via ReactNativeTracing option `tracePropagationTargets`\n // 3. via ReactNativeTracing option `tracingOrigins` (deprecated)\n //\n // To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to\n // ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).\n //\n // If both 1 and either one of 2 or 3 are set (from above), we log out a warning.\n const tracePropagationTargets =\n clientOptionsTracePropagationTargets ||\n (this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||\n (this._hasSetTracingOrigins && tracingOrigins) ||\n DEFAULT_TRACE_PROPAGATION_TARGETS;\n if (\n __DEV__ &&\n (this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&\n clientOptionsTracePropagationTargets\n ) {\n logger.warn(\n '[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',\n );\n }\n\n if (enableAppStartTracking) {\n this._instrumentAppStart().then(undefined, (reason: unknown) => {\n logger.error(`[ReactNativeTracing] Error while instrumenting app start:`, reason);\n });\n }\n\n this._enableNativeFramesTracking(addGlobalEventProcessor);\n\n if (enableStallTracking) {\n this.stallTrackingInstrumentation = new StallTrackingInstrumentation();\n }\n\n if (routingInstrumentation) {\n routingInstrumentation.registerRoutingInstrumentation(\n this._onRouteWillChange.bind(this),\n this.options.beforeNavigate,\n this._onConfirmRoute.bind(this),\n );\n } else {\n logger.log('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');\n }\n\n addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n } else {\n logger.warn(\n `[ReactNativeTracing] onTransactionStart called with delay (larger than margin of error) for transaction ${\n transaction.description\n } (${transaction.spanContext().spanId}). Not fetching native frames or tracking stalls.`,\n );\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(transaction: Transaction, endTimestamp?: number): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Sets the root component first constructor call timestamp.\n */\n public setRootComponentFirstConstructorCallTimestampMs(timestamp: number): void {\n this._firstConstructorCallTimestampMs = timestamp;\n }\n\n /**\n * Starts a new transaction for a user interaction.\n * @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.\n */\n public startUserInteractionTransaction(userInteractionId: {\n elementId: string | undefined;\n op: string;\n }): TransactionType | undefined {\n const { elementId, op } = userInteractionId;\n if (!this.options.enableUserInteractionTracing) {\n logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');\n return;\n }\n if (!this.options.routingInstrumentation) {\n logger.error(\n '[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.',\n );\n return;\n }\n if (!elementId) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');\n return;\n }\n if (!this._currentRoute) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');\n return;\n }\n\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const activeTransaction = getActiveTransaction(hub);\n const activeTransactionIsNotInteraction =\n activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`,\n );\n return;\n }\n\n if (this._inflightInteractionTransaction) {\n this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });\n this._inflightInteractionTransaction = undefined;\n }\n\n const name = `${this._currentRoute}.${elementId}`;\n const context: TransactionContext = {\n name,\n op,\n trimEnd: true,\n };\n this._inflightInteractionTransaction = this._startIdleTransaction(context);\n this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction: IdleTransaction) => {\n this._inflightInteractionTransaction = undefined;\n this.onTransactionFinish(transaction);\n });\n this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);\n this.onTransactionStart(this._inflightInteractionTransaction);\n logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);\n return this._inflightInteractionTransaction;\n }\n\n /**\n * Enables or disables native frames tracking based on the `enableNativeFramesTracking` option.\n */\n private _enableNativeFramesTracking(addGlobalEventProcessor: (callback: EventProcessor) => void): void {\n if (this.options.enableNativeFramesTracking && !NATIVE.enableNative) {\n // Do not enable native frames tracking if native is not available.\n logger.warn(\n '[ReactNativeTracing] NativeFramesTracking is not available on the Web, Expo Go and other platforms without native modules.',\n );\n return;\n }\n\n if (!this.options.enableNativeFramesTracking && NATIVE.enableNative) {\n // Disable native frames tracking when native available and option is false.\n NATIVE.disableNativeFramesTracking();\n return;\n }\n\n if (!this.options.enableNativeFramesTracking) {\n return;\n }\n\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n });\n }\n\n /**\n * Sets the current view name into the app context.\n * @param event Le event.\n */\n private _getCurrentViewEventProcessor(event: Event): Event {\n if (event.contexts && this._currentViewName) {\n event.contexts.app = { view_names: [this._currentViewName], ...event.contexts.app };\n }\n return event;\n }\n\n /**\n * Returns the App Start Duration in Milliseconds. Also returns undefined if not able do\n * define the duration.\n */\n private _getAppStartDurationMilliseconds(appStartTimestampMs: number): number | undefined {\n if (!this._appStartFinishTimestamp) {\n return undefined;\n }\n return this._appStartFinishTimestamp * 1000 - appStartTimestampMs;\n }\n\n /**\n * Instruments the app start measurements on the first route transaction.\n * Starts a route transaction if there isn't routing instrumentation.\n */\n private async _instrumentAppStart(): Promise<void> {\n if (!this.options.enableAppStartTracking || !NATIVE.enableNative) {\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n\n if (!appStart) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because native returned null.');\n return;\n }\n\n if (appStart.has_fetched) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because this start was already reported.');\n return;\n }\n\n if (!this.useAppStartWithProfiler) {\n logger.warn('[ReactNativeTracing] `Sentry.wrap` not detected, using JS context init as app start end.');\n this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;\n }\n\n if (this.options.routingInstrumentation) {\n this._awaitingAppStartData = appStart;\n } else {\n const idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(transaction: IdleTransaction, appStart: NativeAppStartResponse): void {\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const isAppStartWithinBounds =\n appStartTimestampMs >=\n getTransactionStartTimestampMs(transaction) - ReactNativeTracing._maxAppStartBeforeTransactionMs;\n if (!__DEV__ && !isAppStartWithinBounds) {\n logger.warn('[ReactNativeTracing] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStartTimestampMs);\n if (!appStartDurationMilliseconds) {\n logger.warn('[ReactNativeTracing] App start end has not been recorded, not adding app start span.');\n return;\n }\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n logger.warn('[ReactNativeTracing] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n const appStartTimeSeconds = appStartTimestampMs / 1000;\n\n transaction.startTimestamp = appStartTimeSeconds;\n\n const maybeTtidSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_full_display', maybeTtfdSpan);\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpan = transaction.startChild({\n description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',\n op,\n startTimestamp: appStartTimeSeconds,\n endTimestamp: this._appStartFinishTimestamp,\n });\n this._addJSExecutionBeforeRoot(appStartSpan);\n this._addNativeSpansTo(appStartSpan, appStart.spans);\n\n const measurement = appStart.type === 'cold' ? APP_START_COLD : APP_START_WARM;\n transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');\n }\n\n /**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\n private _addJSExecutionBeforeRoot(appStartSpan: Span): void {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return;\n }\n\n if (!this._firstConstructorCallTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n appStartSpan.startChild({\n description: 'JS Bundle Execution Start',\n op: appStartSpan.op,\n startTimestamp: bundleStartTimestampMs / 1000,\n endTimestamp: bundleStartTimestampMs / 1000,\n });\n return;\n }\n\n appStartSpan.startChild({\n description: 'JS Bundle Execution Before React Root',\n op: appStartSpan.op,\n startTimestamp: bundleStartTimestampMs / 1000,\n endTimestamp: this._firstConstructorCallTimestampMs / 1000,\n });\n }\n\n /**\n * Adds native spans to the app start span.\n */\n private _addNativeSpansTo(appStartSpan: Span, nativeSpans: NativeAppStartResponse['spans']): void {\n nativeSpans.forEach(span => {\n if (span.description === 'UIKit init') {\n return this._createUIKitSpan(appStartSpan, span);\n }\n\n appStartSpan.startChild({\n op: appStartSpan.op,\n description: span.description,\n startTimestamp: span.start_timestamp_ms / 1000,\n endTimestamp: span.end_timestamp_ms / 1000,\n });\n });\n }\n\n /**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\n private _createUIKitSpan(parentSpan: Span, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): void {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n parentSpan.startChild({\n op: parentSpan.op,\n description: 'UIKit Init to JS Exec Start',\n startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n endTimestamp: bundleStart / 1000,\n });\n } else {\n parentSpan.startChild({\n op: parentSpan.op,\n description: 'UIKit Init',\n startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n endTimestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n });\n }\n }\n\n /** To be called when the route changes, but BEFORE the components of the new route mount. */\n private _onRouteWillChange(context: TransactionContext): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._currentRoute = context.data?.route?.name;\n\n this._getCurrentHub?.().configureScope(scope => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n this._currentViewName = context.name;\n /**\n * @deprecated tag routing.route.name will be removed in the future.\n */\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n if (this._inflightInteractionTransaction) {\n logger.log(\n `[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`,\n );\n this._inflightInteractionTransaction.setStatus('cancelled');\n this._inflightInteractionTransaction.finish();\n }\n\n const { finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const idleTransaction = this._startIdleTransaction(expandedContext);\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(`[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`);\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n });\n\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.op = UI_LOAD;\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);\n });\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(\n span =>\n span.spanId !== transaction.spanId &&\n span.op !== 'ui.load.initial_display' &&\n span.op !== 'navigation.processing',\n ).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.',\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n\n /**\n * Start app state aware idle transaction on the scope.\n */\n private _startIdleTransaction(context: TransactionContext): IdleTransaction {\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);\n cancelInBackground(tx);\n return tx;\n }\n}\n\n/**\n * Returns transaction start timestamp in milliseconds.\n * If start timestamp is not available, returns 0.\n */\nfunction getTransactionStartTimestampMs(transaction: Transaction): number {\n return (spanToJSON(transaction).start_timestamp || 0) * 1000;\n}\n"]}
1
+ {"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASrG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,cAAc,IAAI,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAA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C7E,kDAA+B,GAAW,KAAK,CAAC;AAmlBjE;;;GAGG;AACH,SAAS,8BAA8B,CAAC,WAAwB;IAC9D,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;AAC/D,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { RequestInstrumentationOptions } from '@sentry/browser';\nimport { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry/browser';\nimport type { Hub, IdleTransaction, Transaction } from '@sentry/core';\nimport { getActiveTransaction, getCurrentHub, spanToJSON, startIdleTransaction } from '@sentry/core';\nimport type {\n Event,\n EventProcessor,\n Integration,\n Span,\n Transaction as TransactionType,\n TransactionContext,\n} from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport type { ReactNativeClient } from '../client';\nimport { APP_START_COLD, APP_START_WARM } from '../measurements';\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../options';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport { cancelInBackground, onlySampleIfChildSpans } from './transaction';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport {\n adjustTransactionDuration,\n getBundleStartTimestampMs,\n getTimeOriginMilliseconds,\n isNearToNow,\n setSpanDurationAsMeasurement,\n} from './utils';\n\nexport const reactNativeTracingIntegration = (options?: Partial<ReactNativeTracingOptions>): ReactNativeTracing => {\n return new ReactNativeTracing(options);\n};\n\nexport interface ReactNativeTracingOptions extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\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 * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * @deprecated Use `Sentry.init({ enableAppStartTracking })` instead.\n */\n enableAppStartTracking: boolean;\n\n /**\n * @deprecated Use `Sentry.init({ enableNativeFramesTracking })` instead.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * @deprecated Use `Sentry.init({ enableStallTracking })` instead.\n */\n enableStallTracking: boolean;\n\n /**\n * @deprecated Use `Sentry.init({ enableUserInteractionTracing })` instead.\n */\n enableUserInteractionTracing: boolean;\n}\n\nconst DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\\/(?!\\/)/];\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: context => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * @deprecated Use `Sentry.reactNativeTracingIntegration()` instead.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /** We filter out App starts which timestamp is 60s and more before the transaction start */\n private static _maxAppStartBeforeTransactionMs: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _inflightInteractionTransaction?: IdleTransaction;\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n private _currentRoute?: string;\n private _hasSetTracePropagationTargets: boolean;\n private _hasSetTracingOrigins: boolean;\n private _currentViewName: string | undefined;\n private _firstConstructorCallTimestampMs: number | undefined;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this._hasSetTracePropagationTargets = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracePropagationTargets\n );\n this._hasSetTracingOrigins = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracingOrigins\n );\n\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs:\n options.finalTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n (typeof options.maxTransactionDuration === 'number'\n ? // eslint-disable-next-line deprecation/deprecation\n options.maxTransactionDuration * 1000\n : undefined) ??\n defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs:\n options.idleTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n options.idleTimeout ??\n defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public async setupOnce(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub,\n ): Promise<void> {\n const hub = getCurrentHub();\n const client = hub.getClient<ReactNativeClient>();\n const clientOptions = client && client.getOptions();\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n shouldCreateSpanForRequest,\n // eslint-disable-next-line deprecation/deprecation\n tracePropagationTargets: thisOptionsTracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;\n // There are three ways to configure tracePropagationTargets:\n // 1. via top level client option `tracePropagationTargets`\n // 2. via ReactNativeTracing option `tracePropagationTargets`\n // 3. via ReactNativeTracing option `tracingOrigins` (deprecated)\n //\n // To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to\n // ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).\n //\n // If both 1 and either one of 2 or 3 are set (from above), we log out a warning.\n const tracePropagationTargets =\n clientOptionsTracePropagationTargets ||\n (this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||\n (this._hasSetTracingOrigins && tracingOrigins) ||\n DEFAULT_TRACE_PROPAGATION_TARGETS;\n if (\n __DEV__ &&\n (this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&\n clientOptionsTracePropagationTargets\n ) {\n logger.warn(\n '[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',\n );\n }\n\n if (clientOptions?.enableAppStartTracking ?? enableAppStartTracking) {\n this._instrumentAppStart(clientOptions).then(undefined, (reason: unknown) => {\n logger.error(`[ReactNativeTracing] Error while instrumenting app start:`, reason);\n });\n }\n\n this._enableNativeFramesTracking(addGlobalEventProcessor, clientOptions);\n\n if (clientOptions?.enableStallTracking ?? enableStallTracking) {\n this.stallTrackingInstrumentation = new StallTrackingInstrumentation();\n }\n\n if (routingInstrumentation) {\n routingInstrumentation.registerRoutingInstrumentation(\n this._onRouteWillChange.bind(this),\n this.options.beforeNavigate,\n this._onConfirmRoute.bind(this),\n );\n } else {\n logger.log('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');\n }\n\n addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n } else {\n logger.warn(\n `[ReactNativeTracing] onTransactionStart called with delay (larger than margin of error) for transaction ${\n transaction.description\n } (${transaction.spanContext().spanId}). Not fetching native frames or tracking stalls.`,\n );\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(transaction: Transaction, endTimestamp?: number): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Sets the root component first constructor call timestamp.\n */\n public setRootComponentFirstConstructorCallTimestampMs(timestamp: number): void {\n this._firstConstructorCallTimestampMs = timestamp;\n }\n\n /**\n * Starts a new transaction for a user interaction.\n * @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.\n */\n public startUserInteractionTransaction(userInteractionId: {\n elementId: string | undefined;\n op: string;\n }): TransactionType | undefined {\n const { elementId, op } = userInteractionId;\n\n const clientOptions = this._getCurrentHub?.()?.getClient<ReactNativeClient>()?.getOptions();\n\n if (!(clientOptions?.enableUserInteractionTracing ?? this.options.enableUserInteractionTracing)) {\n logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');\n return;\n }\n if (!this.options.routingInstrumentation) {\n logger.error(\n '[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.',\n );\n return;\n }\n if (!elementId) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');\n return;\n }\n if (!this._currentRoute) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');\n return;\n }\n\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const activeTransaction = getActiveTransaction(hub);\n const activeTransactionIsNotInteraction =\n activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`,\n );\n return;\n }\n\n if (this._inflightInteractionTransaction) {\n this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });\n this._inflightInteractionTransaction = undefined;\n }\n\n const name = `${this._currentRoute}.${elementId}`;\n const context: TransactionContext = {\n name,\n op,\n trimEnd: true,\n };\n this._inflightInteractionTransaction = this._startIdleTransaction(context);\n this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction: IdleTransaction) => {\n this._inflightInteractionTransaction = undefined;\n this.onTransactionFinish(transaction);\n });\n this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);\n this.onTransactionStart(this._inflightInteractionTransaction);\n logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);\n return this._inflightInteractionTransaction;\n }\n\n /**\n * Enables or disables native frames tracking based on the `enableNativeFramesTracking` option.\n */\n private _enableNativeFramesTracking(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n clientOptions: ReactNativeClientOptions | undefined,\n ): void {\n const enableNativeFramesTracking =\n clientOptions?.enableNativeFramesTracking ?? this.options.enableNativeFramesTracking;\n if (enableNativeFramesTracking && !NATIVE.enableNative) {\n // Do not enable native frames tracking if native is not available.\n logger.warn(\n '[ReactNativeTracing] NativeFramesTracking is not available on the Web, Expo Go and other platforms without native modules.',\n );\n return;\n }\n\n if (!enableNativeFramesTracking && NATIVE.enableNative) {\n // Disable native frames tracking when native available and option is false.\n NATIVE.disableNativeFramesTracking();\n return;\n }\n\n if (!enableNativeFramesTracking) {\n return;\n }\n\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n });\n }\n\n /**\n * Sets the current view name into the app context.\n * @param event Le event.\n */\n private _getCurrentViewEventProcessor(event: Event): Event {\n if (event.contexts && this._currentViewName) {\n event.contexts.app = { view_names: [this._currentViewName], ...event.contexts.app };\n }\n return event;\n }\n\n /**\n * Returns the App Start Duration in Milliseconds. Also returns undefined if not able do\n * define the duration.\n */\n private _getAppStartDurationMilliseconds(appStartTimestampMs: number): number | undefined {\n if (!this._appStartFinishTimestamp) {\n return undefined;\n }\n return this._appStartFinishTimestamp * 1000 - appStartTimestampMs;\n }\n\n /**\n * Instruments the app start measurements on the first route transaction.\n * Starts a route transaction if there isn't routing instrumentation.\n */\n private async _instrumentAppStart(clientOptions: ReactNativeClientOptions | undefined): Promise<void> {\n if (!(clientOptions?.enableAppStartTracking ?? this.options.enableAppStartTracking) || !NATIVE.enableNative) {\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n\n if (!appStart) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because native returned null.');\n return;\n }\n\n if (appStart.has_fetched) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because this start was already reported.');\n return;\n }\n\n if (!this.useAppStartWithProfiler) {\n logger.warn('[ReactNativeTracing] `Sentry.wrap` not detected, using JS context init as app start end.');\n this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;\n }\n\n if (this.options.routingInstrumentation) {\n this._awaitingAppStartData = appStart;\n } else {\n const idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(transaction: IdleTransaction, appStart: NativeAppStartResponse): void {\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const isAppStartWithinBounds =\n appStartTimestampMs >=\n getTransactionStartTimestampMs(transaction) - ReactNativeTracing._maxAppStartBeforeTransactionMs;\n if (!__DEV__ && !isAppStartWithinBounds) {\n logger.warn('[ReactNativeTracing] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStartTimestampMs);\n if (!appStartDurationMilliseconds) {\n logger.warn('[ReactNativeTracing] App start end has not been recorded, not adding app start span.');\n return;\n }\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n logger.warn('[ReactNativeTracing] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n const appStartTimeSeconds = appStartTimestampMs / 1000;\n\n transaction.startTimestamp = appStartTimeSeconds;\n\n const maybeTtidSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_full_display', maybeTtfdSpan);\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpan = transaction.startChild({\n description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',\n op,\n startTimestamp: appStartTimeSeconds,\n endTimestamp: this._appStartFinishTimestamp,\n });\n this._addJSExecutionBeforeRoot(appStartSpan);\n this._addNativeSpansTo(appStartSpan, appStart.spans);\n\n const measurement = appStart.type === 'cold' ? APP_START_COLD : APP_START_WARM;\n transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');\n }\n\n /**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\n private _addJSExecutionBeforeRoot(appStartSpan: Span): void {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return;\n }\n\n if (!this._firstConstructorCallTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n appStartSpan.startChild({\n description: 'JS Bundle Execution Start',\n op: appStartSpan.op,\n startTimestamp: bundleStartTimestampMs / 1000,\n endTimestamp: bundleStartTimestampMs / 1000,\n });\n return;\n }\n\n appStartSpan.startChild({\n description: 'JS Bundle Execution Before React Root',\n op: appStartSpan.op,\n startTimestamp: bundleStartTimestampMs / 1000,\n endTimestamp: this._firstConstructorCallTimestampMs / 1000,\n });\n }\n\n /**\n * Adds native spans to the app start span.\n */\n private _addNativeSpansTo(appStartSpan: Span, nativeSpans: NativeAppStartResponse['spans']): void {\n nativeSpans.forEach(span => {\n if (span.description === 'UIKit init') {\n return this._createUIKitSpan(appStartSpan, span);\n }\n\n appStartSpan.startChild({\n op: appStartSpan.op,\n description: span.description,\n startTimestamp: span.start_timestamp_ms / 1000,\n endTimestamp: span.end_timestamp_ms / 1000,\n });\n });\n }\n\n /**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\n private _createUIKitSpan(parentSpan: Span, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): void {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n parentSpan.startChild({\n op: parentSpan.op,\n description: 'UIKit Init to JS Exec Start',\n startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n endTimestamp: bundleStart / 1000,\n });\n } else {\n parentSpan.startChild({\n op: parentSpan.op,\n description: 'UIKit Init',\n startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n endTimestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n });\n }\n }\n\n /** To be called when the route changes, but BEFORE the components of the new route mount. */\n private _onRouteWillChange(context: TransactionContext): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._currentRoute = context.data?.route?.name;\n\n this._getCurrentHub?.().configureScope(scope => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n this._currentViewName = context.name;\n /**\n * @deprecated tag routing.route.name will be removed in the future.\n */\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n if (this._inflightInteractionTransaction) {\n logger.log(\n `[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`,\n );\n this._inflightInteractionTransaction.setStatus('cancelled');\n this._inflightInteractionTransaction.finish();\n }\n\n const { finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const idleTransaction = this._startIdleTransaction(expandedContext);\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(`[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`);\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n });\n\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.op = UI_LOAD;\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);\n });\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(\n span =>\n span.spanId !== transaction.spanId &&\n span.op !== 'ui.load.initial_display' &&\n span.op !== 'navigation.processing',\n ).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.',\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n\n /**\n * Start app state aware idle transaction on the scope.\n */\n private _startIdleTransaction(context: TransactionContext): IdleTransaction {\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);\n cancelInBackground(tx);\n return tx;\n }\n}\n\n/**\n * Returns transaction start timestamp in milliseconds.\n * If start timestamp is not available, returns 0.\n */\nfunction getTransactionStartTimestampMs(transaction: Transaction): number {\n return (spanToJSON(transaction).start_timestamp || 0) * 1000;\n}\n"]}
@@ -31,6 +31,10 @@ interface ReactNavigationOptions {
31
31
  * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.
32
32
  * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.
33
33
  */
34
+ export declare const reactNavigationIntegration: (options?: Partial<ReactNavigationOptions>) => ReactNavigationInstrumentation;
35
+ /**
36
+ * @deprecated Please use `Sentry.reactNavigationIntegration()`
37
+ */
34
38
  export declare class ReactNavigationInstrumentation extends InternalRoutingInstrumentation {
35
39
  static instrumentationName: string;
36
40
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAA6D,MAAM,SAAS,CAAC;AAQzG,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAOD,UAAU,sBAAsB;IAC9B;;;;;;OAMG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAOD;;;;;;;GAOG;AACH,qBAAa,8BAA+B,SAAQ,8BAA8B;IAChF,OAAc,mBAAmB,EAAE,MAAM,CAAyB;IAElE,SAAgB,IAAI,EAAE,MAAM,CAAsD;IAElF,OAAO,CAAC,oB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,sGAAsG;IACtG,OAAO,CAAC,mBAAmB,CAMzB;IAEF,wEAAwE;IACxE,OAAO,CAAC,yBAAyB;IAWjC;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAMjC;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,uCAAiC,CAAC;AAE/E,eAAO,MAAM,yBAAyB;;;;;;;CAOrC,CAAC"}
@@ -19,6 +19,12 @@ const defaultOptions = {
19
19
  * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.
20
20
  * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.
21
21
  */
22
+ export const reactNavigationIntegration = (options = {}) => {
23
+ return new ReactNavigationInstrumentation(options);
24
+ };
25
+ /**
26
+ * @deprecated Please use `Sentry.reactNavigationIntegration()`
27
+ */
22
28
  export class ReactNavigationInstrumentation extends InternalRoutingInstrumentation {
23
29
  constructor(options = {}) {
24
30
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAA2B,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAE3F,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,yCAAyC,GAC1C,MAAM,SAAS,CAAC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,CAAC;AAE/E,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,cAAc;IACpB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,8BAA8B,CAAC,mBAAmB;KAC9E;IACD,IAAI,EAAE,EAAE;CACT,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { getActiveSpan, startInactiveSpan } from '@sentry/core';\nimport type { Span, Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NewFrameEvent } from '../utils/sentryeventemitter';\nimport { type SentryEventEmitter, createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport {\n customTransactionSource,\n defaultTransactionSource,\n getBlankTransactionContext,\n setSpanDurationAsMeasurementOnTransaction,\n} from './utils';\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\ninterface ReactNavigationOptions {\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 * Time is in ms.\n *\n * @default 1000\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\nconst defaultOptions: ReactNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n enableTimeToInitialDisplay: false,\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 class ReactNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v5';\n\n public readonly name: string = ReactNavigationInstrumentation.instrumentationName;\n\n private _navigationContainer: NavigationContainer | null = null;\n private _newScreenFrameEventEmitter: SentryEventEmitter | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _latestRoute?: NavigationRoute;\n private _latestTransaction?: TransactionType;\n private _navigationProcessingSpan?: Span;\n\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n private _recentRouteKeys: string[] = [];\n\n private _options: ReactNavigationOptions;\n\n public constructor(options: Partial<ReactNavigationOptions> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n\n if (this._options.enableTimeToInitialDisplay) {\n this._newScreenFrameEventEmitter = createSentryEventEmitter();\n this._newScreenFrameEventEmitter.initAsync(NewFrameEventName);\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`[ReactNavigationInstrumentation] Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n if (!this._initialStateHandled) {\n this._onDispatch();\n if (this._navigationContainer) {\n // Navigation container already registered, just populate with route state\n this._onStateChange();\n\n this._initialStateHandled = true;\n }\n }\n }\n\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerNavigationContainer(navigationContainerRef: any): 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 if ('current' in navigationContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._navigationContainer = navigationContainerRef.current;\n } else {\n this._navigationContainer = navigationContainerRef;\n }\n\n if (this._navigationContainer) {\n this._navigationContainer.addListener(\n '__unsafe_action__', // This action is emitted on every dispatch\n this._onDispatch.bind(this),\n );\n this._navigationContainer.addListener(\n 'state', // This action is emitted on every state change\n this._onStateChange.bind(this),\n );\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n // If registerRoutingInstrumentation was called first _onDispatch has already been called\n this._onStateChange();\n\n this._initialStateHandled = true;\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.',\n );\n }\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n } else {\n logger.warn('[ReactNavigationInstrumentation] Received invalid navigation container ref!');\n }\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Instrumentation already exists, but register has been called again, doing nothing.',\n );\n }\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 _onStateChange\n */\n private _onDispatch(): void {\n if (this._latestTransaction) {\n logger.log(\n '[ReactNavigationInstrumentation] A transaction was detected that turned out to be a noop, discarding.',\n );\n this._discardLatestTransaction();\n this._clearStateChangeTimeout();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNavigationInstrumentation.instrumentationName),\n );\n\n if (this._options.enableTimeToInitialDisplay) {\n this._navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation processing',\n startTimestamp: this._latestTransaction?.startTimestamp,\n });\n }\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onStateChange(): void {\n const stateChangedTimestamp = timestampInSeconds();\n\n // Use the getCurrentRoute method to be accurate.\n const previousRoute = this._latestRoute;\n\n if (!this._navigationContainer) {\n logger.warn(\n '[ReactNavigationInstrumentation] Missing navigation container ref. Route transactions will not be sent.',\n );\n\n return;\n }\n\n const route = this._navigationContainer.getCurrentRoute();\n\n if (route) {\n if (this._latestTransaction) {\n if (!previousRoute || previousRoute.key !== route.key) {\n const routeHasBeenSeen = this._recentRouteKeys.includes(route.key);\n const latestTransaction = this._latestTransaction;\n const latestTtidSpan =\n !routeHasBeenSeen &&\n this._options.enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n !routeHasBeenSeen &&\n latestTtidSpan &&\n this._newScreenFrameEventEmitter?.once(\n NewFrameEventName,\n ({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn(\n '[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.',\n );\n return;\n }\n\n latestTtidSpan.setStatus('ok');\n latestTtidSpan.end(newFrameTimestampInSeconds);\n setSpanDurationAsMeasurementOnTransaction(latestTransaction, 'time_to_initial_display', latestTtidSpan);\n },\n );\n\n this._navigationProcessingSpan?.updateName(`Processing navigation to ${route.name}`);\n this._navigationProcessingSpan?.setStatus('ok');\n this._navigationProcessingSpan?.end(stateChangedTimestamp);\n this._navigationProcessingSpan = undefined;\n\n const originalContext = latestTransaction.toContext() as typeof BLANK_TRANSACTION_CONTEXT;\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n name: route.name,\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.name,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n const updatedContext: ReactNavigationTransactionContext = {\n ...originalContext,\n name: route.name,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': route.name,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n }\n\n this._pushRecentRouteKey(route.key);\n this._latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n this._latestTransaction = undefined;\n }\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationInstrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n // Note: finalContext.sampled will be false at this point only if the user sets it to be so in beforeNavigate.\n if (finalContext.sampled === false) {\n logger.log(\n `[ReactNavigationInstrumentation] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`,\n );\n } else {\n // Clear the timeout so the transaction does not get cancelled.\n this._clearStateChangeTimeout();\n }\n\n return finalContext;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n if (this._navigationProcessingSpan) {\n this._navigationProcessingSpan = undefined;\n }\n }\n\n /**\n *\n */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n\n/**\n * Backwards compatibility alias for ReactNavigationInstrumentation\n * @deprecated Use ReactNavigationInstrumentation\n */\nexport const ReactNavigationV5Instrumentation = ReactNavigationInstrumentation;\n\nexport const BLANK_TRANSACTION_CONTEXT = {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationInstrumentation.instrumentationName,\n },\n data: {},\n};\n"]}
1
+ {"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAA2B,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAE3F,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,yCAAyC,GAC1C,MAAM,SAAS,CAAC;AAiCjB,MAAM,cAAc,GAA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AS,CAAC;SACtC;IACH,CAAC;;AArTa,kDAAmB,GAAW,qBAAqB,CAAC;AAwTpE;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,8BAA8B,CAAC;AAE/E,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,cAAc;IACpB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,8BAA8B,CAAC,mBAAmB;KAC9E;IACD,IAAI,EAAE,EAAE;CACT,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { getActiveSpan, startInactiveSpan } from '@sentry/core';\nimport type { Span, Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NewFrameEvent } from '../utils/sentryeventemitter';\nimport { type SentryEventEmitter, createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport {\n customTransactionSource,\n defaultTransactionSource,\n getBlankTransactionContext,\n setSpanDurationAsMeasurementOnTransaction,\n} from './utils';\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\ninterface ReactNavigationOptions {\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 * Time is in ms.\n *\n * @default 1000\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\nconst defaultOptions: ReactNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n enableTimeToInitialDisplay: false,\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 options: Partial<ReactNavigationOptions> = {},\n): ReactNavigationInstrumentation => {\n return new ReactNavigationInstrumentation(options);\n};\n\n/**\n * @deprecated Please use `Sentry.reactNavigationIntegration()`\n */\nexport class ReactNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v5';\n\n public readonly name: string = ReactNavigationInstrumentation.instrumentationName;\n\n private _navigationContainer: NavigationContainer | null = null;\n private _newScreenFrameEventEmitter: SentryEventEmitter | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _latestRoute?: NavigationRoute;\n private _latestTransaction?: TransactionType;\n private _navigationProcessingSpan?: Span;\n\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n private _recentRouteKeys: string[] = [];\n\n private _options: ReactNavigationOptions;\n\n public constructor(options: Partial<ReactNavigationOptions> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n\n if (this._options.enableTimeToInitialDisplay) {\n this._newScreenFrameEventEmitter = createSentryEventEmitter();\n this._newScreenFrameEventEmitter.initAsync(NewFrameEventName);\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`[ReactNavigationInstrumentation] Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n if (!this._initialStateHandled) {\n this._onDispatch();\n if (this._navigationContainer) {\n // Navigation container already registered, just populate with route state\n this._onStateChange();\n\n this._initialStateHandled = true;\n }\n }\n }\n\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerNavigationContainer(navigationContainerRef: any): 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 if ('current' in navigationContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._navigationContainer = navigationContainerRef.current;\n } else {\n this._navigationContainer = navigationContainerRef;\n }\n\n if (this._navigationContainer) {\n this._navigationContainer.addListener(\n '__unsafe_action__', // This action is emitted on every dispatch\n this._onDispatch.bind(this),\n );\n this._navigationContainer.addListener(\n 'state', // This action is emitted on every state change\n this._onStateChange.bind(this),\n );\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n // If registerRoutingInstrumentation was called first _onDispatch has already been called\n this._onStateChange();\n\n this._initialStateHandled = true;\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.',\n );\n }\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n } else {\n logger.warn('[ReactNavigationInstrumentation] Received invalid navigation container ref!');\n }\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Instrumentation already exists, but register has been called again, doing nothing.',\n );\n }\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 _onStateChange\n */\n private _onDispatch(): void {\n if (this._latestTransaction) {\n logger.log(\n '[ReactNavigationInstrumentation] A transaction was detected that turned out to be a noop, discarding.',\n );\n this._discardLatestTransaction();\n this._clearStateChangeTimeout();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNavigationInstrumentation.instrumentationName),\n );\n\n if (this._options.enableTimeToInitialDisplay) {\n this._navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation processing',\n startTimestamp: this._latestTransaction?.startTimestamp,\n });\n }\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onStateChange(): void {\n const stateChangedTimestamp = timestampInSeconds();\n\n // Use the getCurrentRoute method to be accurate.\n const previousRoute = this._latestRoute;\n\n if (!this._navigationContainer) {\n logger.warn(\n '[ReactNavigationInstrumentation] Missing navigation container ref. Route transactions will not be sent.',\n );\n\n return;\n }\n\n const route = this._navigationContainer.getCurrentRoute();\n\n if (route) {\n if (this._latestTransaction) {\n if (!previousRoute || previousRoute.key !== route.key) {\n const routeHasBeenSeen = this._recentRouteKeys.includes(route.key);\n const latestTransaction = this._latestTransaction;\n const latestTtidSpan =\n !routeHasBeenSeen &&\n this._options.enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n !routeHasBeenSeen &&\n latestTtidSpan &&\n this._newScreenFrameEventEmitter?.once(\n NewFrameEventName,\n ({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn(\n '[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.',\n );\n return;\n }\n\n latestTtidSpan.setStatus('ok');\n latestTtidSpan.end(newFrameTimestampInSeconds);\n setSpanDurationAsMeasurementOnTransaction(latestTransaction, 'time_to_initial_display', latestTtidSpan);\n },\n );\n\n this._navigationProcessingSpan?.updateName(`Processing navigation to ${route.name}`);\n this._navigationProcessingSpan?.setStatus('ok');\n this._navigationProcessingSpan?.end(stateChangedTimestamp);\n this._navigationProcessingSpan = undefined;\n\n const originalContext = latestTransaction.toContext() as typeof BLANK_TRANSACTION_CONTEXT;\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n name: route.name,\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.name,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n const updatedContext: ReactNavigationTransactionContext = {\n ...originalContext,\n name: route.name,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': route.name,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n }\n\n this._pushRecentRouteKey(route.key);\n this._latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n this._latestTransaction = undefined;\n }\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationInstrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n // Note: finalContext.sampled will be false at this point only if the user sets it to be so in beforeNavigate.\n if (finalContext.sampled === false) {\n logger.log(\n `[ReactNavigationInstrumentation] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`,\n );\n } else {\n // Clear the timeout so the transaction does not get cancelled.\n this._clearStateChangeTimeout();\n }\n\n return finalContext;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n if (this._navigationProcessingSpan) {\n this._navigationProcessingSpan = undefined;\n }\n }\n\n /**\n *\n */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n\n/**\n * Backwards compatibility alias for ReactNavigationInstrumentation\n * @deprecated Use ReactNavigationInstrumentation\n */\nexport const ReactNavigationV5Instrumentation = ReactNavigationInstrumentation;\n\nexport const BLANK_TRANSACTION_CONTEXT = {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationInstrumentation.instrumentationName,\n },\n data: {},\n};\n"]}
@@ -35,6 +35,8 @@ interface ReactNavigationV4Options {
35
35
  /**
36
36
  * Instrumentation for React-Navigation V4.
37
37
  * Register the app container with `registerAppContainer` to use, or see docs for more details.
38
+ *
39
+ * @deprecated Support for `react-navigation@4` and older will be removed in the next major version of the SDK. Please upgrade to `react-navigation@5` or newer.
38
40
  */
39
41
  declare class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {
40
42
  static instrumentationName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigationv4.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mapp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AG,GAAG,IAAI;IAmCvD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAchC;;;OAGG;IACH,OAAO,CAAC,YAAY;IAcpB;;OAEG;IACH,OAAO,CAAC,cAAc;IA4CtB,4DAA4D;IAC5D,OAAO,CAAC,oBAAoB;IAsB5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAiC9B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAejC,sGAAsG;IACtG,OAAO,CAAC,mBAAmB,CAMzB;IAEF,6EAA6E;IAC7E,OAAO,CAAC,2BAA2B,CAIjC;IAEF,wEAAwE;IACxE,OAAO,CAAC,yBAAyB;CAOlC;AAED,QAAA,MAAM,8BAA8B,EAAE,kBAUrC,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC"}
@@ -8,6 +8,8 @@ const defaultOptions = {
8
8
  /**
9
9
  * Instrumentation for React-Navigation V4.
10
10
  * Register the app container with `registerAppContainer` to use, or see docs for more details.
11
+ *
12
+ * @deprecated Support for `react-navigation@4` and older will be removed in the next major version of the SDK. Please upgrade to `react-navigation@5` or newer.
11
13
  */
12
14
  class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {
13
15
  constructor(options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigationv4.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAyC5E,MAAM,cAAc,GAA6B;IAC/C,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,gCAAiC,SAAQ,8BAA8B;IAkB3E,YAAmB,UAA6C,EAAE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,GAAuB;IACzD,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,gCAAgC,CAAC,mBAAmB;KAChF;IACD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Transaction, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource } from './utils';\n\nexport interface NavigationRouteV4 {\n routeName: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\nexport interface NavigationStateV4 {\n index: number;\n key: string;\n isTransitioning: boolean;\n routeName?: string;\n routes: (NavigationRouteV4 | NavigationStateV4)[];\n}\n\nexport interface AppContainerInstance {\n _navigation: {\n state: NavigationStateV4;\n router: {\n getStateForAction: (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n action: any,\n state: NavigationStateV4,\n ) => NavigationStateV4;\n };\n };\n}\n\ninterface ReactNavigationV4Options {\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 * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNavigationV4Options = {\n routeChangeTimeoutMs: 1000,\n};\n\n/**\n * Instrumentation for React-Navigation V4.\n * Register the app container with `registerAppContainer` to use, or see docs for more details.\n */\nclass ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v4';\n\n public readonly name: string = ReactNavigationV4Instrumentation.instrumentationName;\n\n private _appContainer: AppContainerInstance | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _prevRoute?: NavigationRouteV4;\n private _recentRouteKeys: string[] = [];\n\n private _latestTransaction?: Transaction;\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n\n private _options: ReactNavigationV4Options;\n\n public constructor(options: Partial<ReactNavigationV4Options> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.\n if (!this._initialStateHandled) {\n this._latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT_V4);\n if (this._appContainer) {\n this._updateLatestTransaction();\n\n this._initialStateHandled = true;\n } else {\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n }\n }\n\n /**\n * Pass the ref to the app container to register it to the instrumentation\n * @param appContainerRef Ref to an `AppContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerAppContainer(appContainerRef: any): 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_v4_registered) {\n if ('current' in appContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._appContainer = appContainerRef.current;\n } else {\n this._appContainer = appContainerRef;\n }\n\n if (this._appContainer) {\n this._patchRouter();\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n this._updateLatestTransaction();\n } else {\n logger.log(\n '[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.',\n );\n }\n this._initialStateHandled = true;\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v4_registered = true;\n } else {\n logger.warn('[ReactNavigationV4Instrumentation] Received invalid app container ref!');\n }\n }\n }\n\n /**\n * Updates the latest transaction with the current state and calls beforeNavigate.\n */\n private _updateLatestTransaction(): void {\n // We can assume the ref is present as this is called from registerAppContainer\n if (this._appContainer && this._latestTransaction) {\n const state = this._appContainer._navigation.state;\n\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n\n this._onStateChange(state, true);\n }\n }\n\n /**\n * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the\n * new screen is mounted.\n */\n private _patchRouter(): void {\n if (this._appContainer) {\n const originalGetStateForAction = this._appContainer._navigation.router.getStateForAction;\n\n this._appContainer._navigation.router.getStateForAction = (action, state) => {\n const newState = originalGetStateForAction(action, state);\n\n this._onStateChange(newState);\n\n return newState;\n };\n }\n }\n\n /**\n * To be called on navigation state changes and creates the transaction.\n */\n private _onStateChange(state: NavigationStateV4 | undefined, updateLatestTransaction: boolean = false): void {\n // it's not guaranteed that a state is always produced.\n // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301\n if (!state || state === undefined) {\n logger.warn('[ReactNavigationV4Instrumentation] onStateChange called without a valid state.');\n\n return;\n }\n\n const currentRoute = this._getCurrentRouteFromState(state);\n\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (!this._prevRoute || currentRoute.key !== this._prevRoute.key) {\n const originalContext = this._getTransactionContext(currentRoute, this._prevRoute);\n\n let mergedContext = originalContext;\n if (updateLatestTransaction && this._latestTransaction) {\n mergedContext = {\n ...this._latestTransaction.toContext(),\n ...originalContext,\n };\n }\n\n const finalContext = this._prepareFinalContext(mergedContext);\n\n if (updateLatestTransaction && this._latestTransaction) {\n // Update the latest transaction instead of calling onRouteWillChange\n this._latestTransaction.updateWithContext(finalContext);\n const isCustomName = mergedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n } else {\n this._latestTransaction = this.onRouteWillChange(finalContext);\n }\n\n this._onConfirmRoute?.(finalContext);\n\n this._pushRecentRouteKey(currentRoute.key);\n this._prevRoute = currentRoute;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(mergedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...mergedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationV4Instrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...mergedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n this._onBeforeNavigateNotSampled(finalContext.name);\n }\n\n return finalContext;\n }\n\n /**\n * Gets the transaction context for a `NavigationRouteV4`\n */\n private _getTransactionContext(\n route: NavigationRouteV4,\n previousRoute?: NavigationRouteV4,\n ): ReactNavigationTransactionContext {\n const data: RouteChangeContextData = {\n route: {\n name: route.routeName, // Include name here too for use in `beforeNavigate`\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: this._recentRouteKeys.includes(route.key),\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.routeName,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n return {\n name: route.routeName,\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n 'routing.route.name': route.routeName,\n },\n data,\n };\n }\n\n /**\n * Gets the current route given a navigation state\n */\n private _getCurrentRouteFromState(state: NavigationStateV4): NavigationRouteV4 {\n const parentRoute = state.routes[state.index];\n\n if (\n 'index' in parentRoute &&\n 'routes' in parentRoute &&\n typeof parentRoute.index === 'number' &&\n Array.isArray(parentRoute.routes)\n ) {\n return this._getCurrentRouteFromState(parentRoute);\n }\n\n return parentRoute as NavigationRouteV4;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Helper to log a transaction that was not sampled due to beforeNavigate */\n private _onBeforeNavigateNotSampled = (transactionName: string): void => {\n logger.log(\n `[ReactNavigationV4Instrumentation] Will not send transaction \"${transactionName}\" due to beforeNavigate.`,\n );\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n }\n}\n\nconst INITIAL_TRANSACTION_CONTEXT_V4: TransactionContext = {\n name: 'App Launch',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n },\n data: {},\n metadata: {\n source: 'view',\n },\n};\n\nexport { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };\n"]}
1
+ {"version":3,"file":"reactnavigationv4.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAyC5E,MAAM,cAAc,GAA6B;IAC/C,oBAAoB,EAAE,IAAI;CAC3B,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AS,CAAC;SACrC;IACH,CAAC;;AAlRa,oDAAmB,GAAW,qBAAqB,CAAC;AAqRpE,MAAM,8BAA8B,GAAuB;IACzD,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,gCAAgC,CAAC,mBAAmB;KAChF;IACD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Transaction, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource } from './utils';\n\nexport interface NavigationRouteV4 {\n routeName: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\nexport interface NavigationStateV4 {\n index: number;\n key: string;\n isTransitioning: boolean;\n routeName?: string;\n routes: (NavigationRouteV4 | NavigationStateV4)[];\n}\n\nexport interface AppContainerInstance {\n _navigation: {\n state: NavigationStateV4;\n router: {\n getStateForAction: (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n action: any,\n state: NavigationStateV4,\n ) => NavigationStateV4;\n };\n };\n}\n\ninterface ReactNavigationV4Options {\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 * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNavigationV4Options = {\n routeChangeTimeoutMs: 1000,\n};\n\n/**\n * Instrumentation for React-Navigation V4.\n * Register the app container with `registerAppContainer` to use, or see docs for more details.\n *\n * @deprecated Support for `react-navigation@4` and older will be removed in the next major version of the SDK. Please upgrade to `react-navigation@5` or newer.\n */\nclass ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v4';\n\n public readonly name: string = ReactNavigationV4Instrumentation.instrumentationName;\n\n private _appContainer: AppContainerInstance | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _prevRoute?: NavigationRouteV4;\n private _recentRouteKeys: string[] = [];\n\n private _latestTransaction?: Transaction;\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n\n private _options: ReactNavigationV4Options;\n\n public constructor(options: Partial<ReactNavigationV4Options> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.\n if (!this._initialStateHandled) {\n this._latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT_V4);\n if (this._appContainer) {\n this._updateLatestTransaction();\n\n this._initialStateHandled = true;\n } else {\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n }\n }\n\n /**\n * Pass the ref to the app container to register it to the instrumentation\n * @param appContainerRef Ref to an `AppContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerAppContainer(appContainerRef: any): 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_v4_registered) {\n if ('current' in appContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._appContainer = appContainerRef.current;\n } else {\n this._appContainer = appContainerRef;\n }\n\n if (this._appContainer) {\n this._patchRouter();\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n this._updateLatestTransaction();\n } else {\n logger.log(\n '[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.',\n );\n }\n this._initialStateHandled = true;\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v4_registered = true;\n } else {\n logger.warn('[ReactNavigationV4Instrumentation] Received invalid app container ref!');\n }\n }\n }\n\n /**\n * Updates the latest transaction with the current state and calls beforeNavigate.\n */\n private _updateLatestTransaction(): void {\n // We can assume the ref is present as this is called from registerAppContainer\n if (this._appContainer && this._latestTransaction) {\n const state = this._appContainer._navigation.state;\n\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n\n this._onStateChange(state, true);\n }\n }\n\n /**\n * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the\n * new screen is mounted.\n */\n private _patchRouter(): void {\n if (this._appContainer) {\n const originalGetStateForAction = this._appContainer._navigation.router.getStateForAction;\n\n this._appContainer._navigation.router.getStateForAction = (action, state) => {\n const newState = originalGetStateForAction(action, state);\n\n this._onStateChange(newState);\n\n return newState;\n };\n }\n }\n\n /**\n * To be called on navigation state changes and creates the transaction.\n */\n private _onStateChange(state: NavigationStateV4 | undefined, updateLatestTransaction: boolean = false): void {\n // it's not guaranteed that a state is always produced.\n // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301\n if (!state || state === undefined) {\n logger.warn('[ReactNavigationV4Instrumentation] onStateChange called without a valid state.');\n\n return;\n }\n\n const currentRoute = this._getCurrentRouteFromState(state);\n\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (!this._prevRoute || currentRoute.key !== this._prevRoute.key) {\n const originalContext = this._getTransactionContext(currentRoute, this._prevRoute);\n\n let mergedContext = originalContext;\n if (updateLatestTransaction && this._latestTransaction) {\n mergedContext = {\n ...this._latestTransaction.toContext(),\n ...originalContext,\n };\n }\n\n const finalContext = this._prepareFinalContext(mergedContext);\n\n if (updateLatestTransaction && this._latestTransaction) {\n // Update the latest transaction instead of calling onRouteWillChange\n this._latestTransaction.updateWithContext(finalContext);\n const isCustomName = mergedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n } else {\n this._latestTransaction = this.onRouteWillChange(finalContext);\n }\n\n this._onConfirmRoute?.(finalContext);\n\n this._pushRecentRouteKey(currentRoute.key);\n this._prevRoute = currentRoute;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(mergedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...mergedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationV4Instrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...mergedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n this._onBeforeNavigateNotSampled(finalContext.name);\n }\n\n return finalContext;\n }\n\n /**\n * Gets the transaction context for a `NavigationRouteV4`\n */\n private _getTransactionContext(\n route: NavigationRouteV4,\n previousRoute?: NavigationRouteV4,\n ): ReactNavigationTransactionContext {\n const data: RouteChangeContextData = {\n route: {\n name: route.routeName, // Include name here too for use in `beforeNavigate`\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: this._recentRouteKeys.includes(route.key),\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.routeName,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n return {\n name: route.routeName,\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n 'routing.route.name': route.routeName,\n },\n data,\n };\n }\n\n /**\n * Gets the current route given a navigation state\n */\n private _getCurrentRouteFromState(state: NavigationStateV4): NavigationRouteV4 {\n const parentRoute = state.routes[state.index];\n\n if (\n 'index' in parentRoute &&\n 'routes' in parentRoute &&\n typeof parentRoute.index === 'number' &&\n Array.isArray(parentRoute.routes)\n ) {\n return this._getCurrentRouteFromState(parentRoute);\n }\n\n return parentRoute as NavigationRouteV4;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Helper to log a transaction that was not sampled due to beforeNavigate */\n private _onBeforeNavigateNotSampled = (transactionName: string): void => {\n logger.log(\n `[ReactNavigationV4Instrumentation] Will not send transaction \"${transactionName}\" due to beforeNavigate.`,\n );\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n }\n}\n\nconst INITIAL_TRANSACTION_CONTEXT_V4: TransactionContext = {\n name: 'App Launch',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n },\n data: {},\n metadata: {\n source: 'view',\n },\n};\n\nexport { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };\n"]}
@@ -3,6 +3,11 @@ import type { Transaction, TransactionContext } from '@sentry/types';
3
3
  import type { BeforeNavigate } from './types';
4
4
  export type TransactionCreator = (context: TransactionContext) => Transaction | undefined;
5
5
  export type OnConfirmRoute = (context: TransactionContext) => void;
6
+ /**
7
+ * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.
8
+ *
9
+ * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.
10
+ */
6
11
  export interface RoutingInstrumentationInstance {
7
12
  /**
8
13
  * Name of the routing instrumentation
@@ -27,8 +32,9 @@ export interface RoutingInstrumentationInstance {
27
32
  onRouteWillChange(context: TransactionContext): Transaction | undefined;
28
33
  }
29
34
  /**
30
- * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.
31
- * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.
35
+ * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.
36
+ *
37
+ * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.
32
38
  */
33
39
  export declare class RoutingInstrumentation implements RoutingInstrumentationInstance {
34
40
  static instrumentationName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"routingInstrumentation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,WAAW,GAAG,SAAS,CAAC;AAE1F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEnE,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;OAQG;IACH,8BAA8B,CAC5B,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI,CAAC;IACR;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAA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ACtB;;;;;;;;OAQG;IACH,8BAA8B,CAC5B,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI,CAAC;IACR;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS,CAAC;CACzE;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,8BAA8B;IAC3E,OAAc,mBAAmB,EAAE,MAAM,CAAkC;IAE3E,SAAgB,IAAI,EAAE,MAAM,CAA8C;IAE1E,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC;IACrC,SAAS,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IAEhD,kBAAkB;IACX,8BAA8B,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAMP,kBAAkB;IACX,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS;CAS/E;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS;CAG/E"}
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.
3
- * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.
2
+ * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.
3
+ *
4
+ * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.
4
5
  */
5
6
  export class RoutingInstrumentation {
6
7
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"routingInstrumentation.js","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AAqCA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAGkB,SAAI,GAAW,sBAAsB,CAAC,mBAAmB,CAAC;IA4B5E,CAAC;IArBC,kBAAkB;IACX,8BAA8B,CACnC,QAA4B,EAC5B,cAA8B,EAC9B,cAA8B;QAE9B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;QAErD,IAAI,WAAW,EAAE;YACf,MAAA,IAAI,CAAC,eAAe,qDAAG,OAAO,CAAC,CAAC;SACjC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;;AA7Ba,0CAAmB,GAAW,8BAA8B,CAAC;AAgC7E;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,OAAO,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { Hub } from '@sentry/core';\nimport type { Transaction, TransactionContext } from '@sentry/types';\n\nimport type { BeforeNavigate } from './types';\n\nexport type TransactionCreator = (context: TransactionContext) => Transaction | undefined;\n\nexport type OnConfirmRoute = (context: TransactionContext) => void;\n\nexport interface RoutingInstrumentationInstance {\n /**\n * Name of the routing instrumentation\n */\n readonly name: string;\n /**\n * Registers a listener that's called on every route change with a `TransactionContext`.\n *\n * Do not overwrite this unless you know what you are doing.\n *\n * @param listener A `RouteListener`\n * @param beforeNavigate BeforeNavigate\n * @param inConfirmRoute OnConfirmRoute\n */\n registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void;\n /**\n * To be called when the route changes, BEFORE the new route mounts.\n * If this is called after a route mounts the child spans will not be correctly attached.\n *\n * @param context A `TransactionContext` used to initialize the transaction.\n */\n onRouteWillChange(context: TransactionContext): Transaction | undefined;\n}\n\n/**\n * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.\n * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.\n */\nexport class RoutingInstrumentation implements RoutingInstrumentationInstance {\n public static instrumentationName: string = 'base-routing-instrumentation';\n\n public readonly name: string = RoutingInstrumentation.instrumentationName;\n\n protected _getCurrentHub?: () => Hub;\n protected _beforeNavigate?: BeforeNavigate;\n protected _onConfirmRoute?: OnConfirmRoute;\n protected _tracingListener?: TransactionCreator;\n\n /** @inheritdoc */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n this._tracingListener = listener;\n this._beforeNavigate = beforeNavigate;\n this._onConfirmRoute = onConfirmRoute;\n }\n\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n const transaction = this._tracingListener?.(context);\n\n if (transaction) {\n this._onConfirmRoute?.(context);\n }\n\n return transaction;\n }\n}\n\n/**\n * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange\n */\nexport class InternalRoutingInstrumentation extends RoutingInstrumentation {\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n return this._tracingListener?.(context);\n }\n}\n"]}
1
+ {"version":3,"file":"routingInstrumentation.js","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AA0CA;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAGkB,SAAI,GAAW,sBAAsB,CAAC,mBAAmB,CAAC;IA4B5E,CAAC;IArBC,kBAAkB;IACX,8BAA8B,CACnC,QAA4B,EAC5B,cAA8B,EAC9B,cAA8B;QAE9B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;QAErD,IAAI,WAAW,EAAE;YACf,MAAA,IAAI,CAAC,eAAe,qDAAG,OAAO,CAAC,CAAC;SACjC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;;AA7Ba,0CAAmB,GAAW,8BAA8B,CAAC;AAgC7E;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,OAAO,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { Hub } from '@sentry/core';\nimport type { Transaction, TransactionContext } from '@sentry/types';\n\nimport type { BeforeNavigate } from './types';\n\nexport type TransactionCreator = (context: TransactionContext) => Transaction | undefined;\n\nexport type OnConfirmRoute = (context: TransactionContext) => void;\n\n/**\n * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.\n *\n * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.\n */\nexport interface RoutingInstrumentationInstance {\n /**\n * Name of the routing instrumentation\n */\n readonly name: string;\n /**\n * Registers a listener that's called on every route change with a `TransactionContext`.\n *\n * Do not overwrite this unless you know what you are doing.\n *\n * @param listener A `RouteListener`\n * @param beforeNavigate BeforeNavigate\n * @param inConfirmRoute OnConfirmRoute\n */\n registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void;\n /**\n * To be called when the route changes, BEFORE the new route mounts.\n * If this is called after a route mounts the child spans will not be correctly attached.\n *\n * @param context A `TransactionContext` used to initialize the transaction.\n */\n onRouteWillChange(context: TransactionContext): Transaction | undefined;\n}\n\n/**\n * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.\n *\n * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.\n */\nexport class RoutingInstrumentation implements RoutingInstrumentationInstance {\n public static instrumentationName: string = 'base-routing-instrumentation';\n\n public readonly name: string = RoutingInstrumentation.instrumentationName;\n\n protected _getCurrentHub?: () => Hub;\n protected _beforeNavigate?: BeforeNavigate;\n protected _onConfirmRoute?: OnConfirmRoute;\n protected _tracingListener?: TransactionCreator;\n\n /** @inheritdoc */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n this._tracingListener = listener;\n this._beforeNavigate = beforeNavigate;\n this._onConfirmRoute = onConfirmRoute;\n }\n\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n const transaction = this._tracingListener?.(context);\n\n if (transaction) {\n this._onConfirmRoute?.(context);\n }\n\n return transaction;\n }\n}\n\n/**\n * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange\n */\nexport class InternalRoutingInstrumentation extends RoutingInstrumentation {\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n return this._tracingListener?.(context);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.31.1";
3
+ export declare const SDK_VERSION = "5.32.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '5.31.1';
3
+ export const SDK_VERSION = '5.32.0';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.31.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.32.0';\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "5.31.1",
5
+ "version": "5.32.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -69,7 +69,7 @@
69
69
  "dependencies": {
70
70
  "@sentry/babel-plugin-component-annotate": "2.20.1",
71
71
  "@sentry/browser": "7.119.0",
72
- "@sentry/cli": "2.34.0",
72
+ "@sentry/cli": "2.36.1",
73
73
  "@sentry/core": "7.119.0",
74
74
  "@sentry/hub": "7.119.0",
75
75
  "@sentry/integrations": "7.119.0",
@@ -9,7 +9,7 @@ export type { ReactNativeOptions } from './options';
9
9
  export { ReactNativeClient } from './client';
10
10
  export { init, wrap, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback, withScope, configureScope, crashedLastRun, } from './sdk';
11
11
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
12
- export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, } from './tracing';
12
+ export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, reactNativeTracingIntegration, reactNavigationIntegration, reactNativeNavigationIntegration, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, } from './tracing';
13
13
  export type { ReactNavigationTransactionContext, TimeToDisplayProps } from './tracing';
14
14
  export {
15
15
  /** @deprecated Import the integration function directly, e.g. `screenshotIntegration()` instead of `new Integrations.Screenshot(). */