@sentry/react-native 8.6.0 → 8.7.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 (349) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/expo-handler/build.gradle +1 -1
  3. package/android/libs/replay-stubs.jar +0 -0
  4. package/android/replay-stubs/build.gradle +1 -1
  5. package/android/src/main/java/io/sentry/react/RNSentryFrameDelayCollector.java +128 -0
  6. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +48 -0
  7. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  8. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +6 -0
  9. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +6 -0
  10. package/dist/js/NativeLogListener.d.ts.map +1 -1
  11. package/dist/js/NativeLogListener.js.map +1 -1
  12. package/dist/js/NativeRNSentry.d.ts +1 -0
  13. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  14. package/dist/js/NativeRNSentry.js.map +1 -1
  15. package/dist/js/RNSentryReplayMaskNativeComponent.d.ts.map +1 -1
  16. package/dist/js/RNSentryReplayMaskNativeComponent.js +1 -2
  17. package/dist/js/RNSentryReplayMaskNativeComponent.js.map +1 -1
  18. package/dist/js/RNSentryReplayUnmaskNativeComponent.d.ts.map +1 -1
  19. package/dist/js/RNSentryReplayUnmaskNativeComponent.js +1 -2
  20. package/dist/js/RNSentryReplayUnmaskNativeComponent.js.map +1 -1
  21. package/dist/js/breadcrumb.d.ts.map +1 -1
  22. package/dist/js/breadcrumb.js.map +1 -1
  23. package/dist/js/client.d.ts.map +1 -1
  24. package/dist/js/client.js +1 -1
  25. package/dist/js/client.js.map +1 -1
  26. package/dist/js/feedback/FeedbackButton.d.ts +2 -1
  27. package/dist/js/feedback/FeedbackButton.d.ts.map +1 -1
  28. package/dist/js/feedback/FeedbackButton.js +5 -4
  29. package/dist/js/feedback/FeedbackButton.js.map +1 -1
  30. package/dist/js/feedback/{FeedbackWidget.d.ts → FeedbackForm.d.ts} +5 -5
  31. package/dist/js/feedback/FeedbackForm.d.ts.map +1 -0
  32. package/dist/js/feedback/{FeedbackWidget.js → FeedbackForm.js} +26 -24
  33. package/dist/js/feedback/FeedbackForm.js.map +1 -0
  34. package/dist/js/feedback/FeedbackForm.styles.d.ts +11 -0
  35. package/dist/js/feedback/FeedbackForm.styles.d.ts.map +1 -0
  36. package/dist/js/feedback/{FeedbackWidget.styles.js → FeedbackForm.styles.js} +1 -1
  37. package/dist/js/feedback/FeedbackForm.styles.js.map +1 -0
  38. package/dist/js/feedback/{FeedbackWidget.theme.d.ts → FeedbackForm.theme.d.ts} +7 -5
  39. package/dist/js/feedback/FeedbackForm.theme.d.ts.map +1 -0
  40. package/dist/js/feedback/{FeedbackWidget.theme.js → FeedbackForm.theme.js} +1 -1
  41. package/dist/js/feedback/FeedbackForm.theme.js.map +1 -0
  42. package/{ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts → dist/js/feedback/FeedbackForm.types.d.ts} +305 -299
  43. package/dist/js/feedback/FeedbackForm.types.d.ts.map +1 -0
  44. package/dist/js/feedback/FeedbackForm.types.js +2 -0
  45. package/dist/js/feedback/FeedbackForm.types.js.map +1 -0
  46. package/dist/js/feedback/{FeedbackWidgetManager.d.ts → FeedbackFormManager.d.ts} +12 -4
  47. package/dist/js/feedback/FeedbackFormManager.d.ts.map +1 -0
  48. package/dist/js/feedback/{FeedbackWidgetManager.js → FeedbackFormManager.js} +22 -13
  49. package/dist/js/feedback/FeedbackFormManager.js.map +1 -0
  50. package/dist/js/feedback/{FeedbackWidgetProvider.d.ts → FeedbackFormProvider.d.ts} +10 -10
  51. package/dist/js/feedback/FeedbackFormProvider.d.ts.map +1 -0
  52. package/dist/js/feedback/{FeedbackWidgetProvider.js → FeedbackFormProvider.js} +18 -15
  53. package/dist/js/feedback/FeedbackFormProvider.js.map +1 -0
  54. package/dist/js/feedback/ScreenshotButton.d.ts +1 -1
  55. package/dist/js/feedback/ScreenshotButton.d.ts.map +1 -1
  56. package/dist/js/feedback/ScreenshotButton.js +6 -5
  57. package/dist/js/feedback/ScreenshotButton.js.map +1 -1
  58. package/dist/js/feedback/ShakeToReportBug.d.ts.map +1 -1
  59. package/dist/js/feedback/ShakeToReportBug.js.map +1 -1
  60. package/dist/js/feedback/defaults.d.ts +2 -2
  61. package/dist/js/feedback/defaults.d.ts.map +1 -1
  62. package/dist/js/feedback/defaults.js.map +1 -1
  63. package/dist/js/feedback/integration.d.ts +11 -11
  64. package/dist/js/feedback/integration.d.ts.map +1 -1
  65. package/dist/js/feedback/integration.js.map +1 -1
  66. package/dist/js/feedback/lazy.d.ts +5 -0
  67. package/dist/js/feedback/lazy.d.ts.map +1 -1
  68. package/dist/js/feedback/lazy.js +12 -0
  69. package/dist/js/feedback/lazy.js.map +1 -1
  70. package/dist/js/feedback/utils.d.ts.map +1 -1
  71. package/dist/js/feedback/utils.js +1 -0
  72. package/dist/js/feedback/utils.js.map +1 -1
  73. package/dist/js/index.d.ts +12 -3
  74. package/dist/js/index.d.ts.map +1 -1
  75. package/dist/js/index.js +12 -3
  76. package/dist/js/index.js.map +1 -1
  77. package/dist/js/integrations/appRegistry.d.ts.map +1 -1
  78. package/dist/js/integrations/appRegistry.js.map +1 -1
  79. package/dist/js/integrations/breadcrumbs.d.ts.map +1 -1
  80. package/dist/js/integrations/breadcrumbs.js +1 -1
  81. package/dist/js/integrations/breadcrumbs.js.map +1 -1
  82. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  83. package/dist/js/integrations/debugsymbolicator.js +1 -2
  84. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  85. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
  86. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  87. package/dist/js/integrations/default.d.ts.map +1 -1
  88. package/dist/js/integrations/default.js +0 -1
  89. package/dist/js/integrations/default.js.map +1 -1
  90. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  91. package/dist/js/integrations/devicecontext.js.map +1 -1
  92. package/dist/js/integrations/expoconstants.d.ts.map +1 -1
  93. package/dist/js/integrations/expoconstants.js.map +1 -1
  94. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  95. package/dist/js/integrations/expocontext.js.map +1 -1
  96. package/dist/js/integrations/expoupdateslistener.d.ts.map +1 -1
  97. package/dist/js/integrations/expoupdateslistener.js +0 -1
  98. package/dist/js/integrations/expoupdateslistener.js.map +1 -1
  99. package/dist/js/integrations/graphql.d.ts.map +1 -1
  100. package/dist/js/integrations/graphql.js.map +1 -1
  101. package/dist/js/integrations/logEnricherIntegration.d.ts.map +1 -1
  102. package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
  103. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  104. package/dist/js/integrations/modulesloader.js.map +1 -1
  105. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  106. package/dist/js/integrations/nativelinkederrors.js +1 -1
  107. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  108. package/dist/js/integrations/primitiveTagIntegration.d.ts.map +1 -1
  109. package/dist/js/integrations/primitiveTagIntegration.js.map +1 -1
  110. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  111. package/dist/js/integrations/reactnativeerrorhandlers.js +2 -1
  112. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  113. package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -1
  114. package/dist/js/integrations/reactnativeerrorhandlersutils.js +0 -5
  115. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
  116. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  117. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  118. package/dist/js/integrations/release.d.ts.map +1 -1
  119. package/dist/js/integrations/release.js.map +1 -1
  120. package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
  121. package/dist/js/integrations/rewriteframes.js.map +1 -1
  122. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  123. package/dist/js/integrations/screenshot.js.map +1 -1
  124. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  125. package/dist/js/integrations/sdkinfo.js.map +1 -1
  126. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  127. package/dist/js/integrations/spotlight.js.map +1 -1
  128. package/dist/js/integrations/supabase.d.ts.map +1 -1
  129. package/dist/js/integrations/supabase.js.map +1 -1
  130. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  131. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  132. package/dist/js/options.d.ts.map +1 -1
  133. package/dist/js/options.js.map +1 -1
  134. package/dist/js/playground/examples.d.ts.map +1 -1
  135. package/dist/js/playground/examples.js.map +1 -1
  136. package/dist/js/playground/modal.d.ts.map +1 -1
  137. package/dist/js/playground/modal.js +4 -102
  138. package/dist/js/playground/modal.js.map +1 -1
  139. package/dist/js/playground/modal.styles.d.ts +100 -0
  140. package/dist/js/playground/modal.styles.d.ts.map +1 -0
  141. package/dist/js/playground/modal.styles.js +98 -0
  142. package/dist/js/playground/modal.styles.js.map +1 -0
  143. package/dist/js/profiling/cache.js +2 -2
  144. package/dist/js/profiling/cache.js.map +1 -1
  145. package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
  146. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  147. package/dist/js/profiling/debugid.d.ts.map +1 -1
  148. package/dist/js/profiling/debugid.js.map +1 -1
  149. package/dist/js/profiling/hermes.d.ts.map +1 -1
  150. package/dist/js/profiling/hermes.js.map +1 -1
  151. package/dist/js/profiling/integration.d.ts.map +1 -1
  152. package/dist/js/profiling/integration.js.map +1 -1
  153. package/dist/js/profiling/types.d.ts.map +1 -1
  154. package/dist/js/profiling/types.js.map +1 -1
  155. package/dist/js/profiling/utils.d.ts.map +1 -1
  156. package/dist/js/profiling/utils.js +1 -1
  157. package/dist/js/profiling/utils.js.map +1 -1
  158. package/dist/js/replay/CustomMask.d.ts +1 -1
  159. package/dist/js/replay/CustomMask.d.ts.map +1 -1
  160. package/dist/js/replay/CustomMask.js +1 -1
  161. package/dist/js/replay/CustomMask.js.map +1 -1
  162. package/dist/js/replay/CustomMask.web.d.ts +1 -1
  163. package/dist/js/replay/CustomMask.web.d.ts.map +1 -1
  164. package/dist/js/replay/CustomMask.web.js +2 -2
  165. package/dist/js/replay/CustomMask.web.js.map +1 -1
  166. package/dist/js/replay/browserReplay.d.ts.map +1 -1
  167. package/dist/js/replay/browserReplay.js +0 -2
  168. package/dist/js/replay/browserReplay.js.map +1 -1
  169. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  170. package/dist/js/replay/mobilereplay.js.map +1 -1
  171. package/dist/js/replay/xhrUtils.d.ts.map +1 -1
  172. package/dist/js/replay/xhrUtils.js.map +1 -1
  173. package/dist/js/scopeSync.d.ts.map +1 -1
  174. package/dist/js/scopeSync.js +1 -1
  175. package/dist/js/scopeSync.js.map +1 -1
  176. package/dist/js/sdk.d.ts +21 -0
  177. package/dist/js/sdk.d.ts.map +1 -1
  178. package/dist/js/sdk.js +38 -16
  179. package/dist/js/sdk.js.map +1 -1
  180. package/dist/js/tools/ModulesCollector.js +1 -1
  181. package/dist/js/tools/ModulesCollector.js.map +1 -1
  182. package/dist/js/tools/collectModules.js +0 -1
  183. package/dist/js/tools/collectModules.js.map +1 -1
  184. package/dist/js/tools/easBuildHooks.d.ts.map +1 -1
  185. package/dist/js/tools/easBuildHooks.js.map +1 -1
  186. package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
  187. package/dist/js/tools/metroMiddleware.js.map +1 -1
  188. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  189. package/dist/js/tools/metroconfig.js +4 -5
  190. package/dist/js/tools/metroconfig.js.map +1 -1
  191. package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
  192. package/dist/js/tools/sentryBabelTransformerUtils.js +2 -3
  193. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  194. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  195. package/dist/js/tools/sentryMetroSerializer.js +4 -5
  196. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  197. package/dist/js/tools/sentryOptionsSerializer.d.ts.map +1 -1
  198. package/dist/js/tools/sentryOptionsSerializer.js +2 -3
  199. package/dist/js/tools/sentryOptionsSerializer.js.map +1 -1
  200. package/dist/js/tools/sentryReleaseInjector.d.ts.map +1 -1
  201. package/dist/js/tools/sentryReleaseInjector.js.map +1 -1
  202. package/dist/js/tools/utils.d.ts.map +1 -1
  203. package/dist/js/tools/utils.js +0 -3
  204. package/dist/js/tools/utils.js.map +1 -1
  205. package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
  206. package/dist/js/tools/vendor/metro/utils.js +5 -5
  207. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  208. package/dist/js/touchevents.d.ts.map +1 -1
  209. package/dist/js/touchevents.js +19 -21
  210. package/dist/js/touchevents.js.map +1 -1
  211. package/dist/js/tracing/expoImage.d.ts.map +1 -1
  212. package/dist/js/tracing/expoImage.js +1 -1
  213. package/dist/js/tracing/expoImage.js.map +1 -1
  214. package/dist/js/tracing/expoRouter.d.ts.map +1 -1
  215. package/dist/js/tracing/expoRouter.js.map +1 -1
  216. package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
  217. package/dist/js/tracing/gesturetracing.js.map +1 -1
  218. package/dist/js/tracing/integrations/appStart.d.ts +18 -0
  219. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  220. package/dist/js/tracing/integrations/appStart.js +141 -6
  221. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  222. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
  223. package/dist/js/tracing/integrations/nativeFrames.js +43 -0
  224. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  225. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
  226. package/dist/js/tracing/integrations/stalltracking.js +0 -1
  227. package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
  228. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
  229. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +1 -1
  230. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  231. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
  232. package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
  233. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  234. package/dist/js/tracing/onSpanEndUtils.js +23 -1
  235. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  236. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  237. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  238. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  239. package/dist/js/tracing/reactnativeprofiler.js +2 -2
  240. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  241. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  242. package/dist/js/tracing/reactnativetracing.js +0 -1
  243. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  244. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  245. package/dist/js/tracing/reactnavigation.js +2 -2
  246. package/dist/js/tracing/reactnavigation.js.map +1 -1
  247. package/dist/js/tracing/span.d.ts.map +1 -1
  248. package/dist/js/tracing/span.js +1 -1
  249. package/dist/js/tracing/span.js.map +1 -1
  250. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  251. package/dist/js/tracing/timetodisplay.js +42 -19
  252. package/dist/js/tracing/timetodisplay.js.map +1 -1
  253. package/dist/js/tracing/timetodisplaynative.d.ts +1 -1
  254. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  255. package/dist/js/tracing/timetodisplaynative.js +5 -4
  256. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  257. package/dist/js/tracing/types.js.map +1 -1
  258. package/dist/js/tracing/utils.d.ts.map +1 -1
  259. package/dist/js/tracing/utils.js.map +1 -1
  260. package/dist/js/transports/native.d.ts.map +1 -1
  261. package/dist/js/transports/native.js.map +1 -1
  262. package/dist/js/utils/envelope.d.ts.map +1 -1
  263. package/dist/js/utils/envelope.js.map +1 -1
  264. package/dist/js/utils/environment.d.ts.map +1 -1
  265. package/dist/js/utils/environment.js.map +1 -1
  266. package/dist/js/utils/expomodules.d.ts.map +1 -1
  267. package/dist/js/utils/expomodules.js.map +1 -1
  268. package/dist/js/utils/fill.js +1 -1
  269. package/dist/js/utils/fill.js.map +1 -1
  270. package/dist/js/utils/normalize.js +2 -2
  271. package/dist/js/utils/normalize.js.map +1 -1
  272. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  273. package/dist/js/utils/rnlibraries.js +1 -7
  274. package/dist/js/utils/rnlibraries.js.map +1 -1
  275. package/dist/js/utils/safe.d.ts.map +1 -1
  276. package/dist/js/utils/safe.js.map +1 -1
  277. package/dist/js/utils/span.d.ts.map +1 -1
  278. package/dist/js/utils/span.js.map +1 -1
  279. package/dist/js/utils/worldwide.d.ts.map +1 -1
  280. package/dist/js/utils/worldwide.js.map +1 -1
  281. package/dist/js/vendor/base64-js/fromByteArray.js +1 -1
  282. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
  283. package/dist/js/vendor/buffer/utf8ToBytes.js +1 -1
  284. package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -1
  285. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  286. package/dist/js/vendor/react-native/index.js.map +1 -1
  287. package/dist/js/version.d.ts +1 -1
  288. package/dist/js/version.js +1 -1
  289. package/dist/js/version.js.map +1 -1
  290. package/dist/js/wrapper.d.ts +1 -0
  291. package/dist/js/wrapper.d.ts.map +1 -1
  292. package/dist/js/wrapper.js +16 -4
  293. package/dist/js/wrapper.js.map +1 -1
  294. package/ios/RNSentry.mm +18 -1
  295. package/ios/RNSentryReplay.mm +1 -1
  296. package/ios/RNSentrySDK.m +1 -1
  297. package/ios/RNSentryTimeToDisplay.m +48 -32
  298. package/ios/RNSentryVersion.m +1 -1
  299. package/ios/SentryScreenFramesWrapper.h +2 -0
  300. package/ios/SentryScreenFramesWrapper.m +35 -0
  301. package/package.json +17 -21
  302. package/plugin/build/logger.js +1 -1
  303. package/plugin/build/utils.js +2 -0
  304. package/plugin/build/withSentry.js +1 -2
  305. package/plugin/build/withSentryAndroid.js +2 -0
  306. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  307. package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
  308. package/plugin/build/withSentryIOS.js +1 -3
  309. package/scripts/eas-build-hook.js +0 -2
  310. package/scripts/expo-upload-sourcemaps.js +0 -1
  311. package/src/js/NativeRNSentry.ts +3 -0
  312. package/src/js/RNSentryReplayMaskNativeComponent.ts +2 -3
  313. package/src/js/RNSentryReplayUnmaskNativeComponent.ts +2 -3
  314. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
  315. package/ts3.8/dist/js/feedback/FeedbackButton.d.ts +2 -1
  316. package/ts3.8/dist/js/feedback/{FeedbackWidget.d.ts → FeedbackForm.d.ts} +5 -5
  317. package/ts3.8/dist/js/feedback/FeedbackForm.styles.d.ts +11 -0
  318. package/ts3.8/dist/js/feedback/{FeedbackWidget.theme.d.ts → FeedbackForm.theme.d.ts} +7 -5
  319. package/{dist/js/feedback/FeedbackWidget.types.d.ts → ts3.8/dist/js/feedback/FeedbackForm.types.d.ts} +305 -299
  320. package/ts3.8/dist/js/feedback/{FeedbackWidgetManager.d.ts → FeedbackFormManager.d.ts} +12 -4
  321. package/ts3.8/dist/js/feedback/{FeedbackWidgetProvider.d.ts → FeedbackFormProvider.d.ts} +10 -10
  322. package/ts3.8/dist/js/feedback/ScreenshotButton.d.ts +1 -1
  323. package/ts3.8/dist/js/feedback/defaults.d.ts +2 -2
  324. package/ts3.8/dist/js/feedback/integration.d.ts +11 -11
  325. package/ts3.8/dist/js/feedback/lazy.d.ts +5 -0
  326. package/ts3.8/dist/js/index.d.ts +12 -3
  327. package/ts3.8/dist/js/playground/modal.styles.d.ts +100 -0
  328. package/ts3.8/dist/js/replay/CustomMask.d.ts +1 -1
  329. package/ts3.8/dist/js/replay/CustomMask.web.d.ts +1 -1
  330. package/ts3.8/dist/js/sdk.d.ts +21 -0
  331. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +18 -0
  332. package/ts3.8/dist/js/tracing/timetodisplaynative.d.ts +1 -1
  333. package/ts3.8/dist/js/version.d.ts +1 -1
  334. package/ts3.8/dist/js/wrapper.d.ts +1 -0
  335. package/dist/js/feedback/FeedbackWidget.d.ts.map +0 -1
  336. package/dist/js/feedback/FeedbackWidget.js.map +0 -1
  337. package/dist/js/feedback/FeedbackWidget.styles.d.ts +0 -11
  338. package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +0 -1
  339. package/dist/js/feedback/FeedbackWidget.styles.js.map +0 -1
  340. package/dist/js/feedback/FeedbackWidget.theme.d.ts.map +0 -1
  341. package/dist/js/feedback/FeedbackWidget.theme.js.map +0 -1
  342. package/dist/js/feedback/FeedbackWidget.types.d.ts.map +0 -1
  343. package/dist/js/feedback/FeedbackWidget.types.js +0 -2
  344. package/dist/js/feedback/FeedbackWidget.types.js.map +0 -1
  345. package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +0 -1
  346. package/dist/js/feedback/FeedbackWidgetManager.js.map +0 -1
  347. package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +0 -1
  348. package/dist/js/feedback/FeedbackWidgetProvider.js.map +0 -1
  349. package/ts3.8/dist/js/feedback/FeedbackWidget.styles.d.ts +0 -11
@@ -30,15 +30,61 @@ const MAX_APP_START_AGE_MS = 60000;
30
30
  const APP_START_TX_NAME = 'App Start';
31
31
  let appStartEndData = undefined;
32
32
  let isRecordedAppStartEndTimestampMsManual = false;
33
+ let isAppLoadedManuallyInvoked = false;
33
34
  let rootComponentCreationTimestampMs = undefined;
34
35
  let isRootComponentCreationTimestampMsManual = false;
35
36
  /**
36
37
  * Records the application start end.
37
38
  * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.
39
+ *
40
+ * @deprecated Use {@link appLoaded} from the public SDK API instead (`Sentry.appLoaded()`).
38
41
  */
39
42
  export function captureAppStart() {
40
43
  return _captureAppStart({ isManual: true });
41
44
  }
45
+ /**
46
+ * Signals that the app has finished loading and is ready for user interaction.
47
+ * Called internally by `appLoaded()` from the public SDK API.
48
+ *
49
+ * @private
50
+ */
51
+ export function _appLoaded() {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ if (isAppLoadedManuallyInvoked) {
54
+ debug.warn('[AppStart] appLoaded() was already called. Subsequent calls are ignored.');
55
+ return;
56
+ }
57
+ const client = getClient();
58
+ if (!client) {
59
+ debug.warn('[AppStart] appLoaded() was called before Sentry.init(). App start end will not be recorded.');
60
+ return;
61
+ }
62
+ isAppLoadedManuallyInvoked = true;
63
+ const timestampMs = timestampInSeconds() * 1000;
64
+ // If auto-capture already ran (ReactNativeProfiler.componentDidMount), overwrite the timestamp.
65
+ // The transaction hasn't been sent yet in non-standalone mode so this is safe.
66
+ if (appStartEndData) {
67
+ debug.log('[AppStart] appLoaded() overwriting auto-detected app start end timestamp.');
68
+ appStartEndData.timestampMs = timestampMs;
69
+ appStartEndData.endFrames = null;
70
+ }
71
+ else {
72
+ _setAppStartEndData({ timestampMs, endFrames: null });
73
+ }
74
+ isRecordedAppStartEndTimestampMsManual = true;
75
+ yield fetchAndUpdateEndFrames();
76
+ const integration = client.getIntegrationByName(INTEGRATION_NAME);
77
+ if (integration) {
78
+ // Cancel any deferred standalone send from auto-capture — we'll send our own
79
+ // with the correct manual timestamp instead of sending two transactions.
80
+ integration.cancelDeferredStandaloneCapture();
81
+ // In standalone mode, auto-capture may have already flushed the transaction.
82
+ // Reset the flag so captureStandaloneAppStart can re-send with the manual timestamp.
83
+ integration.resetAppStartDataFlushed();
84
+ yield integration.captureStandaloneAppStart();
85
+ }
86
+ });
87
+ }
42
88
  /**
43
89
  * For internal use only.
44
90
  *
@@ -46,7 +92,12 @@ export function captureAppStart() {
46
92
  */
47
93
  export function _captureAppStart(_a) {
48
94
  return __awaiter(this, arguments, void 0, function* ({ isManual }) {
49
- var _b;
95
+ // If appLoaded() was already called manually, skip the auto-capture to avoid
96
+ // overwriting the manual end timestamp (race B: appLoaded before componentDidMount).
97
+ if (!isManual && isAppLoadedManuallyInvoked) {
98
+ debug.log('[AppStart] Skipping auto app start capture because appLoaded() was already called.');
99
+ return;
100
+ }
50
101
  const client = getClient();
51
102
  if (!client) {
52
103
  debug.warn('[AppStart] Could not capture App Start, missing client.');
@@ -60,6 +111,27 @@ export function _captureAppStart(_a) {
60
111
  timestampMs,
61
112
  endFrames: null,
62
113
  });
114
+ yield fetchAndUpdateEndFrames();
115
+ const integration = client.getIntegrationByName(INTEGRATION_NAME);
116
+ if (integration) {
117
+ if (!isManual) {
118
+ // For auto-capture, defer the standalone send to give appLoaded() a chance
119
+ // to override the end timestamp before the transaction is sent.
120
+ // If appLoaded() is called, it cancels this deferred send and sends its own.
121
+ // In non-standalone mode, scheduleDeferredStandaloneCapture is a no-op.
122
+ integration.scheduleDeferredStandaloneCapture();
123
+ }
124
+ else {
125
+ yield integration.captureStandaloneAppStart();
126
+ }
127
+ }
128
+ });
129
+ }
130
+ /**
131
+ * Fetches native frames data and attaches it to the current app start end data.
132
+ */
133
+ function fetchAndUpdateEndFrames() {
134
+ return __awaiter(this, void 0, void 0, function* () {
63
135
  if (NATIVE.enableNative) {
64
136
  try {
65
137
  const endFrames = yield NATIVE.fetchNativeFrames();
@@ -70,7 +142,6 @@ export function _captureAppStart(_a) {
70
142
  debug.log('[AppStart] Failed to capture end frames for app start.', error);
71
143
  }
72
144
  }
73
- yield ((_b = client.getIntegrationByName(INTEGRATION_NAME)) === null || _b === void 0 ? void 0 : _b.captureStandaloneAppStart());
74
145
  });
75
146
  }
76
147
  /**
@@ -121,11 +192,21 @@ export const _updateAppStartEndFrames = (endFrames) => {
121
192
  export function _clearRootComponentCreationTimestampMs() {
122
193
  rootComponentCreationTimestampMs = undefined;
123
194
  }
195
+ /**
196
+ * For testing purposes only.
197
+ *
198
+ * @private
199
+ */
200
+ export function _clearAppStartEndData() {
201
+ appStartEndData = undefined;
202
+ isRecordedAppStartEndTimestampMsManual = false;
203
+ isAppLoadedManuallyInvoked = false;
204
+ }
124
205
  /**
125
206
  * Attaches frame data to a span's data object.
126
207
  */
127
208
  function attachFrameDataToSpan(span, frames) {
128
- if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.totalFrames <= 0) {
209
+ if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.frozenFrames <= 0) {
129
210
  debug.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`);
130
211
  return;
131
212
  }
@@ -152,6 +233,8 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
152
233
  let afterAllSetupCalled = false;
153
234
  let firstStartedActiveRootSpanId = undefined;
154
235
  let firstStartedActiveRootSpan = undefined;
236
+ let cachedNativeAppStart = undefined;
237
+ let deferredStandaloneTimeout = undefined;
155
238
  const setup = (client) => {
156
239
  _client = client;
157
240
  const { enableAppStartTracking } = client.getOptions();
@@ -174,6 +257,12 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
174
257
  appStartDataFlushed = false;
175
258
  firstStartedActiveRootSpanId = undefined;
176
259
  firstStartedActiveRootSpan = undefined;
260
+ isAppLoadedManuallyInvoked = false;
261
+ cachedNativeAppStart = undefined;
262
+ if (deferredStandaloneTimeout !== undefined) {
263
+ clearTimeout(deferredStandaloneTimeout);
264
+ deferredStandaloneTimeout = undefined;
265
+ }
177
266
  }
178
267
  else {
179
268
  debug.log('[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.');
@@ -238,7 +327,7 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
238
327
  return __awaiter(this, void 0, void 0, function* () {
239
328
  if (!_client) {
240
329
  // If client is not set, SDK was not initialized, logger is thus disabled
241
- // eslint-disable-next-line no-console
330
+ // oxlint-disable-next-line eslint(no-console)
242
331
  console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');
243
332
  return;
244
333
  }
@@ -313,13 +402,23 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
313
402
  }
314
403
  // All failure paths below set appStartDataFlushed = true to prevent
315
404
  // wasteful retries — these conditions won't change within the same app start.
316
- const appStart = yield NATIVE.fetchNativeAppStart();
405
+ //
406
+ // Use cached response if available (e.g. when _appLoaded() re-triggers
407
+ // standalone capture after auto-capture already fetched from the native layer).
408
+ // The native layer sets has_fetched = true after the first fetch, so a second
409
+ // NATIVE.fetchNativeAppStart() call would incorrectly bail out.
410
+ const isCached = cachedNativeAppStart !== undefined;
411
+ const appStart = isCached ? cachedNativeAppStart : yield NATIVE.fetchNativeAppStart();
412
+ cachedNativeAppStart = appStart;
317
413
  if (!appStart) {
318
414
  debug.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');
319
415
  appStartDataFlushed = true;
320
416
  return;
321
417
  }
322
- if (appStart.has_fetched) {
418
+ // Skip the has_fetched check when using a cached response — the native layer
419
+ // sets has_fetched = true after the first fetch, but we intentionally re-use
420
+ // the data when _appLoaded() overrides the app start end timestamp.
421
+ if (!isCached && appStart.has_fetched) {
323
422
  debug.warn('[AppStart] Measured app start metrics were already reported from the native layer.');
324
423
  appStartDataFlushed = true;
325
424
  return;
@@ -396,6 +495,19 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
396
495
  });
397
496
  if (appStartEndData === null || appStartEndData === void 0 ? void 0 : appStartEndData.endFrames) {
398
497
  attachFrameDataToSpan(appStartSpanJSON, appStartEndData.endFrames);
498
+ try {
499
+ const framesDelay = yield Promise.race([
500
+ NATIVE.fetchNativeFramesDelay(appStartTimestampSeconds, appStartEndTimestampSeconds),
501
+ new Promise(resolve => setTimeout(() => resolve(null), 2000)),
502
+ ]);
503
+ if (framesDelay != null) {
504
+ appStartSpanJSON.data = appStartSpanJSON.data || {};
505
+ appStartSpanJSON.data['frames.delay'] = framesDelay;
506
+ }
507
+ }
508
+ catch (error) {
509
+ debug.log('[AppStart] Error while fetching frames delay for app start span.', error);
510
+ }
399
511
  }
400
512
  const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);
401
513
  const appStartSpans = [
@@ -415,12 +527,35 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
415
527
  debug.log('[AppStart] Added app start measurement to transaction event.', JSON.stringify(measurementValue, undefined, 2));
416
528
  });
417
529
  }
530
+ const resetAppStartDataFlushed = () => {
531
+ appStartDataFlushed = false;
532
+ };
533
+ const cancelDeferredStandaloneCapture = () => {
534
+ if (deferredStandaloneTimeout !== undefined) {
535
+ clearTimeout(deferredStandaloneTimeout);
536
+ deferredStandaloneTimeout = undefined;
537
+ debug.log('[AppStart] Cancelled deferred standalone app start capture.');
538
+ }
539
+ };
540
+ const scheduleDeferredStandaloneCapture = () => {
541
+ if (!standalone) {
542
+ return;
543
+ }
544
+ deferredStandaloneTimeout = setTimeout(() => {
545
+ deferredStandaloneTimeout = undefined;
546
+ // oxlint-disable-next-line typescript-eslint(no-floating-promises)
547
+ captureStandaloneAppStart();
548
+ }, 0);
549
+ };
418
550
  return {
419
551
  name: INTEGRATION_NAME,
420
552
  setup,
421
553
  afterAllSetup,
422
554
  processEvent,
423
555
  captureStandaloneAppStart,
556
+ resetAppStartDataFlushed,
557
+ cancelDeferredStandaloneCapture,
558
+ scheduleDeferredStandaloneCapture,
424
559
  setFirstStartedActiveRootSpanId,
425
560
  };
426
561
  };
@@ -1 +1 @@
1
- {"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gCAAgC,EAChC,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,GACnB,MAAM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A0B;SACnC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,YAAY;YACzB,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable complexity, max-lines */\nimport type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core';\nimport {\n debug,\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n spanIsSampled,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\nimport { getAppRegistryIntegration } from '../../integrations/appRegistry';\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse, NativeFramesResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { setMainThreadInfo } from '../span';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\n\n/**\n * We filter out app start more than 60s.\n * This could be due to many different reasons.\n * We've seen app starts with hours, days and even months.\n */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\ninterface AppStartEndData {\n timestampMs: number;\n endFrames: NativeFramesResponse | null;\n}\n\nlet appStartEndData: AppStartEndData | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n const client = getClient();\n if (!client) {\n debug.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n\n const timestampMs = timestampInSeconds() * 1000;\n\n // Set end timestamp immediately to avoid race with processEvent\n // Frames data will be updated after the async fetch\n _setAppStartEndData({\n timestampMs,\n endFrames: null,\n });\n\n if (NATIVE.enableNative) {\n try {\n const endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for app start.', endFrames);\n _updateAppStartEndFrames(endFrames);\n } catch (error) {\n debug.log('[AppStart] Failed to capture end frames for app start.', error);\n }\n }\n\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n appStartEndData?.timestampMs && debug.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && debug.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndData = (data: AppStartEndData): void => {\n appStartEndData && debug.warn('Overwriting already set app start end data.');\n appStartEndData = data;\n};\n\n/**\n * Updates only the endFrames on existing appStartEndData.\n * Used after the async fetchNativeFrames completes to attach frame data\n * without triggering the overwrite warning from _setAppStartEndData.\n *\n * @private\n */\nexport const _updateAppStartEndFrames = (endFrames: NativeFramesResponse | null): void => {\n if (appStartEndData) {\n appStartEndData.endFrames = endFrames;\n }\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Attaches frame data to a span's data object.\n */\nfunction attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): void {\n if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.totalFrames <= 0) {\n debug.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`);\n return;\n }\n span.data = span.data || {};\n span.data['frames.total'] = frames.totalFrames;\n span.data['frames.slow'] = frames.slowFrames;\n span.data['frames.frozen'] = frames.frozenFrames;\n\n debug.log('[AppStart] Attached frame data to span.', {\n spanId: span.span_id,\n frameData: {\n total: frames.totalFrames,\n slow: frames.slowFrames,\n frozen: frames.frozenFrames,\n },\n });\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n let afterAllSetupCalled = false;\n let firstStartedActiveRootSpanId: string | undefined = undefined;\n let firstStartedActiveRootSpan: Span | undefined = undefined;\n\n const setup = (client: Client): void => {\n _client = client;\n const { enableAppStartTracking } = client.getOptions() as ReactNativeClientOptions;\n\n if (!enableAppStartTracking) {\n isEnabled = false;\n debug.warn('[AppStart] App start tracking is disabled.');\n }\n\n client.on('spanStart', recordFirstStartedActiveRootSpanId);\n };\n\n const afterAllSetup = (client: Client): void => {\n if (afterAllSetupCalled) {\n return;\n }\n afterAllSetupCalled = true;\n\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (appStartDataFlushed) {\n debug.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.');\n appStartDataFlushed = false;\n firstStartedActiveRootSpanId = undefined;\n firstStartedActiveRootSpan = undefined;\n } else {\n debug.log(\n '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.',\n );\n }\n });\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n const recordFirstStartedActiveRootSpanId = (rootSpan: Span): void => {\n if (firstStartedActiveRootSpanId) {\n // Check if the previously locked span was dropped after it ended (e.g., by\n // ignoreEmptyRouteChangeTransactions or ignoreEmptyBackNavigation setting\n // _sampled = false during spanEnd). If so, reset and allow this new span.\n // We check here (at the next spanStart) rather than at spanEnd because\n // the discard listeners run after the app start listener in registration order,\n // so _sampled is not yet false when our own spanEnd listener would fire.\n if (firstStartedActiveRootSpan && !spanIsSampled(firstStartedActiveRootSpan)) {\n debug.log(\n '[AppStart] Previously locked root span was unsampled after ending. Resetting to allow next transaction.',\n );\n resetFirstStartedActiveRootSpanId();\n // Fall through to lock to this new span\n } else {\n return;\n }\n }\n\n if (!isRootSpan(rootSpan)) {\n return;\n }\n\n if (!spanIsSampled(rootSpan)) {\n return;\n }\n\n firstStartedActiveRootSpan = rootSpan;\n setFirstStartedActiveRootSpanId(rootSpan.spanContext().spanId);\n };\n\n /**\n * Resets the first started active root span id and span reference to allow\n * the next root span's transaction to attempt app start attachment.\n */\n const resetFirstStartedActiveRootSpanId = (): void => {\n debug.log('[AppStart] Resetting first started active root span id to allow retry on next transaction.');\n firstStartedActiveRootSpanId = undefined;\n firstStartedActiveRootSpan = undefined;\n };\n\n /**\n * For testing purposes only.\n * @private\n */\n const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => {\n firstStartedActiveRootSpanId = spanId;\n debug.log('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId);\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!_client) {\n // If client is not set, SDK was not initialized, logger is thus disabled\n // eslint-disable-next-line no-console\n console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');\n return;\n }\n\n if (!standalone) {\n debug.log(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n debug.log('[AppStart] App start tracking standalone root span (transaction).');\n\n if (!appStartEndData?.endFrames && NATIVE.enableNative) {\n try {\n const endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for standalone app start.', endFrames);\n\n const currentTimestamp = appStartEndData?.timestampMs || timestampInSeconds() * 1000;\n _setAppStartEndData({\n timestampMs: currentTimestamp,\n endFrames,\n });\n } catch (error) {\n debug.log('[AppStart] Failed to capture frames for standalone app start.', error);\n }\n }\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n debug.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction of the app run\n debug.log('[AppStart] App start data already flushed. Skipping.');\n return;\n }\n\n if (!event.contexts?.trace) {\n debug.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n // When standalone is true, we create our own transaction and don't need to verify\n // it matches the first navigation transaction. When standalone is false, we need to\n // ensure we're attaching app start to the first transaction (not a later one).\n if (!standalone) {\n if (!firstStartedActiveRootSpanId) {\n debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');\n return;\n }\n\n if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {\n debug.warn(\n '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.',\n );\n return;\n }\n }\n\n // All failure paths below set appStartDataFlushed = true to prevent\n // wasteful retries — these conditions won't change within the same app start.\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n debug.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n appStartDataFlushed = true;\n return;\n }\n if (appStart.has_fetched) {\n debug.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n appStartDataFlushed = true;\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n debug.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n appStartDataFlushed = true;\n return;\n }\n\n const appStartEndTimestampMs = appStartEndData?.timestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n debug.warn(\n '[AppStart] Javascript failed to record app start end. `_setAppStartEndData` was not called nor could the bundle start be found.',\n );\n appStartDataFlushed = true;\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n debug.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n appStartDataFlushed = true;\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n debug.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n appStartDataFlushed = true;\n return;\n }\n\n if (appStartDurationMs < 0) {\n // This can happen when MainActivity on Android is recreated,\n // and the app start end timestamp is not updated, for example\n // due to missing `Sentry.wrap(RootComponent)` call.\n debug.warn(\n '[AppStart] Last recorded app start end timestamp is before the app start timestamp.',\n 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.',\n );\n appStartDataFlushed = true;\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n debug.log(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold Start' : 'Warm Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n\n if (appStartEndData?.endFrames) {\n attachFrameDataToSpan(appStartSpanJSON, appStartEndData.endFrames);\n }\n\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n debug.log('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n debug.log(\n '[AppStart] Added app start measurement to transaction event.',\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n setFirstStartedActiveRootSpanId,\n } as AppStartIntegration;\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n debug.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000;\n if (bundleStartTimestampSeconds < parentSpan.start_timestamp) {\n debug.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.');\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n debug.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: bundleStartTimestampSeconds,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans\n .filter(span => span.start_timestamp_ms / 1000 >= parentSpan.start_timestamp)\n .map(span => {\n if (span.description === 'UIKit init') {\n return setMainThreadInfo(createUIKitSpan(parentSpan, span));\n }\n\n return setMainThreadInfo(\n createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n }),\n );\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EACL,KAAK,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gCAAgC,EAChC,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,cAAc,IAAI,0BAA0B,EAC5C,cAAc,IAAI,0BAA0B,GAC7C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,C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AAK,YAAY,EAAE,CAAC;YACtC,OAAO,iBAAiB,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,iBAAiB,CACtB,mBAAmB,CAAC,UAAU,EAAE;YAC9B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,kBAAkB,GAAG,IAAI;YAC/C,SAAS,EAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI;YACvC,MAAM,EAAE,0BAA0B;SACnC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,UAAoB,EAAE,eAAwD;IACrG,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD,iFAAiF;IACjF,yCAAyC;IACzC,6DAA6D;IAC7D,IAAI,WAAW,IAAI,WAAW,GAAG,eAAe,CAAC,gBAAgB,EAAE,CAAC;QAClE,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,6BAA6B;YAC1C,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,WAAW,GAAG,IAAI;YAC7B,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,YAAY;YACzB,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["/* oxlint-disable eslint(complexity), eslint(max-lines) */\nimport type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core';\n\nimport {\n debug,\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n spanIsSampled,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\n\nimport type { NativeAppStartResponse, NativeFramesResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\n\nimport { getAppRegistryIntegration } from '../../integrations/appRegistry';\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { setMainThreadInfo } from '../span';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n resetAppStartDataFlushed: () => void;\n cancelDeferredStandaloneCapture: () => void;\n scheduleDeferredStandaloneCapture: () => void;\n};\n\n/**\n * We filter out app start more than 60s.\n * This could be due to many different reasons.\n * We've seen app starts with hours, days and even months.\n */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\ninterface AppStartEndData {\n timestampMs: number;\n endFrames: NativeFramesResponse | null;\n}\n\nlet appStartEndData: AppStartEndData | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\nlet isAppLoadedManuallyInvoked = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n *\n * @deprecated Use {@link appLoaded} from the public SDK API instead (`Sentry.appLoaded()`).\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * Signals that the app has finished loading and is ready for user interaction.\n * Called internally by `appLoaded()` from the public SDK API.\n *\n * @private\n */\nexport async function _appLoaded(): Promise<void> {\n if (isAppLoadedManuallyInvoked) {\n debug.warn('[AppStart] appLoaded() was already called. Subsequent calls are ignored.');\n return;\n }\n\n const client = getClient();\n if (!client) {\n debug.warn('[AppStart] appLoaded() was called before Sentry.init(). App start end will not be recorded.');\n return;\n }\n\n isAppLoadedManuallyInvoked = true;\n\n const timestampMs = timestampInSeconds() * 1000;\n\n // If auto-capture already ran (ReactNativeProfiler.componentDidMount), overwrite the timestamp.\n // The transaction hasn't been sent yet in non-standalone mode so this is safe.\n if (appStartEndData) {\n debug.log('[AppStart] appLoaded() overwriting auto-detected app start end timestamp.');\n appStartEndData.timestampMs = timestampMs;\n appStartEndData.endFrames = null;\n } else {\n _setAppStartEndData({ timestampMs, endFrames: null });\n }\n isRecordedAppStartEndTimestampMsManual = true;\n\n await fetchAndUpdateEndFrames();\n\n const integration = client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME);\n if (integration) {\n // Cancel any deferred standalone send from auto-capture — we'll send our own\n // with the correct manual timestamp instead of sending two transactions.\n integration.cancelDeferredStandaloneCapture();\n // In standalone mode, auto-capture may have already flushed the transaction.\n // Reset the flag so captureStandaloneAppStart can re-send with the manual timestamp.\n integration.resetAppStartDataFlushed();\n await integration.captureStandaloneAppStart();\n }\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n // If appLoaded() was already called manually, skip the auto-capture to avoid\n // overwriting the manual end timestamp (race B: appLoaded before componentDidMount).\n if (!isManual && isAppLoadedManuallyInvoked) {\n debug.log('[AppStart] Skipping auto app start capture because appLoaded() was already called.');\n return;\n }\n\n const client = getClient();\n if (!client) {\n debug.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n\n const timestampMs = timestampInSeconds() * 1000;\n\n // Set end timestamp immediately to avoid race with processEvent\n // Frames data will be updated after the async fetch\n _setAppStartEndData({\n timestampMs,\n endFrames: null,\n });\n\n await fetchAndUpdateEndFrames();\n\n const integration = client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME);\n if (integration) {\n if (!isManual) {\n // For auto-capture, defer the standalone send to give appLoaded() a chance\n // to override the end timestamp before the transaction is sent.\n // If appLoaded() is called, it cancels this deferred send and sends its own.\n // In non-standalone mode, scheduleDeferredStandaloneCapture is a no-op.\n integration.scheduleDeferredStandaloneCapture();\n } else {\n await integration.captureStandaloneAppStart();\n }\n }\n}\n\n/**\n * Fetches native frames data and attaches it to the current app start end data.\n */\nasync function fetchAndUpdateEndFrames(): Promise<void> {\n if (NATIVE.enableNative) {\n try {\n const endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for app start.', endFrames);\n _updateAppStartEndFrames(endFrames);\n } catch (error) {\n debug.log('[AppStart] Failed to capture end frames for app start.', error);\n }\n }\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n appStartEndData?.timestampMs && debug.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && debug.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndData = (data: AppStartEndData): void => {\n appStartEndData && debug.warn('Overwriting already set app start end data.');\n appStartEndData = data;\n};\n\n/**\n * Updates only the endFrames on existing appStartEndData.\n * Used after the async fetchNativeFrames completes to attach frame data\n * without triggering the overwrite warning from _setAppStartEndData.\n *\n * @private\n */\nexport const _updateAppStartEndFrames = (endFrames: NativeFramesResponse | null): void => {\n if (appStartEndData) {\n appStartEndData.endFrames = endFrames;\n }\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearAppStartEndData(): void {\n appStartEndData = undefined;\n isRecordedAppStartEndTimestampMsManual = false;\n isAppLoadedManuallyInvoked = false;\n}\n\n/**\n * Attaches frame data to a span's data object.\n */\nfunction attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): void {\n if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.frozenFrames <= 0) {\n debug.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`);\n return;\n }\n span.data = span.data || {};\n span.data['frames.total'] = frames.totalFrames;\n span.data['frames.slow'] = frames.slowFrames;\n span.data['frames.frozen'] = frames.frozenFrames;\n\n debug.log('[AppStart] Attached frame data to span.', {\n spanId: span.span_id,\n frameData: {\n total: frames.totalFrames,\n slow: frames.slowFrames,\n frozen: frames.frozenFrames,\n },\n });\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n let afterAllSetupCalled = false;\n let firstStartedActiveRootSpanId: string | undefined = undefined;\n let firstStartedActiveRootSpan: Span | undefined = undefined;\n let cachedNativeAppStart: NativeAppStartResponse | null | undefined = undefined;\n let deferredStandaloneTimeout: ReturnType<typeof setTimeout> | undefined = undefined;\n\n const setup = (client: Client): void => {\n _client = client;\n const { enableAppStartTracking } = client.getOptions() as ReactNativeClientOptions;\n\n if (!enableAppStartTracking) {\n isEnabled = false;\n debug.warn('[AppStart] App start tracking is disabled.');\n }\n\n client.on('spanStart', recordFirstStartedActiveRootSpanId);\n };\n\n const afterAllSetup = (client: Client): void => {\n if (afterAllSetupCalled) {\n return;\n }\n afterAllSetupCalled = true;\n\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (appStartDataFlushed) {\n debug.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.');\n appStartDataFlushed = false;\n firstStartedActiveRootSpanId = undefined;\n firstStartedActiveRootSpan = undefined;\n isAppLoadedManuallyInvoked = false;\n cachedNativeAppStart = undefined;\n if (deferredStandaloneTimeout !== undefined) {\n clearTimeout(deferredStandaloneTimeout);\n deferredStandaloneTimeout = undefined;\n }\n } else {\n debug.log(\n '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.',\n );\n }\n });\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n const recordFirstStartedActiveRootSpanId = (rootSpan: Span): void => {\n if (firstStartedActiveRootSpanId) {\n // Check if the previously locked span was dropped after it ended (e.g., by\n // ignoreEmptyRouteChangeTransactions or ignoreEmptyBackNavigation setting\n // _sampled = false during spanEnd). If so, reset and allow this new span.\n // We check here (at the next spanStart) rather than at spanEnd because\n // the discard listeners run after the app start listener in registration order,\n // so _sampled is not yet false when our own spanEnd listener would fire.\n if (firstStartedActiveRootSpan && !spanIsSampled(firstStartedActiveRootSpan)) {\n debug.log(\n '[AppStart] Previously locked root span was unsampled after ending. Resetting to allow next transaction.',\n );\n resetFirstStartedActiveRootSpanId();\n // Fall through to lock to this new span\n } else {\n return;\n }\n }\n\n if (!isRootSpan(rootSpan)) {\n return;\n }\n\n if (!spanIsSampled(rootSpan)) {\n return;\n }\n\n firstStartedActiveRootSpan = rootSpan;\n setFirstStartedActiveRootSpanId(rootSpan.spanContext().spanId);\n };\n\n /**\n * Resets the first started active root span id and span reference to allow\n * the next root span's transaction to attempt app start attachment.\n */\n const resetFirstStartedActiveRootSpanId = (): void => {\n debug.log('[AppStart] Resetting first started active root span id to allow retry on next transaction.');\n firstStartedActiveRootSpanId = undefined;\n firstStartedActiveRootSpan = undefined;\n };\n\n /**\n * For testing purposes only.\n * @private\n */\n const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => {\n firstStartedActiveRootSpanId = spanId;\n debug.log('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId);\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!_client) {\n // If client is not set, SDK was not initialized, logger is thus disabled\n // oxlint-disable-next-line eslint(no-console)\n console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');\n return;\n }\n\n if (!standalone) {\n debug.log(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n debug.log('[AppStart] App start tracking standalone root span (transaction).');\n\n if (!appStartEndData?.endFrames && NATIVE.enableNative) {\n try {\n const endFrames = await NATIVE.fetchNativeFrames();\n debug.log('[AppStart] Captured end frames for standalone app start.', endFrames);\n\n const currentTimestamp = appStartEndData?.timestampMs || timestampInSeconds() * 1000;\n _setAppStartEndData({\n timestampMs: currentTimestamp,\n endFrames,\n });\n } catch (error) {\n debug.log('[AppStart] Failed to capture frames for standalone app start.', error);\n }\n }\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n debug.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction of the app run\n debug.log('[AppStart] App start data already flushed. Skipping.');\n return;\n }\n\n if (!event.contexts?.trace) {\n debug.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n // When standalone is true, we create our own transaction and don't need to verify\n // it matches the first navigation transaction. When standalone is false, we need to\n // ensure we're attaching app start to the first transaction (not a later one).\n if (!standalone) {\n if (!firstStartedActiveRootSpanId) {\n debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');\n return;\n }\n\n if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {\n debug.warn(\n '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.',\n );\n return;\n }\n }\n\n // All failure paths below set appStartDataFlushed = true to prevent\n // wasteful retries — these conditions won't change within the same app start.\n //\n // Use cached response if available (e.g. when _appLoaded() re-triggers\n // standalone capture after auto-capture already fetched from the native layer).\n // The native layer sets has_fetched = true after the first fetch, so a second\n // NATIVE.fetchNativeAppStart() call would incorrectly bail out.\n const isCached = cachedNativeAppStart !== undefined;\n const appStart = isCached ? cachedNativeAppStart : await NATIVE.fetchNativeAppStart();\n cachedNativeAppStart = appStart;\n if (!appStart) {\n debug.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n appStartDataFlushed = true;\n return;\n }\n // Skip the has_fetched check when using a cached response — the native layer\n // sets has_fetched = true after the first fetch, but we intentionally re-use\n // the data when _appLoaded() overrides the app start end timestamp.\n if (!isCached && appStart.has_fetched) {\n debug.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n appStartDataFlushed = true;\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n debug.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n appStartDataFlushed = true;\n return;\n }\n\n const appStartEndTimestampMs = appStartEndData?.timestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n debug.warn(\n '[AppStart] Javascript failed to record app start end. `_setAppStartEndData` was not called nor could the bundle start be found.',\n );\n appStartDataFlushed = true;\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n debug.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n appStartDataFlushed = true;\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n debug.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n appStartDataFlushed = true;\n return;\n }\n\n if (appStartDurationMs < 0) {\n // This can happen when MainActivity on Android is recreated,\n // and the app start end timestamp is not updated, for example\n // due to missing `Sentry.wrap(RootComponent)` call.\n debug.warn(\n '[AppStart] Last recorded app start end timestamp is before the app start timestamp.',\n 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.',\n );\n appStartDataFlushed = true;\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n debug.log(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold Start' : 'Warm Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n\n if (appStartEndData?.endFrames) {\n attachFrameDataToSpan(appStartSpanJSON, appStartEndData.endFrames);\n\n try {\n const framesDelay = await Promise.race([\n NATIVE.fetchNativeFramesDelay(appStartTimestampSeconds, appStartEndTimestampSeconds),\n new Promise<null>(resolve => setTimeout(() => resolve(null), 2_000)),\n ]);\n if (framesDelay != null) {\n appStartSpanJSON.data = appStartSpanJSON.data || {};\n appStartSpanJSON.data['frames.delay'] = framesDelay;\n }\n } catch (error) {\n debug.log('[AppStart] Error while fetching frames delay for app start span.', error);\n }\n }\n\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n debug.log('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n debug.log(\n '[AppStart] Added app start measurement to transaction event.',\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n const resetAppStartDataFlushed = (): void => {\n appStartDataFlushed = false;\n };\n\n const cancelDeferredStandaloneCapture = (): void => {\n if (deferredStandaloneTimeout !== undefined) {\n clearTimeout(deferredStandaloneTimeout);\n deferredStandaloneTimeout = undefined;\n debug.log('[AppStart] Cancelled deferred standalone app start capture.');\n }\n };\n\n const scheduleDeferredStandaloneCapture = (): void => {\n if (!standalone) {\n return;\n }\n deferredStandaloneTimeout = setTimeout(() => {\n deferredStandaloneTimeout = undefined;\n // oxlint-disable-next-line typescript-eslint(no-floating-promises)\n captureStandaloneAppStart();\n }, 0);\n };\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n resetAppStartDataFlushed,\n cancelDeferredStandaloneCapture,\n scheduleDeferredStandaloneCapture,\n setFirstStartedActiveRootSpanId,\n } as AppStartIntegration;\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n debug.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000;\n if (bundleStartTimestampSeconds < parentSpan.start_timestamp) {\n debug.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.');\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n debug.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: bundleStartTimestampSeconds,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans\n .filter(span => span.start_timestamp_ms / 1000 >= parentSpan.start_timestamp)\n .map(span => {\n if (span.description === 'UIKit init') {\n return setMainThreadInfo(createUIKitSpan(parentSpan, span));\n }\n\n return setMainThreadInfo(\n createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n }),\n );\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"nativeFrames.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/nativeFrames.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,WAAW,EAAE,YAAY,EAAE,eAAe,EAAQ,MAAM,cAAc,CAAC;AAkCpG,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACvD,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACtD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CACzD;AAOD,eAAO,MAAM,8BAA8B,GAAI,QAAQ,OAAO,GAAG,SAAS,KAAG,WAAW,GAAG,SAQ1F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAO,WAkO1C,CAAC"}
1
+ {"version":3,"file":"nativeFrames.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/nativeFrames.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,WAAW,EAAE,YAAY,EAAE,eAAe,EAAQ,MAAM,cAAc,CAAC;AAqCpG,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACvD,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACtD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CACzD;AAOD,eAAO,MAAM,8BAA8B,GAAI,QAAQ,OAAO,GAAG,SAAS,KAAG,WAAW,GAAG,SAQ1F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAO,WA8O1C,CAAC"}
@@ -151,6 +151,18 @@ export const nativeFramesIntegration = () => {
151
151
  span.setAttribute('frames.slow', slowFrames);
152
152
  span.setAttribute('frames.frozen', frozenFrames);
153
153
  debug.log(`[${INTEGRATION_NAME}] Attached frame data to span ${spanId}: total=${totalFrames}, slow=${slowFrames}, frozen=${frozenFrames}`);
154
+ const spanJson = spanToJSON(span);
155
+ if (spanJson.start_timestamp && spanJson.timestamp) {
156
+ try {
157
+ const delay = yield fetchNativeFramesDelay(spanJson.start_timestamp, spanJson.timestamp);
158
+ if (delay != null) {
159
+ span.setAttribute('frames.delay', delay);
160
+ }
161
+ }
162
+ catch (delayError) {
163
+ debug.log(`[${INTEGRATION_NAME}] Error while fetching frames delay for span ${spanId}.`, delayError);
164
+ }
165
+ }
154
166
  }
155
167
  }
156
168
  catch (error) {
@@ -221,6 +233,34 @@ export const nativeFramesIntegration = () => {
221
233
  processEvent,
222
234
  };
223
235
  };
236
+ function withNativeBridgeTimeout(promise, timeoutMessage) {
237
+ return new Promise((resolve, reject) => {
238
+ let settled = false;
239
+ const timeoutId = setTimeout(() => {
240
+ if (!settled) {
241
+ settled = true;
242
+ reject(timeoutMessage);
243
+ }
244
+ }, FETCH_FRAMES_TIMEOUT_MS);
245
+ promise
246
+ .then(value => {
247
+ if (settled) {
248
+ return;
249
+ }
250
+ clearTimeout(timeoutId);
251
+ settled = true;
252
+ resolve(value);
253
+ })
254
+ .then(undefined, error => {
255
+ if (settled) {
256
+ return;
257
+ }
258
+ clearTimeout(timeoutId);
259
+ settled = true;
260
+ reject(error);
261
+ });
262
+ });
263
+ }
224
264
  function fetchNativeFrames() {
225
265
  return new Promise((resolve, reject) => {
226
266
  let settled = false;
@@ -253,6 +293,9 @@ function fetchNativeFrames() {
253
293
  });
254
294
  });
255
295
  }
296
+ function fetchNativeFramesDelay(startTimestampSeconds, endTimestampSeconds) {
297
+ return withNativeBridgeTimeout(NATIVE.fetchNativeFramesDelay(startTimestampSeconds, endTimestampSeconds), 'Fetching native frames delay took too long.');
298
+ }
256
299
  function isClose(t1, t2) {
257
300
  return Math.abs(t1 - t2) < MARGIN_OF_ERROR_SECONDS;
258
301
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nativeFrames.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/nativeFrames.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,uBAAuB,GAAG,I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,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM,CAAC,wDAAwD,CAAC,CAAC;YACnE,CAAC;QACH,CAAC,EAAE,uBAAuB,CAAC,CAAC;QAE5B,MAAM,CAAC,iBAAiB,EAAE;aACvB,IAAI,CAAC,KAAK,CAAC,EAAE;YACZ,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,GAAG,IAAI,CAAC;YAEf,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,iCAAiC,CAAC,CAAC;gBAC1C,OAAO;YACT,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC;aACD,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YACvB,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,GAAG,IAAI,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,uBAAuB,CAAC;AACrD,CAAC","sourcesContent":["import type { Client, Event, Integration, Measurements, MeasurementUnit, Span } from '@sentry/core';\nimport { debug, getRootSpan, spanIsSampled, spanToJSON, timestampInSeconds } from '@sentry/core';\nimport type { NativeFramesResponse } from '../../NativeRNSentry';\nimport { AsyncExpiringMap } from '../../utils/AsyncExpiringMap';\nimport { isRootSpan } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\n\n/**\n * Timeout from the start of a span to fetching the associated native frames.\n */\nconst FETCH_FRAMES_TIMEOUT_MS = 2_000;\n\n/**\n * This is the time end frames data from the native layer will be\n * kept in memory and waiting for the event processing. This ensures that spans\n * which are never processed are not leaking memory.\n */\nconst END_FRAMES_TIMEOUT_MS = 2_000;\n\n/**\n * This is the time start frames data from the native layer will be\n * kept in memory and waiting for span end. This ensures that spans\n * which never end or are not processed are not leaking memory.\n */\nconst START_FRAMES_TIMEOUT_MS = 60_000;\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nconst MARGIN_OF_ERROR_SECONDS = 0.05;\n\nconst INTEGRATION_NAME = 'NativeFrames';\n\nexport interface FramesMeasurements extends Measurements {\n frames_total: { value: number; unit: MeasurementUnit };\n frames_slow: { value: number; unit: MeasurementUnit };\n frames_frozen: { value: number; unit: MeasurementUnit };\n}\n\ninterface NativeFramesResponseWithTimestamp {\n timestamp: number;\n nativeFrames: NativeFramesResponse;\n}\n\nexport const createNativeFramesIntegrations = (enable: boolean | undefined): Integration | undefined => {\n if (!enable && NATIVE.enableNative) {\n // On Android this will free up resource when JS reloaded (native modules stay) and thus JS side of the SDK reinitialized.\n NATIVE.disableNativeFramesTracking();\n return undefined;\n }\n\n return nativeFramesIntegration();\n};\n\n/**\n * Instrumentation to add native slow/frozen frames measurements onto transactions\n * and frame data (frames.total, frames.slow, frames.frozen) onto all spans.\n */\nexport const nativeFramesIntegration = (): Integration => {\n /** The native frames at the finish time of the most recent child span, keyed by root span ID.\n * Stores promises so the data is available for processEvent to await even before\n * the async native bridge call completes. */\n const _lastChildSpanEndFramesByRootSpan: AsyncExpiringMap<string, NativeFramesResponseWithTimestamp | null> =\n new AsyncExpiringMap({ ttl: START_FRAMES_TIMEOUT_MS });\n const _spanToNativeFramesAtStartMap: AsyncExpiringMap<string, NativeFramesResponse | null> = new AsyncExpiringMap({\n ttl: START_FRAMES_TIMEOUT_MS,\n });\n const _spanToNativeFramesAtEndMap: AsyncExpiringMap<string, NativeFramesResponseWithTimestamp | null> =\n new AsyncExpiringMap({ ttl: END_FRAMES_TIMEOUT_MS });\n\n /**\n * Hooks into the client start and end span events.\n */\n const setup = (client: Client): void => {\n if (!NATIVE.enableNative) {\n debug.warn(\n `[${INTEGRATION_NAME}] This is not available on the Web, Expo Go and other platforms without native modules.`,\n );\n return undefined;\n }\n\n NATIVE.enableNativeFramesTracking();\n client.on('spanStart', fetchStartFramesForSpan);\n client.on('spanEnd', fetchEndFramesForSpan);\n };\n\n const fetchStartFramesForSpan = (span: Span): void => {\n if (!spanIsSampled(span)) {\n return;\n }\n\n const spanId = span.spanContext().spanId;\n const spanType = isRootSpan(span) ? 'root' : 'child';\n debug.log(`[${INTEGRATION_NAME}] Fetching frames for ${spanType} span start (${spanId}).`);\n\n _spanToNativeFramesAtStartMap.set(\n spanId,\n new Promise<NativeFramesResponse | null>(resolve => {\n fetchNativeFrames()\n .then(frames => resolve(frames))\n .then(undefined, error => {\n debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error);\n resolve(null);\n });\n }),\n );\n };\n\n /**\n * Fetches end frames for a span and attaches frame data as span attributes.\n *\n * Note: This makes one native bridge call per span end. While this creates O(n) calls\n * for n spans, it's necessary for accuracy. Frame counts are cumulative and continuously\n * incrementing, so each span needs the exact frame count at its end time. Caching would\n * produce incorrect deltas. The native bridge calls are async and non-blocking.\n */\n const fetchEndFramesForSpan = async (span: Span): Promise<void> => {\n const spanId = span.spanContext().spanId;\n const hasStartFrames = _spanToNativeFramesAtStartMap.has(spanId);\n\n if (!hasStartFrames) {\n // We don't have start frames, won't be able to calculate the difference.\n return;\n }\n\n // For child spans: immediately store a promise for fallback end frames before any awaits,\n // so processEvent can find and await it even if this async function hasn't completed yet.\n // Uses the actual span timestamp (not wall-clock time) so it matches the trimmed event.timestamp\n // for idle transactions. Scoped per root span to avoid concurrent transaction interference.\n let childEndFramesPromise: Promise<NativeFramesResponse> | undefined;\n if (!isRootSpan(span)) {\n const rootSpanId = getRootSpan(span).spanContext().spanId;\n const spanTimestamp = spanToJSON(span).timestamp;\n if (spanTimestamp) {\n childEndFramesPromise = fetchNativeFrames();\n _lastChildSpanEndFramesByRootSpan.set(\n rootSpanId,\n childEndFramesPromise\n .then(frames => ({ timestamp: spanTimestamp, nativeFrames: frames }))\n .then(undefined, () => null),\n );\n }\n }\n\n if (isRootSpan(span)) {\n // Root spans: Store end frames for transaction measurements (backward compatibility)\n const timestamp = timestampInSeconds();\n debug.log(`[${INTEGRATION_NAME}] Fetch frames for root span end (${spanId}).`);\n _spanToNativeFramesAtEndMap.set(\n spanId,\n new Promise<NativeFramesResponseWithTimestamp | null>(resolve => {\n fetchNativeFrames()\n .then(frames => {\n resolve({\n timestamp,\n nativeFrames: frames,\n });\n })\n .then(undefined, error => {\n debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error);\n resolve(null);\n });\n }),\n );\n }\n\n // All spans (root and child): Attach frame data as span attributes\n try {\n const startFrames = await _spanToNativeFramesAtStartMap.get(spanId);\n if (!startFrames) {\n debug.log(`[${INTEGRATION_NAME}] No start frames found for span ${spanId}, skipping frame data.`);\n return;\n }\n\n // For child spans, reuse the already-kicked-off promise to avoid a redundant native bridge call.\n // For root spans, this is the second call to fetchNativeFrames() for the same span.\n // The calls are very close together (microseconds apart), so inconsistency is minimal.\n const endFrames = childEndFramesPromise ? await childEndFramesPromise : await fetchNativeFrames();\n\n // Calculate deltas\n const totalFrames = endFrames.totalFrames - startFrames.totalFrames;\n const slowFrames = endFrames.slowFrames - startFrames.slowFrames;\n const frozenFrames = endFrames.frozenFrames - startFrames.frozenFrames;\n\n // Only attach if we have meaningful data\n if (totalFrames > 0 || slowFrames > 0 || frozenFrames > 0) {\n span.setAttribute('frames.total', totalFrames);\n span.setAttribute('frames.slow', slowFrames);\n span.setAttribute('frames.frozen', frozenFrames);\n debug.log(\n `[${INTEGRATION_NAME}] Attached frame data to span ${spanId}: total=${totalFrames}, slow=${slowFrames}, frozen=${frozenFrames}`,\n );\n }\n } catch (error) {\n debug.log(`[${INTEGRATION_NAME}] Error while capturing end frames for span ${spanId}.`, error);\n }\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (\n event.type !== 'transaction' ||\n !event.transaction ||\n !event.contexts?.trace ||\n !event.timestamp ||\n !event.contexts.trace.span_id\n ) {\n return event;\n }\n\n const traceOp = event.contexts.trace.op;\n const spanId = event.contexts.trace.span_id;\n const startFrames = await _spanToNativeFramesAtStartMap.pop(spanId);\n if (!startFrames) {\n debug.warn(\n `[${INTEGRATION_NAME}] Start frames of transaction ${event.transaction} (eventId, ${event.event_id}) are missing, but the transaction already ended.`,\n );\n return event;\n }\n\n const endFrames = await _spanToNativeFramesAtEndMap.pop(spanId);\n const lastChildFrames = await _lastChildSpanEndFramesByRootSpan.pop(spanId);\n let finalEndFrames: NativeFramesResponse | undefined;\n\n if (endFrames && isClose(endFrames.timestamp, event.timestamp)) {\n // Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)\n debug.log(`[${INTEGRATION_NAME}] Using frames from root span end (spanId, ${spanId}).`);\n finalEndFrames = endFrames.nativeFrames;\n } else if (lastChildFrames && isClose(lastChildFrames.timestamp, event.timestamp)) {\n // Fallback to the last child span finish if it is within the margin of error of the actual finish timestamp.\n // This handles idle transactions where event.timestamp is trimmed to the last child span's end time.\n debug.log(`[${INTEGRATION_NAME}] Using native frames from last child span end (spanId, ${spanId}).`);\n finalEndFrames = lastChildFrames.nativeFrames;\n } else {\n debug.warn(\n `[${INTEGRATION_NAME}] Frames were collected within larger than margin of error delay for spanId (${spanId}). Dropping the inaccurate values.`,\n );\n return event;\n }\n\n const measurements = {\n frames_total: {\n value: finalEndFrames.totalFrames - startFrames.totalFrames,\n unit: 'none',\n },\n frames_frozen: {\n value: finalEndFrames.frozenFrames - startFrames.frozenFrames,\n unit: 'none',\n },\n frames_slow: {\n value: finalEndFrames.slowFrames - startFrames.slowFrames,\n unit: 'none',\n },\n };\n\n if (\n measurements.frames_frozen.value <= 0 &&\n measurements.frames_slow.value <= 0 &&\n measurements.frames_total.value <= 0\n ) {\n debug.warn(\n `[${INTEGRATION_NAME}] Detected zero slow or frozen frames. Not adding measurements to spanId (${spanId}).`,\n );\n return event;\n }\n\n debug.log(\n `[${INTEGRATION_NAME}] Adding measurements to ${traceOp} transaction ${event.transaction}: ${JSON.stringify(\n measurements,\n undefined,\n 2,\n )}`,\n );\n event.measurements = {\n ...(event.measurements ?? {}),\n ...measurements,\n };\n return event;\n };\n\n return {\n name: INTEGRATION_NAME,\n setup,\n processEvent,\n };\n};\n\nfunction fetchNativeFrames(): Promise<NativeFramesResponse> {\n return new Promise<NativeFramesResponse>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = setTimeout(() => {\n if (!settled) {\n settled = true;\n reject('Fetching native frames took too long. Dropping frames.');\n }\n }, FETCH_FRAMES_TIMEOUT_MS);\n\n NATIVE.fetchNativeFrames()\n .then(value => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n\n if (!value) {\n reject('Native frames response is null.');\n return;\n }\n resolve(value);\n })\n .then(undefined, error => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n reject(error);\n });\n });\n}\n\nfunction isClose(t1: number, t2: number): boolean {\n return Math.abs(t1 - t2) < MARGIN_OF_ERROR_SECONDS;\n}\n"]}
1
+ {"version":3,"file":"nativeFrames.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/nativeFrames.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE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AAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,uBAAuB,CAAC;AACrD,CAAC","sourcesContent":["import type { Client, Event, Integration, Measurements, MeasurementUnit, Span } from '@sentry/core';\n\nimport { debug, getRootSpan, spanIsSampled, spanToJSON, timestampInSeconds } from '@sentry/core';\n\nimport type { NativeFramesResponse } from '../../NativeRNSentry';\n\nimport { AsyncExpiringMap } from '../../utils/AsyncExpiringMap';\nimport { isRootSpan } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\n\n/**\n * Timeout from the start of a span to fetching the associated native frames.\n */\nconst FETCH_FRAMES_TIMEOUT_MS = 2_000;\n\n/**\n * This is the time end frames data from the native layer will be\n * kept in memory and waiting for the event processing. This ensures that spans\n * which are never processed are not leaking memory.\n */\nconst END_FRAMES_TIMEOUT_MS = 2_000;\n\n/**\n * This is the time start frames data from the native layer will be\n * kept in memory and waiting for span end. This ensures that spans\n * which never end or are not processed are not leaking memory.\n */\nconst START_FRAMES_TIMEOUT_MS = 60_000;\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nconst MARGIN_OF_ERROR_SECONDS = 0.05;\n\nconst INTEGRATION_NAME = 'NativeFrames';\n\nexport interface FramesMeasurements extends Measurements {\n frames_total: { value: number; unit: MeasurementUnit };\n frames_slow: { value: number; unit: MeasurementUnit };\n frames_frozen: { value: number; unit: MeasurementUnit };\n}\n\ninterface NativeFramesResponseWithTimestamp {\n timestamp: number;\n nativeFrames: NativeFramesResponse;\n}\n\nexport const createNativeFramesIntegrations = (enable: boolean | undefined): Integration | undefined => {\n if (!enable && NATIVE.enableNative) {\n // On Android this will free up resource when JS reloaded (native modules stay) and thus JS side of the SDK reinitialized.\n NATIVE.disableNativeFramesTracking();\n return undefined;\n }\n\n return nativeFramesIntegration();\n};\n\n/**\n * Instrumentation to add native slow/frozen frames measurements onto transactions\n * and frame data (frames.total, frames.slow, frames.frozen) onto all spans.\n */\nexport const nativeFramesIntegration = (): Integration => {\n /** The native frames at the finish time of the most recent child span, keyed by root span ID.\n * Stores promises so the data is available for processEvent to await even before\n * the async native bridge call completes. */\n const _lastChildSpanEndFramesByRootSpan: AsyncExpiringMap<string, NativeFramesResponseWithTimestamp | null> =\n new AsyncExpiringMap({ ttl: START_FRAMES_TIMEOUT_MS });\n const _spanToNativeFramesAtStartMap: AsyncExpiringMap<string, NativeFramesResponse | null> = new AsyncExpiringMap({\n ttl: START_FRAMES_TIMEOUT_MS,\n });\n const _spanToNativeFramesAtEndMap: AsyncExpiringMap<string, NativeFramesResponseWithTimestamp | null> =\n new AsyncExpiringMap({ ttl: END_FRAMES_TIMEOUT_MS });\n\n /**\n * Hooks into the client start and end span events.\n */\n const setup = (client: Client): void => {\n if (!NATIVE.enableNative) {\n debug.warn(\n `[${INTEGRATION_NAME}] This is not available on the Web, Expo Go and other platforms without native modules.`,\n );\n return undefined;\n }\n\n NATIVE.enableNativeFramesTracking();\n client.on('spanStart', fetchStartFramesForSpan);\n client.on('spanEnd', fetchEndFramesForSpan);\n };\n\n const fetchStartFramesForSpan = (span: Span): void => {\n if (!spanIsSampled(span)) {\n return;\n }\n\n const spanId = span.spanContext().spanId;\n const spanType = isRootSpan(span) ? 'root' : 'child';\n debug.log(`[${INTEGRATION_NAME}] Fetching frames for ${spanType} span start (${spanId}).`);\n\n _spanToNativeFramesAtStartMap.set(\n spanId,\n new Promise<NativeFramesResponse | null>(resolve => {\n fetchNativeFrames()\n .then(frames => resolve(frames))\n .then(undefined, error => {\n debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error);\n resolve(null);\n });\n }),\n );\n };\n\n /**\n * Fetches end frames for a span and attaches frame data as span attributes.\n *\n * Note: This makes one native bridge call per span end. While this creates O(n) calls\n * for n spans, it's necessary for accuracy. Frame counts are cumulative and continuously\n * incrementing, so each span needs the exact frame count at its end time. Caching would\n * produce incorrect deltas. The native bridge calls are async and non-blocking.\n */\n const fetchEndFramesForSpan = async (span: Span): Promise<void> => {\n const spanId = span.spanContext().spanId;\n const hasStartFrames = _spanToNativeFramesAtStartMap.has(spanId);\n\n if (!hasStartFrames) {\n // We don't have start frames, won't be able to calculate the difference.\n return;\n }\n\n // For child spans: immediately store a promise for fallback end frames before any awaits,\n // so processEvent can find and await it even if this async function hasn't completed yet.\n // Uses the actual span timestamp (not wall-clock time) so it matches the trimmed event.timestamp\n // for idle transactions. Scoped per root span to avoid concurrent transaction interference.\n let childEndFramesPromise: Promise<NativeFramesResponse> | undefined;\n if (!isRootSpan(span)) {\n const rootSpanId = getRootSpan(span).spanContext().spanId;\n const spanTimestamp = spanToJSON(span).timestamp;\n if (spanTimestamp) {\n childEndFramesPromise = fetchNativeFrames();\n _lastChildSpanEndFramesByRootSpan.set(\n rootSpanId,\n childEndFramesPromise\n .then(frames => ({ timestamp: spanTimestamp, nativeFrames: frames }))\n .then(undefined, () => null),\n );\n }\n }\n\n if (isRootSpan(span)) {\n // Root spans: Store end frames for transaction measurements (backward compatibility)\n const timestamp = timestampInSeconds();\n debug.log(`[${INTEGRATION_NAME}] Fetch frames for root span end (${spanId}).`);\n _spanToNativeFramesAtEndMap.set(\n spanId,\n new Promise<NativeFramesResponseWithTimestamp | null>(resolve => {\n fetchNativeFrames()\n .then(frames => {\n resolve({\n timestamp,\n nativeFrames: frames,\n });\n })\n .then(undefined, error => {\n debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error);\n resolve(null);\n });\n }),\n );\n }\n\n // All spans (root and child): Attach frame data as span attributes\n try {\n const startFrames = await _spanToNativeFramesAtStartMap.get(spanId);\n if (!startFrames) {\n debug.log(`[${INTEGRATION_NAME}] No start frames found for span ${spanId}, skipping frame data.`);\n return;\n }\n\n // For child spans, reuse the already-kicked-off promise to avoid a redundant native bridge call.\n // For root spans, this is the second call to fetchNativeFrames() for the same span.\n // The calls are very close together (microseconds apart), so inconsistency is minimal.\n const endFrames = childEndFramesPromise ? await childEndFramesPromise : await fetchNativeFrames();\n\n // Calculate deltas\n const totalFrames = endFrames.totalFrames - startFrames.totalFrames;\n const slowFrames = endFrames.slowFrames - startFrames.slowFrames;\n const frozenFrames = endFrames.frozenFrames - startFrames.frozenFrames;\n\n // Only attach if we have meaningful data\n if (totalFrames > 0 || slowFrames > 0 || frozenFrames > 0) {\n span.setAttribute('frames.total', totalFrames);\n span.setAttribute('frames.slow', slowFrames);\n span.setAttribute('frames.frozen', frozenFrames);\n debug.log(\n `[${INTEGRATION_NAME}] Attached frame data to span ${spanId}: total=${totalFrames}, slow=${slowFrames}, frozen=${frozenFrames}`,\n );\n\n const spanJson = spanToJSON(span);\n if (spanJson.start_timestamp && spanJson.timestamp) {\n try {\n const delay = await fetchNativeFramesDelay(spanJson.start_timestamp, spanJson.timestamp);\n if (delay != null) {\n span.setAttribute('frames.delay', delay);\n }\n } catch (delayError) {\n debug.log(`[${INTEGRATION_NAME}] Error while fetching frames delay for span ${spanId}.`, delayError);\n }\n }\n }\n } catch (error) {\n debug.log(`[${INTEGRATION_NAME}] Error while capturing end frames for span ${spanId}.`, error);\n }\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (\n event.type !== 'transaction' ||\n !event.transaction ||\n !event.contexts?.trace ||\n !event.timestamp ||\n !event.contexts.trace.span_id\n ) {\n return event;\n }\n\n const traceOp = event.contexts.trace.op;\n const spanId = event.contexts.trace.span_id;\n const startFrames = await _spanToNativeFramesAtStartMap.pop(spanId);\n if (!startFrames) {\n debug.warn(\n `[${INTEGRATION_NAME}] Start frames of transaction ${event.transaction} (eventId, ${event.event_id}) are missing, but the transaction already ended.`,\n );\n return event;\n }\n\n const endFrames = await _spanToNativeFramesAtEndMap.pop(spanId);\n const lastChildFrames = await _lastChildSpanEndFramesByRootSpan.pop(spanId);\n let finalEndFrames: NativeFramesResponse | undefined;\n\n if (endFrames && isClose(endFrames.timestamp, event.timestamp)) {\n // Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)\n debug.log(`[${INTEGRATION_NAME}] Using frames from root span end (spanId, ${spanId}).`);\n finalEndFrames = endFrames.nativeFrames;\n } else if (lastChildFrames && isClose(lastChildFrames.timestamp, event.timestamp)) {\n // Fallback to the last child span finish if it is within the margin of error of the actual finish timestamp.\n // This handles idle transactions where event.timestamp is trimmed to the last child span's end time.\n debug.log(`[${INTEGRATION_NAME}] Using native frames from last child span end (spanId, ${spanId}).`);\n finalEndFrames = lastChildFrames.nativeFrames;\n } else {\n debug.warn(\n `[${INTEGRATION_NAME}] Frames were collected within larger than margin of error delay for spanId (${spanId}). Dropping the inaccurate values.`,\n );\n return event;\n }\n\n const measurements = {\n frames_total: {\n value: finalEndFrames.totalFrames - startFrames.totalFrames,\n unit: 'none',\n },\n frames_frozen: {\n value: finalEndFrames.frozenFrames - startFrames.frozenFrames,\n unit: 'none',\n },\n frames_slow: {\n value: finalEndFrames.slowFrames - startFrames.slowFrames,\n unit: 'none',\n },\n };\n\n if (\n measurements.frames_frozen.value <= 0 &&\n measurements.frames_slow.value <= 0 &&\n measurements.frames_total.value <= 0\n ) {\n debug.warn(\n `[${INTEGRATION_NAME}] Detected zero slow or frozen frames. Not adding measurements to spanId (${spanId}).`,\n );\n return event;\n }\n\n debug.log(\n `[${INTEGRATION_NAME}] Adding measurements to ${traceOp} transaction ${event.transaction}: ${JSON.stringify(\n measurements,\n undefined,\n 2,\n )}`,\n );\n event.measurements = {\n ...(event.measurements ?? {}),\n ...measurements,\n };\n return event;\n };\n\n return {\n name: INTEGRATION_NAME,\n setup,\n processEvent,\n };\n};\n\nfunction withNativeBridgeTimeout<T>(promise: PromiseLike<T>, timeoutMessage: string): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = setTimeout(() => {\n if (!settled) {\n settled = true;\n reject(timeoutMessage);\n }\n }, FETCH_FRAMES_TIMEOUT_MS);\n\n promise\n .then(value => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n resolve(value);\n })\n .then(undefined, error => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n reject(error);\n });\n });\n}\n\nfunction fetchNativeFrames(): Promise<NativeFramesResponse> {\n return new Promise<NativeFramesResponse>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = setTimeout(() => {\n if (!settled) {\n settled = true;\n reject('Fetching native frames took too long. Dropping frames.');\n }\n }, FETCH_FRAMES_TIMEOUT_MS);\n\n NATIVE.fetchNativeFrames()\n .then(value => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n\n if (!value) {\n reject('Native frames response is null.');\n return;\n }\n resolve(value);\n })\n .then(undefined, error => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n reject(error);\n });\n });\n}\n\nfunction fetchNativeFramesDelay(startTimestampSeconds: number, endTimestampSeconds: number): Promise<number | null> {\n return withNativeBridgeTimeout(\n NATIVE.fetchNativeFramesDelay(startTimestampSeconds, endTimestampSeconds),\n 'Fetching native frames delay took too long.',\n );\n}\n\nfunction isClose(t1: number, t2: number): boolean {\n return Math.abs(t1 - t2) < MARGIN_OF_ERROR_SECONDS;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stalltracking.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/stalltracking.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,WAAW,EAAE,YAAY,EAAE,eAAe,EAAQ,MAAM,cAAc,CAAC;AAI7F,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMvF,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,CAAC,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACxD,CAAC,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC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