@sentry/react-native 5.28.0 → 6.0.0-alpha.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 (294) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/android/build.gradle +1 -1
  3. package/dist/js/client.d.ts +5 -9
  4. package/dist/js/client.d.ts.map +1 -1
  5. package/dist/js/client.js +11 -42
  6. package/dist/js/client.js.map +1 -1
  7. package/dist/js/index.d.ts +5 -10
  8. package/dist/js/index.d.ts.map +1 -1
  9. package/dist/js/index.js +4 -21
  10. package/dist/js/index.js.map +1 -1
  11. package/dist/js/integrations/debugsymbolicator.d.ts +2 -8
  12. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  13. package/dist/js/integrations/debugsymbolicator.js +1 -9
  14. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  15. package/dist/js/integrations/default.d.ts.map +1 -1
  16. package/dist/js/integrations/default.js +18 -7
  17. package/dist/js/integrations/default.js.map +1 -1
  18. package/dist/js/integrations/devicecontext.d.ts +2 -8
  19. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  20. package/dist/js/integrations/devicecontext.js +0 -9
  21. package/dist/js/integrations/devicecontext.js.map +1 -1
  22. package/dist/js/integrations/eventorigin.d.ts +2 -8
  23. package/dist/js/integrations/eventorigin.d.ts.map +1 -1
  24. package/dist/js/integrations/eventorigin.js +0 -8
  25. package/dist/js/integrations/eventorigin.js.map +1 -1
  26. package/dist/js/integrations/expocontext.d.ts +2 -8
  27. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  28. package/dist/js/integrations/expocontext.js +0 -8
  29. package/dist/js/integrations/expocontext.js.map +1 -1
  30. package/dist/js/integrations/exports.d.ts +4 -0
  31. package/dist/js/integrations/exports.d.ts.map +1 -1
  32. package/dist/js/integrations/exports.js +4 -0
  33. package/dist/js/integrations/exports.js.map +1 -1
  34. package/dist/js/integrations/modulesloader.d.ts +2 -8
  35. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  36. package/dist/js/integrations/modulesloader.js +0 -8
  37. package/dist/js/integrations/modulesloader.js.map +1 -1
  38. package/dist/js/integrations/nativelinkederrors.d.ts +2 -8
  39. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  40. package/dist/js/integrations/nativelinkederrors.js +0 -8
  41. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  42. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
  43. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  44. package/dist/js/integrations/reactnativeerrorhandlers.js +1 -8
  45. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  46. package/dist/js/integrations/reactnativeinfo.d.ts +2 -8
  47. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  48. package/dist/js/integrations/reactnativeinfo.js +0 -8
  49. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  50. package/dist/js/integrations/release.d.ts +2 -8
  51. package/dist/js/integrations/release.d.ts.map +1 -1
  52. package/dist/js/integrations/release.js +0 -8
  53. package/dist/js/integrations/release.js.map +1 -1
  54. package/dist/js/integrations/rewriteframes.js +1 -1
  55. package/dist/js/integrations/rewriteframes.js.map +1 -1
  56. package/dist/js/integrations/screenshot.d.ts +2 -8
  57. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  58. package/dist/js/integrations/screenshot.js +2 -11
  59. package/dist/js/integrations/screenshot.js.map +1 -1
  60. package/dist/js/integrations/sdkinfo.d.ts +2 -8
  61. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  62. package/dist/js/integrations/sdkinfo.js +0 -8
  63. package/dist/js/integrations/sdkinfo.js.map +1 -1
  64. package/dist/js/integrations/spotlight.d.ts +2 -10
  65. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  66. package/dist/js/integrations/spotlight.js +1 -10
  67. package/dist/js/integrations/spotlight.js.map +1 -1
  68. package/dist/js/integrations/viewhierarchy.d.ts +2 -8
  69. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  70. package/dist/js/integrations/viewhierarchy.js +0 -8
  71. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  72. package/dist/js/options.d.ts +43 -0
  73. package/dist/js/options.d.ts.map +1 -1
  74. package/dist/js/options.js.map +1 -1
  75. package/dist/js/profiling/cache.d.ts +1 -1
  76. package/dist/js/profiling/hermes.d.ts +1 -1
  77. package/dist/js/profiling/hermes.d.ts.map +1 -1
  78. package/dist/js/profiling/integration.d.ts +1 -7
  79. package/dist/js/profiling/integration.d.ts.map +1 -1
  80. package/dist/js/profiling/integration.js +39 -25
  81. package/dist/js/profiling/integration.js.map +1 -1
  82. package/dist/js/profiling/utils.js +2 -1
  83. package/dist/js/profiling/utils.js.map +1 -1
  84. package/dist/js/replay/mobilereplay.d.ts +2 -2
  85. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  86. package/dist/js/replay/mobilereplay.js.map +1 -1
  87. package/dist/js/scopeSync.d.ts +6 -0
  88. package/dist/js/scopeSync.d.ts.map +1 -0
  89. package/dist/js/scopeSync.js +60 -0
  90. package/dist/js/scopeSync.js.map +1 -0
  91. package/dist/js/sdk.d.ts +1 -20
  92. package/dist/js/sdk.d.ts.map +1 -1
  93. package/dist/js/sdk.js +20 -53
  94. package/dist/js/sdk.js.map +1 -1
  95. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  96. package/dist/js/touchevents.d.ts +0 -1
  97. package/dist/js/touchevents.d.ts.map +1 -1
  98. package/dist/js/touchevents.js +5 -9
  99. package/dist/js/touchevents.js.map +1 -1
  100. package/dist/js/tracing/gesturetracing.d.ts +1 -6
  101. package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
  102. package/dist/js/tracing/gesturetracing.js +8 -12
  103. package/dist/js/tracing/gesturetracing.js.map +1 -1
  104. package/dist/js/tracing/index.d.ts +6 -7
  105. package/dist/js/tracing/index.d.ts.map +1 -1
  106. package/dist/js/tracing/index.js +4 -7
  107. package/dist/js/tracing/index.js.map +1 -1
  108. package/dist/js/tracing/integrations/appStart.d.ts +39 -0
  109. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -0
  110. package/dist/js/tracing/integrations/appStart.js +301 -0
  111. package/dist/js/tracing/integrations/appStart.js.map +1 -0
  112. package/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
  113. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -0
  114. package/dist/js/tracing/integrations/nativeFrames.js +256 -0
  115. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -0
  116. package/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
  117. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -0
  118. package/dist/js/tracing/integrations/stalltracking.js +236 -0
  119. package/dist/js/tracing/integrations/stalltracking.js.map +1 -0
  120. package/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
  121. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -0
  122. package/dist/js/tracing/integrations/userInteraction.js +70 -0
  123. package/dist/js/tracing/integrations/userInteraction.js.map +1 -0
  124. package/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
  125. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -0
  126. package/dist/js/tracing/onSpanEndUtils.js +112 -0
  127. package/dist/js/tracing/onSpanEndUtils.js.map +1 -0
  128. package/dist/js/tracing/origin.d.ts +2 -0
  129. package/dist/js/tracing/origin.d.ts.map +1 -0
  130. package/dist/js/tracing/origin.js +2 -0
  131. package/dist/js/tracing/origin.js.map +1 -0
  132. package/dist/js/tracing/reactnativenavigation.d.ts +21 -39
  133. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  134. package/dist/js/tracing/reactnativenavigation.js +98 -87
  135. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  136. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  137. package/dist/js/tracing/reactnativeprofiler.js +6 -13
  138. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  139. package/dist/js/tracing/reactnativetracing.d.ts +44 -160
  140. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  141. package/dist/js/tracing/reactnativetracing.js +51 -481
  142. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  143. package/dist/js/tracing/reactnavigation.d.ts +18 -63
  144. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  145. package/dist/js/tracing/reactnavigation.js +197 -218
  146. package/dist/js/tracing/reactnavigation.js.map +1 -1
  147. package/dist/js/tracing/semanticAttributes.d.ts +12 -0
  148. package/dist/js/tracing/semanticAttributes.d.ts.map +1 -0
  149. package/dist/js/tracing/semanticAttributes.js +12 -0
  150. package/dist/js/tracing/semanticAttributes.js.map +1 -0
  151. package/dist/js/tracing/span.d.ts +52 -0
  152. package/dist/js/tracing/span.d.ts.map +1 -0
  153. package/dist/js/tracing/span.js +82 -0
  154. package/dist/js/tracing/span.js.map +1 -0
  155. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  156. package/dist/js/tracing/timetodisplay.js +16 -29
  157. package/dist/js/tracing/timetodisplay.js.map +1 -1
  158. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  159. package/dist/js/tracing/timetodisplaynative.js +5 -3
  160. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  161. package/dist/js/tracing/types.d.ts +2 -9
  162. package/dist/js/tracing/types.d.ts.map +1 -1
  163. package/dist/js/tracing/types.js.map +1 -1
  164. package/dist/js/tracing/utils.d.ts +23 -12
  165. package/dist/js/tracing/utils.d.ts.map +1 -1
  166. package/dist/js/tracing/utils.js +48 -52
  167. package/dist/js/tracing/utils.js.map +1 -1
  168. package/dist/js/transports/encodePolyfill.d.ts +3 -0
  169. package/dist/js/transports/encodePolyfill.d.ts.map +1 -0
  170. package/dist/js/transports/encodePolyfill.js +13 -0
  171. package/dist/js/transports/encodePolyfill.js.map +1 -0
  172. package/dist/js/transports/native.d.ts +2 -2
  173. package/dist/js/transports/native.d.ts.map +1 -1
  174. package/dist/js/transports/native.js +2 -1
  175. package/dist/js/transports/native.js.map +1 -1
  176. package/dist/js/utils/fill.d.ts +7 -0
  177. package/dist/js/utils/fill.d.ts.map +1 -0
  178. package/dist/js/utils/fill.js +9 -0
  179. package/dist/js/utils/fill.js.map +1 -0
  180. package/dist/js/utils/normalize.d.ts.map +1 -1
  181. package/dist/js/utils/normalize.js +8 -5
  182. package/dist/js/utils/normalize.js.map +1 -1
  183. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  184. package/dist/js/utils/rnlibraries.js +6 -0
  185. package/dist/js/utils/rnlibraries.js.map +1 -1
  186. package/dist/js/utils/rnlibrariesinterface.d.ts +3 -0
  187. package/dist/js/utils/rnlibrariesinterface.d.ts.map +1 -1
  188. package/dist/js/utils/rnlibrariesinterface.js.map +1 -1
  189. package/dist/js/utils/span.d.ts +19 -0
  190. package/dist/js/utils/span.d.ts.map +1 -0
  191. package/dist/js/utils/span.js +29 -0
  192. package/dist/js/utils/span.js.map +1 -0
  193. package/dist/js/vendor/react-native/index.d.ts +5 -1
  194. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  195. package/dist/js/vendor/react-native/index.js.map +1 -1
  196. package/dist/js/version.d.ts +1 -1
  197. package/dist/js/version.d.ts.map +1 -1
  198. package/dist/js/version.js +1 -1
  199. package/dist/js/version.js.map +1 -1
  200. package/dist/js/wrapper.d.ts.map +1 -1
  201. package/dist/js/wrapper.js +1 -0
  202. package/dist/js/wrapper.js.map +1 -1
  203. package/package.json +12 -13
  204. package/ts3.8/dist/js/client.d.ts +5 -9
  205. package/ts3.8/dist/js/index.d.ts +5 -10
  206. package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +2 -8
  207. package/ts3.8/dist/js/integrations/devicecontext.d.ts +2 -8
  208. package/ts3.8/dist/js/integrations/eventorigin.d.ts +2 -8
  209. package/ts3.8/dist/js/integrations/expocontext.d.ts +2 -8
  210. package/ts3.8/dist/js/integrations/exports.d.ts +4 -0
  211. package/ts3.8/dist/js/integrations/modulesloader.d.ts +2 -8
  212. package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +2 -8
  213. package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
  214. package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +2 -8
  215. package/ts3.8/dist/js/integrations/release.d.ts +2 -8
  216. package/ts3.8/dist/js/integrations/screenshot.d.ts +2 -8
  217. package/ts3.8/dist/js/integrations/sdkinfo.d.ts +2 -8
  218. package/ts3.8/dist/js/integrations/spotlight.d.ts +2 -10
  219. package/ts3.8/dist/js/integrations/viewhierarchy.d.ts +2 -8
  220. package/ts3.8/dist/js/options.d.ts +43 -0
  221. package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
  222. package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
  223. package/ts3.8/dist/js/profiling/integration.d.ts +1 -7
  224. package/ts3.8/dist/js/replay/mobilereplay.d.ts +2 -2
  225. package/ts3.8/dist/js/scopeSync.d.ts +6 -0
  226. package/ts3.8/dist/js/sdk.d.ts +1 -20
  227. package/ts3.8/dist/js/touchevents.d.ts +0 -1
  228. package/ts3.8/dist/js/tracing/gesturetracing.d.ts +1 -6
  229. package/ts3.8/dist/js/tracing/index.d.ts +6 -7
  230. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +39 -0
  231. package/ts3.8/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
  232. package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
  233. package/ts3.8/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
  234. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
  235. package/ts3.8/dist/js/tracing/origin.d.ts +2 -0
  236. package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +21 -39
  237. package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +44 -160
  238. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +18 -63
  239. package/ts3.8/dist/js/tracing/semanticAttributes.d.ts +12 -0
  240. package/ts3.8/dist/js/tracing/span.d.ts +52 -0
  241. package/ts3.8/dist/js/tracing/types.d.ts +2 -9
  242. package/ts3.8/dist/js/tracing/utils.d.ts +23 -12
  243. package/ts3.8/dist/js/transports/encodePolyfill.d.ts +3 -0
  244. package/ts3.8/dist/js/transports/native.d.ts +2 -2
  245. package/ts3.8/dist/js/utils/fill.d.ts +7 -0
  246. package/ts3.8/dist/js/utils/rnlibrariesinterface.d.ts +3 -0
  247. package/ts3.8/dist/js/utils/span.d.ts +19 -0
  248. package/ts3.8/dist/js/vendor/react-native/index.d.ts +5 -1
  249. package/ts3.8/dist/js/version.d.ts +1 -1
  250. package/dist/js/integrations/index.d.ts +0 -16
  251. package/dist/js/integrations/index.d.ts.map +0 -1
  252. package/dist/js/integrations/index.js +0 -17
  253. package/dist/js/integrations/index.js.map +0 -1
  254. package/dist/js/scope.d.ts +0 -54
  255. package/dist/js/scope.d.ts.map +0 -1
  256. package/dist/js/scope.js +0 -89
  257. package/dist/js/scope.js.map +0 -1
  258. package/dist/js/tracing/addTracingExtensions.d.ts +0 -8
  259. package/dist/js/tracing/addTracingExtensions.d.ts.map +0 -1
  260. package/dist/js/tracing/addTracingExtensions.js +0 -66
  261. package/dist/js/tracing/addTracingExtensions.js.map +0 -1
  262. package/dist/js/tracing/nativeframes.d.ts +0 -60
  263. package/dist/js/tracing/nativeframes.d.ts.map +0 -1
  264. package/dist/js/tracing/nativeframes.js +0 -210
  265. package/dist/js/tracing/nativeframes.js.map +0 -1
  266. package/dist/js/tracing/reactnavigationv4.d.ts +0 -92
  267. package/dist/js/tracing/reactnavigationv4.d.ts.map +0 -1
  268. package/dist/js/tracing/reactnavigationv4.js +0 -229
  269. package/dist/js/tracing/reactnavigationv4.js.map +0 -1
  270. package/dist/js/tracing/routingInstrumentation.d.ts +0 -52
  271. package/dist/js/tracing/routingInstrumentation.d.ts.map +0 -1
  272. package/dist/js/tracing/routingInstrumentation.js +0 -36
  273. package/dist/js/tracing/routingInstrumentation.js.map +0 -1
  274. package/dist/js/tracing/stalltracking.d.ts +0 -99
  275. package/dist/js/tracing/stalltracking.d.ts.map +0 -1
  276. package/dist/js/tracing/stalltracking.js +0 -286
  277. package/dist/js/tracing/stalltracking.js.map +0 -1
  278. package/dist/js/tracing/transaction.d.ts +0 -11
  279. package/dist/js/tracing/transaction.d.ts.map +0 -1
  280. package/dist/js/tracing/transaction.js +0 -37
  281. package/dist/js/tracing/transaction.js.map +0 -1
  282. package/dist/js/transports/TextEncoder.d.ts +0 -3
  283. package/dist/js/transports/TextEncoder.d.ts.map +0 -1
  284. package/dist/js/transports/TextEncoder.js +0 -12
  285. package/dist/js/transports/TextEncoder.js.map +0 -1
  286. package/ts3.8/dist/js/integrations/index.d.ts +0 -16
  287. package/ts3.8/dist/js/scope.d.ts +0 -54
  288. package/ts3.8/dist/js/tracing/addTracingExtensions.d.ts +0 -8
  289. package/ts3.8/dist/js/tracing/nativeframes.d.ts +0 -60
  290. package/ts3.8/dist/js/tracing/reactnavigationv4.d.ts +0 -92
  291. package/ts3.8/dist/js/tracing/routingInstrumentation.d.ts +0 -52
  292. package/ts3.8/dist/js/tracing/stalltracking.d.ts +0 -99
  293. package/ts3.8/dist/js/tracing/transaction.d.ts +0 -11
  294. package/ts3.8/dist/js/transports/TextEncoder.d.ts +0 -3
@@ -0,0 +1,52 @@
1
+ import type { Client, Scope, Span, StartSpanOptions } from '@sentry/types';
2
+ export declare const DEFAULT_NAVIGATION_SPAN_NAME = "Route Change";
3
+ export declare const defaultIdleOptions: {
4
+ /**
5
+ * The time that has to pass without any span being created.
6
+ * If this time is exceeded, the idle span will finish.
7
+ *
8
+ * @default 1_000 (ms)
9
+ */
10
+ finalTimeout: number;
11
+ /**
12
+ * The max. time an idle span may run.
13
+ * If this time is exceeded, the idle span will finish no matter what.
14
+ *
15
+ * @default 60_0000 (ms)
16
+ */
17
+ idleTimeout: number;
18
+ };
19
+ export declare const startIdleNavigationSpan: (startSpanOption: StartSpanOptions, { finalTimeout, idleTimeout, }?: Partial<typeof defaultIdleOptions>) => Span | undefined;
20
+ /**
21
+ * Starts an idle span from `@sentry/core` with React Native application
22
+ * context awareness.
23
+ *
24
+ * - Span will be started with new propagation context.
25
+ * - Span will be canceled if the app goes to background.
26
+ */
27
+ export declare const startIdleSpan: (startSpanOption: StartSpanOptions, { finalTimeout, idleTimeout }: {
28
+ finalTimeout: number | undefined;
29
+ idleTimeout: number | undefined;
30
+ }) => Span;
31
+ /**
32
+ * Returns the default options for the idle navigation span.
33
+ */
34
+ export declare function getDefaultIdleNavigationSpanOptions(): StartSpanOptions;
35
+ /**
36
+ * Checks if the span is a Sentry User Interaction span.
37
+ */
38
+ export declare function isSentryInteractionSpan(span: Span): boolean;
39
+ declare const SCOPE_SPAN_FIELD = "_sentrySpan";
40
+ type ScopeWithMaybeSpan = Scope & {
41
+ [SCOPE_SPAN_FIELD]?: Span;
42
+ };
43
+ /**
44
+ * Removes the active span from the scope.
45
+ */
46
+ export declare function clearActiveSpanFromScope(scope: ScopeWithMaybeSpan): void;
47
+ /**
48
+ * Ensures that all created spans have an operation name.
49
+ */
50
+ export declare function addDefaultOpForSpanFrom(client: Client): void;
51
+ export {};
52
+ //# sourceMappingURL=span.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/span.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAO3E,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE;IAC/B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;CAIrB,CAAC;AAEF,eAAO,MAAM,uBAAuB,oBACjB,gBAAgB,mCAI9B,QAAQ,yBAAyB,CAAC,KACpC,IAAI,GAAG,SAgCT,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,oBACP,gBAAgB;kBACc,MAAM,GAAG,SAAS;iBAAe,MAAM,GAAG,SAAS;MACjG,IAYF,CAAC;AAEF;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,gBAAgB,CAOtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE3D;AAED,QAAA,MAAM,gBAAgB,gBAAgB,CAAC;AAEvC,KAAK,kBAAkB,GAAG,KAAK,GAAG;IAChC,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAGxE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAM5D"}
@@ -0,0 +1,82 @@
1
+ import { getActiveSpan, getClient, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SentryNonRecordingSpan, SPAN_STATUS_ERROR, spanToJSON, startIdleSpan as coreStartIdleSpan, } from '@sentry/core';
2
+ import { generatePropagationContext, logger } from '@sentry/utils';
3
+ import { isRootSpan } from '../utils/span';
4
+ import { adjustTransactionDuration, cancelInBackground } from './onSpanEndUtils';
5
+ import { SPAN_ORIGIN_AUTO_INTERACTION } from './origin';
6
+ export const DEFAULT_NAVIGATION_SPAN_NAME = 'Route Change';
7
+ export const defaultIdleOptions = {
8
+ idleTimeout: 1000,
9
+ finalTimeout: 600000,
10
+ };
11
+ export const startIdleNavigationSpan = (startSpanOption, { finalTimeout = defaultIdleOptions.finalTimeout, idleTimeout = defaultIdleOptions.idleTimeout, } = {}) => {
12
+ const client = getClient();
13
+ if (!client) {
14
+ logger.warn(`[startIdleNavigationSpan] Can't create route change span, missing client.`);
15
+ return undefined;
16
+ }
17
+ const activeSpan = getActiveSpan();
18
+ if (activeSpan && isRootSpan(activeSpan) && isSentryInteractionSpan(activeSpan)) {
19
+ logger.log(`[startIdleNavigationSpan] Canceling ${spanToJSON(activeSpan).op} transaction because of a new navigation root span.`);
20
+ activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' });
21
+ activeSpan.end();
22
+ }
23
+ const finalStartStapOptions = Object.assign(Object.assign({}, getDefaultIdleNavigationSpanOptions()), startSpanOption);
24
+ const idleSpan = startIdleSpan(finalStartStapOptions, { finalTimeout, idleTimeout });
25
+ logger.log(`[startIdleNavigationSpan] Starting ${finalStartStapOptions.op || 'unknown op'} transaction "${finalStartStapOptions.name}" on scope`);
26
+ adjustTransactionDuration(client, idleSpan, finalTimeout);
27
+ return idleSpan;
28
+ };
29
+ /**
30
+ * Starts an idle span from `@sentry/core` with React Native application
31
+ * context awareness.
32
+ *
33
+ * - Span will be started with new propagation context.
34
+ * - Span will be canceled if the app goes to background.
35
+ */
36
+ export const startIdleSpan = (startSpanOption, { finalTimeout, idleTimeout }) => {
37
+ const client = getClient();
38
+ if (!client) {
39
+ logger.warn(`[startIdleSpan] Can't create idle span, missing client.`);
40
+ return new SentryNonRecordingSpan();
41
+ }
42
+ getCurrentScope().setPropagationContext(generatePropagationContext());
43
+ const span = coreStartIdleSpan(startSpanOption, { finalTimeout, idleTimeout });
44
+ cancelInBackground(client, span);
45
+ return span;
46
+ };
47
+ /**
48
+ * Returns the default options for the idle navigation span.
49
+ */
50
+ export function getDefaultIdleNavigationSpanOptions() {
51
+ return {
52
+ name: DEFAULT_NAVIGATION_SPAN_NAME,
53
+ op: 'navigation',
54
+ forceTransaction: true,
55
+ scope: getCurrentScope(),
56
+ };
57
+ }
58
+ /**
59
+ * Checks if the span is a Sentry User Interaction span.
60
+ */
61
+ export function isSentryInteractionSpan(span) {
62
+ return spanToJSON(span).origin === SPAN_ORIGIN_AUTO_INTERACTION;
63
+ }
64
+ const SCOPE_SPAN_FIELD = '_sentrySpan';
65
+ /**
66
+ * Removes the active span from the scope.
67
+ */
68
+ export function clearActiveSpanFromScope(scope) {
69
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
70
+ delete scope[SCOPE_SPAN_FIELD];
71
+ }
72
+ /**
73
+ * Ensures that all created spans have an operation name.
74
+ */
75
+ export function addDefaultOpForSpanFrom(client) {
76
+ client.on('spanStart', (span) => {
77
+ if (!spanToJSON(span).op) {
78
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'default');
79
+ }
80
+ });
81
+ }
82
+ //# sourceMappingURL=span.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span.js","sourceRoot":"","sources":["../../../src/js/tracing/span.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,eAAe,EACf,4BAA4B,EAC5B,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,aAAa,IAAI,iBAAiB,GACnC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,CAAC,MAAM,4BAA4B,GAAG,cAAc,CAAC;AAE3D,MAAM,CAAC,MAAM,kBAAkB,GAgB3B;IACF,WAAW,EAAE,IAAK;IAClB,YAAY,EAAE,MAAO;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,eAAiC,EACjC,EACE,YAAY,GAAG,kBAAkB,CAAC,YAAY,EAC9C,WAAW,GAAG,kBAAkB,CAAC,WAAW,MACN,EAAE,EACxB,EAAE;IACpB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;QACzF,OA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,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,mCAAmC;IACjD,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,EAAE,EAAE,YAAY;QAChB,gBAAgB,EAAE,IAAI;QACtB,KAAK,EAAE,eAAe,EAAE;KACzB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAU;IAChD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,4BAA4B,CAAC;AAClE,CAAC;AAED,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAMvC;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,gEAAgE;IAChE,OAAO,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,IAAU,EAAE,EAAE;QACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE;YACxB,IAAI,CAAC,YAAY,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;SAC5D;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n getActiveSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SentryNonRecordingSpan,\n SPAN_STATUS_ERROR,\n spanToJSON,\n startIdleSpan as coreStartIdleSpan,\n} from '@sentry/core';\nimport type { Client, Scope, Span, StartSpanOptions } from '@sentry/types';\nimport { generatePropagationContext, logger } from '@sentry/utils';\n\nimport { isRootSpan } from '../utils/span';\nimport { adjustTransactionDuration, cancelInBackground } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './origin';\n\nexport const DEFAULT_NAVIGATION_SPAN_NAME = 'Route Change';\n\nexport const defaultIdleOptions: {\n /**\n * The time that has to pass without any span being created.\n * If this time is exceeded, the idle span will finish.\n *\n * @default 1_000 (ms)\n */\n finalTimeout: number;\n\n /**\n * The max. time an idle span may run.\n * If this time is exceeded, the idle span will finish no matter what.\n *\n * @default 60_0000 (ms)\n */\n idleTimeout: number;\n} = {\n idleTimeout: 1_000,\n finalTimeout: 60_0000,\n};\n\nexport const startIdleNavigationSpan = (\n startSpanOption: StartSpanOptions,\n {\n finalTimeout = defaultIdleOptions.finalTimeout,\n idleTimeout = defaultIdleOptions.idleTimeout,\n }: Partial<typeof defaultIdleOptions> = {},\n): Span | undefined => {\n const client = getClient();\n if (!client) {\n logger.warn(`[startIdleNavigationSpan] Can't create route change span, missing client.`);\n return undefined;\n }\n\n const activeSpan = getActiveSpan();\n if (activeSpan && isRootSpan(activeSpan) && isSentryInteractionSpan(activeSpan)) {\n logger.log(\n `[startIdleNavigationSpan] Canceling ${\n spanToJSON(activeSpan).op\n } transaction because of a new navigation root span.`,\n );\n activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' });\n activeSpan.end();\n }\n\n const finalStartStapOptions = {\n ...getDefaultIdleNavigationSpanOptions(),\n ...startSpanOption,\n };\n\n const idleSpan = startIdleSpan(finalStartStapOptions, { finalTimeout, idleTimeout });\n logger.log(\n `[startIdleNavigationSpan] Starting ${finalStartStapOptions.op || 'unknown op'} transaction \"${\n finalStartStapOptions.name\n }\" on scope`,\n );\n\n adjustTransactionDuration(client, idleSpan, finalTimeout);\n return idleSpan;\n};\n\n/**\n * Starts an idle span from `@sentry/core` with React Native application\n * context awareness.\n *\n * - Span will be started with new propagation context.\n * - Span will be canceled if the app goes to background.\n */\nexport const startIdleSpan = (\n startSpanOption: StartSpanOptions,\n { finalTimeout, idleTimeout }: { finalTimeout: number | undefined; idleTimeout: number | undefined },\n): Span => {\n const client = getClient();\n if (!client) {\n logger.warn(`[startIdleSpan] Can't create idle span, missing client.`);\n return new SentryNonRecordingSpan();\n }\n\n getCurrentScope().setPropagationContext(generatePropagationContext());\n\n const span = coreStartIdleSpan(startSpanOption, { finalTimeout, idleTimeout });\n cancelInBackground(client, span);\n return span;\n};\n\n/**\n * Returns the default options for the idle navigation span.\n */\nexport function getDefaultIdleNavigationSpanOptions(): StartSpanOptions {\n return {\n name: DEFAULT_NAVIGATION_SPAN_NAME,\n op: 'navigation',\n forceTransaction: true,\n scope: getCurrentScope(),\n };\n}\n\n/**\n * Checks if the span is a Sentry User Interaction span.\n */\nexport function isSentryInteractionSpan(span: Span): boolean {\n return spanToJSON(span).origin === SPAN_ORIGIN_AUTO_INTERACTION;\n}\n\nconst SCOPE_SPAN_FIELD = '_sentrySpan';\n\ntype ScopeWithMaybeSpan = Scope & {\n [SCOPE_SPAN_FIELD]?: Span;\n};\n\n/**\n * Removes the active span from the scope.\n */\nexport function clearActiveSpanFromScope(scope: ScopeWithMaybeSpan): void {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scope[SCOPE_SPAN_FIELD];\n}\n\n/**\n * Ensures that all created spans have an operation name.\n */\nexport function addDefaultOpForSpanFrom(client: Client): void {\n client.on('spanStart', (span: Span) => {\n if (!spanToJSON(span).op) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'default');\n }\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplay.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAC,gBAAgB,EAAG,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAA4B,CAAC;AAOnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;A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B,GAAG,KAAK,CAAC,YAAY,CAG/E;AA8BD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,GACA,IAAI,GAAG,SAAS,CA4BlB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAEnF,GACA,IAAI,GAAG,SAAS,CA+ClB"}
@@ -1,4 +1,4 @@
1
- import { getActiveSpan, Span as SpanClass, spanToJSON, startInactiveSpan } from '@sentry/core';
1
+ import { getActiveSpan, getSpanDescendants, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';
2
2
  import { fill, logger } from '@sentry/utils';
3
3
  import * as React from 'react';
4
4
  import { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';
@@ -23,6 +23,7 @@ export function TimeToInitialDisplay(props) {
23
23
  const activeSpan = getActiveSpan();
24
24
  if (activeSpan) {
25
25
  manualInitialDisplaySpans.set(activeSpan, true);
26
+ startTimeToInitialDisplaySpan();
26
27
  }
27
28
  return React.createElement(TimeToDisplay, { initialDisplay: props.record }, props.children);
28
29
  }
@@ -34,6 +35,7 @@ export function TimeToInitialDisplay(props) {
34
35
  * <TimeToInitialDisplay record />
35
36
  */
36
37
  export function TimeToFullDisplay(props) {
38
+ startTimeToFullDisplaySpan();
37
39
  return React.createElement(TimeToDisplay, { fullDisplay: props.record }, props.children);
38
40
  }
39
41
  function TimeToDisplay(props) {
@@ -56,24 +58,19 @@ function TimeToDisplay(props) {
56
58
  * Returns current span if already exists in the currently active span.
57
59
  */
58
60
  export function startTimeToInitialDisplaySpan(options) {
59
- var _a;
60
61
  const activeSpan = getActiveSpan();
61
62
  if (!activeSpan) {
62
63
  logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);
63
- return;
64
- }
65
- if (!(activeSpan instanceof SpanClass)) {
66
- logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);
67
- return;
64
+ return undefined;
68
65
  }
69
- const existingSpan = (_a = activeSpan.spanRecorder) === null || _a === void 0 ? void 0 : _a.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');
66
+ const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');
70
67
  if (existingSpan) {
71
68
  logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);
72
69
  return existingSpan;
73
70
  }
74
- const initialDisplaySpan = startInactiveSpan(Object.assign({ op: 'ui.load.initial_display', name: 'Time To Initial Display', startTimestamp: spanToJSON(activeSpan).start_timestamp }, options));
71
+ const initialDisplaySpan = startInactiveSpan(Object.assign({ op: 'ui.load.initial_display', name: 'Time To Initial Display', startTime: spanToJSON(activeSpan).start_timestamp }, options));
75
72
  if (!initialDisplaySpan) {
76
- return;
73
+ return undefined;
77
74
  }
78
75
  if (!(options === null || options === void 0 ? void 0 : options.isAutoInstrumented)) {
79
76
  manualInitialDisplaySpans.set(activeSpan, true);
@@ -88,36 +85,31 @@ export function startTimeToInitialDisplaySpan(options) {
88
85
  export function startTimeToFullDisplaySpan(options = {
89
86
  timeoutMs: 30000,
90
87
  }) {
91
- var _a;
92
88
  const activeSpan = getActiveSpan();
93
89
  if (!activeSpan) {
94
90
  logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);
95
- return;
91
+ return undefined;
96
92
  }
97
- if (!(activeSpan instanceof SpanClass)) {
98
- logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);
99
- return;
100
- }
101
- const descendantSpans = ((_a = activeSpan.spanRecorder) === null || _a === void 0 ? void 0 : _a.spans) || [];
93
+ const descendantSpans = getSpanDescendants(activeSpan);
102
94
  const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');
103
95
  if (!initialDisplaySpan) {
104
96
  logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);
105
- return;
97
+ return undefined;
106
98
  }
107
99
  const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');
108
100
  if (existingSpan) {
109
101
  logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);
110
102
  return existingSpan;
111
103
  }
112
- const fullDisplaySpan = startInactiveSpan(Object.assign({ op: 'ui.load.full_display', name: 'Time To Full Display', startTimestamp: spanToJSON(initialDisplaySpan).start_timestamp }, options));
104
+ const fullDisplaySpan = startInactiveSpan(Object.assign({ op: 'ui.load.full_display', name: 'Time To Full Display', startTime: spanToJSON(initialDisplaySpan).start_timestamp }, options));
113
105
  if (!fullDisplaySpan) {
114
- return;
106
+ return undefined;
115
107
  }
116
108
  const timeout = setTimeout(() => {
117
109
  if (spanToJSON(fullDisplaySpan).timestamp) {
118
110
  return;
119
111
  }
120
- fullDisplaySpan.setStatus('deadline_exceeded');
112
+ fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });
121
113
  fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);
122
114
  setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);
123
115
  logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);
@@ -157,7 +149,7 @@ function updateInitialDisplaySpan(frameTimestampSeconds) {
157
149
  return;
158
150
  }
159
151
  span.end(frameTimestampSeconds);
160
- span.setStatus('ok');
152
+ span.setStatus({ code: SPAN_STATUS_OK });
161
153
  logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);
162
154
  if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {
163
155
  fullDisplayBeforeInitialDisplay.delete(activeSpan);
@@ -167,18 +159,13 @@ function updateInitialDisplaySpan(frameTimestampSeconds) {
167
159
  setSpanDurationAsMeasurement('time_to_initial_display', span);
168
160
  }
169
161
  function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan) {
170
- var _a;
171
162
  const activeSpan = getActiveSpan();
172
163
  if (!activeSpan) {
173
164
  logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);
174
165
  return;
175
166
  }
176
- if (!(activeSpan instanceof SpanClass)) {
177
- logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);
178
- return;
179
- }
180
167
  const existingInitialDisplaySpan = passedInitialDisplaySpan
181
- || ((_a = activeSpan.spanRecorder) === null || _a === void 0 ? void 0 : _a.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display'));
168
+ || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');
182
169
  const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;
183
170
  if (!initialDisplayEndTimestamp) {
184
171
  fullDisplayBeforeInitialDisplay.set(activeSpan, true);
@@ -202,7 +189,7 @@ function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan)
202
189
  else {
203
190
  span.end(frameTimestampSeconds);
204
191
  }
205
- span.setStatus('ok');
192
+ span.setStatus({ code: SPAN_STATUS_OK });
206
193
  logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);
207
194
  setSpanDurationAsMeasurement('time_to_full_display', span);
208
195
  }
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplay.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,IAAI,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAA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iveSpan } from '@sentry/core';\nimport type { Span,StartSpanOptions } from '@sentry/types';\nimport { fill, logger } from '@sentry/utils';\nimport * as React from 'react';\n\nimport { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';\nimport type {RNSentryOnDrawNextFrameEvent } from './timetodisplaynative.types';\nimport { setSpanDurationAsMeasurement } from './utils';\n\nlet nativeComponentMissingLogged = false;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n spanName?: string;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n\n return <TimeToDisplay initialDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n return <TimeToDisplay fullDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n\n if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) {\n nativeComponentMissingLogged = true;\n // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.\n setTimeout(() => {\n logger.warn('TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');\n }, 0);\n }\n\n const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event);\n\n return (\n <>\n <RNSentryOnDrawReporter\n onDrawNextFrame={onDraw}\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const existingSpan = activeSpan.spanRecorder?.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTimestamp: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return;\n }\n\n if (!options?.isAutoInstrumented) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & { name?: string, timeoutMs?: number } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const descendantSpans = activeSpan.spanRecorder?.spans || [];\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);\n return;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTimestamp: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return;\n }\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus('deadline_exceeded');\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: SpanClass['end']) => (endTimestamp?: Parameters<SpanClass['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n return fullDisplaySpan;\n}\n\nfunction onDrawNextFrame(event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void {\n logger.debug(`[TimeToDisplay] onDrawNextFrame: ${JSON.stringify(event.nativeEvent)}`);\n if (event.nativeEvent.type === 'fullDisplay') {\n return updateFullDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n if (event.nativeEvent.type === 'initialDisplay') {\n return updateInitialDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n}\n\nfunction updateInitialDisplaySpan(frameTimestampSeconds: number): void {\n const span = startTimeToInitialDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n logger.warn(`[TimeToDisplay] Initial display span is not a child of current active span.`);\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n span.end(frameTimestampSeconds);\n span.setStatus('ok');\n logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurement('time_to_initial_display', span);\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || activeSpan.spanRecorder?.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n logger.warn(`[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.`);\n span.end(initialDisplayEndTimestamp);\n } else {\n span.end(frameTimestampSeconds);\n }\n\n span.setStatus('ok');\n logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n}\n"]}
1
+ {"version":3,"file":"timetodisplay.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEnI,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,OAAO,EAAc,CAAC;AAEnE;;GAEG;AACH,MAAM,+BAA+B,GAAG,IAAI,OAAO,EAAc,CAAC;AAQlE;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAyB;IAC5D,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,IAAI,UAAU,EAAE;QACd,yBAAyB,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAChD,6BAA6B,EAAE,CAAC;KACjC;IAED,OAAO,oBAAC,aAAa,IAAC,cAAc,EAAE,KAAK,CAAC,MAAM,IAAG,KAAK,CAAC,QAAQ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AC,GAAG,CAAC,0BAA0B,CAAC,CAAC;KACtC;SAAM;QACL,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KACjC;IAED,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,oCAAoC,CAAC,CAAC;IAE/G,4BAA4B,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { getActiveSpan, getSpanDescendants, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport type { Span,StartSpanOptions } from '@sentry/types';\nimport { fill, logger } from '@sentry/utils';\nimport * as React from 'react';\n\nimport { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';\nimport type {RNSentryOnDrawNextFrameEvent } from './timetodisplaynative.types';\nimport { setSpanDurationAsMeasurement } from './utils';\n\nlet nativeComponentMissingLogged = false;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n spanName?: string;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n startTimeToInitialDisplaySpan();\n }\n\n return <TimeToDisplay initialDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n startTimeToFullDisplaySpan();\n return <TimeToDisplay fullDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n\n if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) {\n nativeComponentMissingLogged = true;\n // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.\n setTimeout(() => {\n logger.warn('TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');\n }, 0);\n }\n\n const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event);\n\n return (\n <>\n <RNSentryOnDrawReporter\n onDrawNextFrame={onDraw}\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return undefined;\n }\n\n const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTime: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return undefined;\n }\n\n if (!options?.isAutoInstrumented) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & { name?: string, timeoutMs?: number } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);\n return undefined;\n }\n\n const descendantSpans = getSpanDescendants(activeSpan);\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);\n return undefined;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTime: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return undefined;\n }\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: Span['end']) => (endTimestamp?: Parameters<Span['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n return fullDisplaySpan;\n}\n\nfunction onDrawNextFrame(event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void {\n logger.debug(`[TimeToDisplay] onDrawNextFrame: ${JSON.stringify(event.nativeEvent)}`);\n if (event.nativeEvent.type === 'fullDisplay') {\n return updateFullDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n if (event.nativeEvent.type === 'initialDisplay') {\n return updateInitialDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n}\n\nfunction updateInitialDisplaySpan(frameTimestampSeconds: number): void {\n const span = startTimeToInitialDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n logger.warn(`[TimeToDisplay] Initial display span is not a child of current active span.`);\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurement('time_to_initial_display', span);\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n logger.warn(`[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.`);\n span.end(initialDisplayEndTimestamp);\n } else {\n span.end(frameTimestampSeconds);\n }\n\n span.setStatus({ code: SPAN_STATUS_OK });\n logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAGjD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAKjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,6BAO5C,CAAA"}
1
+ {"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAKjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,6BAO5C,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { requireNativeComponent, UIManager, View } from 'react-native';
2
+ import { UIManager, View } from 'react-native';
3
+ import { ReactNativeLibraries } from '../utils/rnlibraries';
3
4
  const RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';
4
5
  export const nativeComponentExists = UIManager.hasViewManagerConfig
5
6
  ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)
@@ -17,9 +18,10 @@ let RNSentryOnDrawReporter;
17
18
  * Native component that reports the on draw timestamp.
18
19
  */
19
20
  export const getRNSentryOnDrawReporter = () => {
21
+ var _a;
20
22
  if (!RNSentryOnDrawReporter) {
21
- RNSentryOnDrawReporter = nativeComponentExists
22
- ? requireNativeComponent(RNSentryOnDrawReporterClass)
23
+ RNSentryOnDrawReporter = nativeComponentExists && ((_a = ReactNativeLibraries.ReactNative) === null || _a === void 0 ? void 0 : _a.requireNativeComponent)
24
+ ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass)
23
25
  : RNSentryOnDrawReporterNoop;
24
26
  }
25
27
  return RNSentryOnDrawReporter;
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplaynative.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIvE,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,oBAAoB;IACjE,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,2BAA2B,CAAC;IAC7D,CAAC,CAAC,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAsC;IAC5E,MAAM;QACX,OAAO,CACL,oBAAC,IAAI,oBAAK,IAAI,CAAC,KAAK,EAAI,CACzB,CAAC;IACJ,CAAC;CACF;AAED,IAAI,sBAAsG,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAkC,EAAE;IAC3E,IAAI,CAAC,sBAAsB,EAAE;QAC3B,sBAAsB,GAAG,qBAAqB;YAC5C,CAAC,CAAC,sBAAsB,CAAC,2BAA2B,CAAC;YACrD,CAAC,CAAC,0BAA0B,CAAC;KAChC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAA","sourcesContent":["import * as React from 'react';\nimport type { HostComponent} from 'react-native';\nimport { requireNativeComponent, UIManager, View } from 'react-native';\n\nimport type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';\n\nconst RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';\n\nexport const nativeComponentExists = UIManager.hasViewManagerConfig\n ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)\n : false;\n\n/**\n * This is a fallback component for environments where the native component is not available.\n */\nclass RNSentryOnDrawReporterNoop extends React.Component<RNSentryOnDrawReporterProps> {\n public render(): React.ReactNode {\n return (\n <View {...this.props} />\n );\n }\n}\n\nlet RNSentryOnDrawReporter: HostComponent<RNSentryOnDrawReporterProps> | typeof RNSentryOnDrawReporterNoop;\n\n/**\n * Native component that reports the on draw timestamp.\n */\nexport const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporter => {\n if (!RNSentryOnDrawReporter) {\n RNSentryOnDrawReporter = nativeComponentExists\n ? requireNativeComponent(RNSentryOnDrawReporterClass)\n : RNSentryOnDrawReporterNoop;\n }\n return RNSentryOnDrawReporter;\n}\n"]}
1
+ {"version":3,"file":"timetodisplaynative.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,oBAAoB;IACjE,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,2BAA2B,CAAC;IAC7D,CAAC,CAAC,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAsC;IAC5E,MAAM;QACX,OAAO,CACL,oBAAC,IAAI,oBAAK,IAAI,CAAC,KAAK,EAAI,CACzB,CAAC;IACJ,CAAC;CACF;AAED,IAAI,sBAAsG,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAkC,EAAE;;IAC3E,IAAI,CAAC,sBAAsB,EAAE;QAC3B,sBAAsB,GAAG,qBAAqB,KAAI,MAAA,oBAAoB,CAAC,WAAW,0CAAE,sBAAsB,CAAA;YACxG,CAAC,CAAC,oBAAoB,CAAC,WAAW,CAAC,sBAAsB,CAAC,2BAA2B,CAAC;YACtF,CAAC,CAAC,0BAA0B,CAAC;KAChC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAA","sourcesContent":["import * as React from 'react';\nimport type { HostComponent } from 'react-native';\nimport { UIManager, View } from 'react-native';\n\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';\n\nconst RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';\n\nexport const nativeComponentExists = UIManager.hasViewManagerConfig\n ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)\n : false;\n\n/**\n * This is a fallback component for environments where the native component is not available.\n */\nclass RNSentryOnDrawReporterNoop extends React.Component<RNSentryOnDrawReporterProps> {\n public render(): React.ReactNode {\n return (\n <View {...this.props} />\n );\n }\n}\n\nlet RNSentryOnDrawReporter: HostComponent<RNSentryOnDrawReporterProps> | typeof RNSentryOnDrawReporterNoop;\n\n/**\n * Native component that reports the on draw timestamp.\n */\nexport const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporter => {\n if (!RNSentryOnDrawReporter) {\n RNSentryOnDrawReporter = nativeComponentExists && ReactNativeLibraries.ReactNative?.requireNativeComponent\n ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass)\n : RNSentryOnDrawReporterNoop;\n }\n return RNSentryOnDrawReporter;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { TransactionContext } from '@sentry/types';
1
+ import type { Span } from '@sentry/types';
2
2
  export interface ReactNavigationRoute {
3
3
  name: string;
4
4
  key: string;
@@ -18,12 +18,5 @@ export type RouteChangeContextData = {
18
18
  hasBeenSeen: boolean;
19
19
  };
20
20
  };
21
- export interface ReactNavigationTransactionContext extends TransactionContext {
22
- tags: {
23
- 'routing.instrumentation': string;
24
- 'routing.route.name': string;
25
- };
26
- data: RouteChangeContextData;
27
- }
28
- export type BeforeNavigate = (context: TransactionContext) => TransactionContext;
21
+ export type BeforeNavigate = (context: Span) => void;
29
22
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;IACvE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;IACT,KAAK,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,iCAAkC,SAAQ,kBAAkB;IAC3E,IAAI,EAAE;QACJ,yBAAyB,EAAE,MAAM,CAAC;QAClC,oBAAoB,EAAE,MAAM,CAAC;KAC9B,CAAC;IACF,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,kBAAkB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;IACvE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;IACT,KAAK,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/js/tracing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransactionContext } from '@sentry/types';\n\nexport interface ReactNavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params: Record<string, any>;\n}\n\nexport interface ReactNavigationCurrentRoute extends ReactNavigationRoute {\n hasBeenSeen: boolean;\n}\n\nexport type RouteChangeContextData = {\n previousRoute?: {\n [key: string]: unknown;\n name: string;\n } | null;\n route: {\n [key: string]: unknown;\n name: string;\n hasBeenSeen: boolean;\n };\n};\n\nexport interface ReactNavigationTransactionContext extends TransactionContext {\n tags: {\n 'routing.instrumentation': string;\n 'routing.route.name': string;\n };\n data: RouteChangeContextData;\n}\n\nexport type BeforeNavigate = (context: TransactionContext) => TransactionContext;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/js/tracing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Span } from '@sentry/types';\n\nexport interface ReactNavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params: Record<string, any>;\n}\n\nexport interface ReactNavigationCurrentRoute extends ReactNavigationRoute {\n hasBeenSeen: boolean;\n}\n\nexport type RouteChangeContextData = {\n previousRoute?: {\n [key: string]: unknown;\n name: string;\n } | null;\n route: {\n [key: string]: unknown;\n name: string;\n hasBeenSeen: boolean;\n };\n};\n\nexport type BeforeNavigate = (context: Span) => void;\n"]}
@@ -1,38 +1,49 @@
1
- import { type IdleTransaction, type Span as SpanClass, type Transaction } from '@sentry/core';
2
- import type { Span, TransactionContext, TransactionSource } from '@sentry/types';
1
+ import type { MeasurementUnit, Span, SpanJSON, TransactionSource } from '@sentry/types';
3
2
  export declare const defaultTransactionSource: TransactionSource;
4
3
  export declare const customTransactionSource: TransactionSource;
5
- export declare const getBlankTransactionContext: (name: string) => TransactionContext;
6
4
  /**
7
5
  * A margin of error of 50ms is allowed for the async native bridge call.
8
6
  * Anything larger would reduce the accuracy of our frames measurements.
9
7
  */
10
8
  export declare const MARGIN_OF_ERROR_SECONDS = 0.05;
11
- /**
12
- *
13
- */
14
- export declare function adjustTransactionDuration(maxDurationMs: number, transaction: IdleTransaction, endTimestamp: number): void;
15
9
  /**
16
10
  * Returns the timestamp where the JS global scope was initialized.
17
11
  */
18
12
  export declare function getTimeOriginMilliseconds(): number;
19
- /**
20
- * Calls the callback every time a child span of the transaction is finished.
21
- */
22
- export declare function instrumentChildSpanFinish(transaction: Transaction, callback: (span: SpanClass, endTimestamp?: number) => void): void;
23
13
  /**
24
14
  * Determines if the timestamp is now or within the specified margin of error from now.
25
15
  */
26
- export declare function isNearToNow(timestamp: number): boolean;
16
+ export declare function isNearToNow(timestamp: number | undefined): boolean;
27
17
  /**
28
18
  * Sets the duration of the span as a measurement.
29
19
  * Uses `setMeasurement` function from @sentry/core.
30
20
  */
31
21
  export declare function setSpanDurationAsMeasurement(name: string, span: Span): void;
22
+ /**
23
+ * Sets the duration of the span as a measurement.
24
+ * Uses `setMeasurement` function from @sentry/core.
25
+ */
26
+ export declare function setSpanDurationAsMeasurementOnSpan(name: string, span: Span, on: Span): void;
27
+ /**
28
+ * Sets measurement on the give span.
29
+ */
30
+ export declare function setSpanMeasurement(span: Span, key: string, value: number, unit: MeasurementUnit): void;
31
+ /**
32
+ * Returns the latest end timestamp of the child spans of the given span.
33
+ */
34
+ export declare function getLatestChildSpanEndTimestamp(span: Span): number | undefined;
32
35
  /**
33
36
  * Returns unix timestamp in ms of the bundle start time.
34
37
  *
35
38
  * If not available, returns undefined.
36
39
  */
37
40
  export declare function getBundleStartTimestampMs(): number | undefined;
41
+ /**
42
+ * Creates valid span JSON object from the given data.
43
+ */
44
+ export declare function createSpanJSON(from: Partial<SpanJSON> & Pick<Required<SpanJSON>, 'description' | 'start_timestamp' | 'timestamp' | 'origin'>): SpanJSON;
45
+ /**
46
+ *
47
+ */
48
+ export declare function createChildSpanJSON(parent: SpanJSON, from: Partial<SpanJSON> & Pick<Required<SpanJSON>, 'description' | 'start_timestamp' | 'timestamp'>): SpanJSON;
38
49
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,IAAI,IAAI,SAAS,EACtB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKjF,eAAO,MAAM,wBAAwB,EAAE,iBAA+B,CAAC;AACvE,eAAO,MAAM,uBAAuB,EAAE,iBAA4B,CAAC;AAEnE,eAAO,MAAM,0BAA0B,SAAU,MAAM,KAAG,kBAYzD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAI5C;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,MAAM,GACnB,IAAI,CAON;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAA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