@sentry/react-native 5.29.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 (280) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/js/client.d.ts +5 -9
  3. package/dist/js/client.d.ts.map +1 -1
  4. package/dist/js/client.js +11 -42
  5. package/dist/js/client.js.map +1 -1
  6. package/dist/js/index.d.ts +5 -10
  7. package/dist/js/index.d.ts.map +1 -1
  8. package/dist/js/index.js +4 -21
  9. package/dist/js/index.js.map +1 -1
  10. package/dist/js/integrations/debugsymbolicator.d.ts +2 -8
  11. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  12. package/dist/js/integrations/debugsymbolicator.js +1 -9
  13. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  14. package/dist/js/integrations/default.d.ts.map +1 -1
  15. package/dist/js/integrations/default.js +18 -7
  16. package/dist/js/integrations/default.js.map +1 -1
  17. package/dist/js/integrations/devicecontext.d.ts +2 -8
  18. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  19. package/dist/js/integrations/devicecontext.js +0 -9
  20. package/dist/js/integrations/devicecontext.js.map +1 -1
  21. package/dist/js/integrations/eventorigin.d.ts +2 -8
  22. package/dist/js/integrations/eventorigin.d.ts.map +1 -1
  23. package/dist/js/integrations/eventorigin.js +0 -8
  24. package/dist/js/integrations/eventorigin.js.map +1 -1
  25. package/dist/js/integrations/expocontext.d.ts +2 -8
  26. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  27. package/dist/js/integrations/expocontext.js +0 -8
  28. package/dist/js/integrations/expocontext.js.map +1 -1
  29. package/dist/js/integrations/exports.d.ts +4 -0
  30. package/dist/js/integrations/exports.d.ts.map +1 -1
  31. package/dist/js/integrations/exports.js +4 -0
  32. package/dist/js/integrations/exports.js.map +1 -1
  33. package/dist/js/integrations/modulesloader.d.ts +2 -8
  34. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  35. package/dist/js/integrations/modulesloader.js +0 -8
  36. package/dist/js/integrations/modulesloader.js.map +1 -1
  37. package/dist/js/integrations/nativelinkederrors.d.ts +2 -8
  38. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  39. package/dist/js/integrations/nativelinkederrors.js +0 -8
  40. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  41. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
  42. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  43. package/dist/js/integrations/reactnativeerrorhandlers.js +1 -8
  44. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  45. package/dist/js/integrations/reactnativeinfo.d.ts +2 -8
  46. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  47. package/dist/js/integrations/reactnativeinfo.js +0 -8
  48. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  49. package/dist/js/integrations/release.d.ts +2 -8
  50. package/dist/js/integrations/release.d.ts.map +1 -1
  51. package/dist/js/integrations/release.js +0 -8
  52. package/dist/js/integrations/release.js.map +1 -1
  53. package/dist/js/integrations/rewriteframes.js +1 -1
  54. package/dist/js/integrations/rewriteframes.js.map +1 -1
  55. package/dist/js/integrations/screenshot.d.ts +2 -8
  56. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  57. package/dist/js/integrations/screenshot.js +2 -11
  58. package/dist/js/integrations/screenshot.js.map +1 -1
  59. package/dist/js/integrations/sdkinfo.d.ts +2 -8
  60. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  61. package/dist/js/integrations/sdkinfo.js +0 -8
  62. package/dist/js/integrations/sdkinfo.js.map +1 -1
  63. package/dist/js/integrations/spotlight.d.ts +2 -10
  64. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  65. package/dist/js/integrations/spotlight.js +1 -10
  66. package/dist/js/integrations/spotlight.js.map +1 -1
  67. package/dist/js/integrations/viewhierarchy.d.ts +2 -8
  68. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  69. package/dist/js/integrations/viewhierarchy.js +0 -8
  70. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  71. package/dist/js/options.d.ts +43 -0
  72. package/dist/js/options.d.ts.map +1 -1
  73. package/dist/js/options.js.map +1 -1
  74. package/dist/js/profiling/cache.d.ts +1 -1
  75. package/dist/js/profiling/hermes.d.ts +1 -1
  76. package/dist/js/profiling/hermes.d.ts.map +1 -1
  77. package/dist/js/profiling/integration.d.ts +1 -7
  78. package/dist/js/profiling/integration.d.ts.map +1 -1
  79. package/dist/js/profiling/integration.js +39 -25
  80. package/dist/js/profiling/integration.js.map +1 -1
  81. package/dist/js/profiling/utils.js +2 -1
  82. package/dist/js/profiling/utils.js.map +1 -1
  83. package/dist/js/replay/mobilereplay.d.ts +2 -2
  84. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  85. package/dist/js/replay/mobilereplay.js.map +1 -1
  86. package/dist/js/scopeSync.d.ts +6 -0
  87. package/dist/js/scopeSync.d.ts.map +1 -0
  88. package/dist/js/scopeSync.js +60 -0
  89. package/dist/js/scopeSync.js.map +1 -0
  90. package/dist/js/sdk.d.ts +1 -20
  91. package/dist/js/sdk.d.ts.map +1 -1
  92. package/dist/js/sdk.js +20 -53
  93. package/dist/js/sdk.js.map +1 -1
  94. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  95. package/dist/js/touchevents.d.ts +0 -1
  96. package/dist/js/touchevents.d.ts.map +1 -1
  97. package/dist/js/touchevents.js +5 -9
  98. package/dist/js/touchevents.js.map +1 -1
  99. package/dist/js/tracing/gesturetracing.d.ts +1 -6
  100. package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
  101. package/dist/js/tracing/gesturetracing.js +8 -12
  102. package/dist/js/tracing/gesturetracing.js.map +1 -1
  103. package/dist/js/tracing/index.d.ts +6 -7
  104. package/dist/js/tracing/index.d.ts.map +1 -1
  105. package/dist/js/tracing/index.js +4 -7
  106. package/dist/js/tracing/index.js.map +1 -1
  107. package/dist/js/tracing/integrations/appStart.d.ts +39 -0
  108. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -0
  109. package/dist/js/tracing/integrations/appStart.js +301 -0
  110. package/dist/js/tracing/integrations/appStart.js.map +1 -0
  111. package/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
  112. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -0
  113. package/dist/js/tracing/integrations/nativeFrames.js +256 -0
  114. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -0
  115. package/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
  116. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -0
  117. package/dist/js/tracing/integrations/stalltracking.js +236 -0
  118. package/dist/js/tracing/integrations/stalltracking.js.map +1 -0
  119. package/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
  120. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -0
  121. package/dist/js/tracing/integrations/userInteraction.js +70 -0
  122. package/dist/js/tracing/integrations/userInteraction.js.map +1 -0
  123. package/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
  124. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -0
  125. package/dist/js/tracing/onSpanEndUtils.js +112 -0
  126. package/dist/js/tracing/onSpanEndUtils.js.map +1 -0
  127. package/dist/js/tracing/origin.d.ts +2 -0
  128. package/dist/js/tracing/origin.d.ts.map +1 -0
  129. package/dist/js/tracing/origin.js +2 -0
  130. package/dist/js/tracing/origin.js.map +1 -0
  131. package/dist/js/tracing/reactnativenavigation.d.ts +21 -39
  132. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  133. package/dist/js/tracing/reactnativenavigation.js +98 -87
  134. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  135. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  136. package/dist/js/tracing/reactnativeprofiler.js +6 -13
  137. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  138. package/dist/js/tracing/reactnativetracing.d.ts +44 -160
  139. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  140. package/dist/js/tracing/reactnativetracing.js +51 -481
  141. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  142. package/dist/js/tracing/reactnavigation.d.ts +18 -63
  143. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  144. package/dist/js/tracing/reactnavigation.js +200 -205
  145. package/dist/js/tracing/reactnavigation.js.map +1 -1
  146. package/dist/js/tracing/semanticAttributes.d.ts +12 -0
  147. package/dist/js/tracing/semanticAttributes.d.ts.map +1 -0
  148. package/dist/js/tracing/semanticAttributes.js +12 -0
  149. package/dist/js/tracing/semanticAttributes.js.map +1 -0
  150. package/dist/js/tracing/span.d.ts +52 -0
  151. package/dist/js/tracing/span.d.ts.map +1 -0
  152. package/dist/js/tracing/span.js +82 -0
  153. package/dist/js/tracing/span.js.map +1 -0
  154. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  155. package/dist/js/tracing/timetodisplay.js +14 -29
  156. package/dist/js/tracing/timetodisplay.js.map +1 -1
  157. package/dist/js/tracing/types.d.ts +2 -9
  158. package/dist/js/tracing/types.d.ts.map +1 -1
  159. package/dist/js/tracing/types.js.map +1 -1
  160. package/dist/js/tracing/utils.d.ts +19 -14
  161. package/dist/js/tracing/utils.d.ts.map +1 -1
  162. package/dist/js/tracing/utils.js +38 -52
  163. package/dist/js/tracing/utils.js.map +1 -1
  164. package/dist/js/transports/encodePolyfill.d.ts +3 -0
  165. package/dist/js/transports/encodePolyfill.d.ts.map +1 -0
  166. package/dist/js/transports/encodePolyfill.js +13 -0
  167. package/dist/js/transports/encodePolyfill.js.map +1 -0
  168. package/dist/js/transports/native.d.ts +2 -2
  169. package/dist/js/transports/native.d.ts.map +1 -1
  170. package/dist/js/transports/native.js +2 -1
  171. package/dist/js/transports/native.js.map +1 -1
  172. package/dist/js/utils/fill.d.ts +7 -0
  173. package/dist/js/utils/fill.d.ts.map +1 -0
  174. package/dist/js/utils/fill.js +9 -0
  175. package/dist/js/utils/fill.js.map +1 -0
  176. package/dist/js/utils/span.d.ts +19 -0
  177. package/dist/js/utils/span.d.ts.map +1 -0
  178. package/dist/js/utils/span.js +29 -0
  179. package/dist/js/utils/span.js.map +1 -0
  180. package/dist/js/vendor/react-native/index.d.ts +1 -1
  181. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  182. package/dist/js/vendor/react-native/index.js.map +1 -1
  183. package/dist/js/version.d.ts +1 -1
  184. package/dist/js/version.d.ts.map +1 -1
  185. package/dist/js/version.js +1 -1
  186. package/dist/js/version.js.map +1 -1
  187. package/dist/js/wrapper.d.ts.map +1 -1
  188. package/dist/js/wrapper.js +1 -0
  189. package/dist/js/wrapper.js.map +1 -1
  190. package/package.json +10 -12
  191. package/ts3.8/dist/js/client.d.ts +5 -9
  192. package/ts3.8/dist/js/index.d.ts +5 -10
  193. package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +2 -8
  194. package/ts3.8/dist/js/integrations/devicecontext.d.ts +2 -8
  195. package/ts3.8/dist/js/integrations/eventorigin.d.ts +2 -8
  196. package/ts3.8/dist/js/integrations/expocontext.d.ts +2 -8
  197. package/ts3.8/dist/js/integrations/exports.d.ts +4 -0
  198. package/ts3.8/dist/js/integrations/modulesloader.d.ts +2 -8
  199. package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +2 -8
  200. package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
  201. package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +2 -8
  202. package/ts3.8/dist/js/integrations/release.d.ts +2 -8
  203. package/ts3.8/dist/js/integrations/screenshot.d.ts +2 -8
  204. package/ts3.8/dist/js/integrations/sdkinfo.d.ts +2 -8
  205. package/ts3.8/dist/js/integrations/spotlight.d.ts +2 -10
  206. package/ts3.8/dist/js/integrations/viewhierarchy.d.ts +2 -8
  207. package/ts3.8/dist/js/options.d.ts +43 -0
  208. package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
  209. package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
  210. package/ts3.8/dist/js/profiling/integration.d.ts +1 -7
  211. package/ts3.8/dist/js/replay/mobilereplay.d.ts +2 -2
  212. package/ts3.8/dist/js/scopeSync.d.ts +6 -0
  213. package/ts3.8/dist/js/sdk.d.ts +1 -20
  214. package/ts3.8/dist/js/touchevents.d.ts +0 -1
  215. package/ts3.8/dist/js/tracing/gesturetracing.d.ts +1 -6
  216. package/ts3.8/dist/js/tracing/index.d.ts +6 -7
  217. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +39 -0
  218. package/ts3.8/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
  219. package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
  220. package/ts3.8/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
  221. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
  222. package/ts3.8/dist/js/tracing/origin.d.ts +2 -0
  223. package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +21 -39
  224. package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +44 -160
  225. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +18 -63
  226. package/ts3.8/dist/js/tracing/semanticAttributes.d.ts +12 -0
  227. package/ts3.8/dist/js/tracing/span.d.ts +52 -0
  228. package/ts3.8/dist/js/tracing/types.d.ts +2 -9
  229. package/ts3.8/dist/js/tracing/utils.d.ts +19 -14
  230. package/ts3.8/dist/js/transports/encodePolyfill.d.ts +3 -0
  231. package/ts3.8/dist/js/transports/native.d.ts +2 -2
  232. package/ts3.8/dist/js/utils/fill.d.ts +7 -0
  233. package/ts3.8/dist/js/utils/span.d.ts +19 -0
  234. package/ts3.8/dist/js/vendor/react-native/index.d.ts +1 -1
  235. package/ts3.8/dist/js/version.d.ts +1 -1
  236. package/dist/js/integrations/index.d.ts +0 -16
  237. package/dist/js/integrations/index.d.ts.map +0 -1
  238. package/dist/js/integrations/index.js +0 -17
  239. package/dist/js/integrations/index.js.map +0 -1
  240. package/dist/js/scope.d.ts +0 -54
  241. package/dist/js/scope.d.ts.map +0 -1
  242. package/dist/js/scope.js +0 -89
  243. package/dist/js/scope.js.map +0 -1
  244. package/dist/js/tracing/addTracingExtensions.d.ts +0 -8
  245. package/dist/js/tracing/addTracingExtensions.d.ts.map +0 -1
  246. package/dist/js/tracing/addTracingExtensions.js +0 -66
  247. package/dist/js/tracing/addTracingExtensions.js.map +0 -1
  248. package/dist/js/tracing/nativeframes.d.ts +0 -60
  249. package/dist/js/tracing/nativeframes.d.ts.map +0 -1
  250. package/dist/js/tracing/nativeframes.js +0 -210
  251. package/dist/js/tracing/nativeframes.js.map +0 -1
  252. package/dist/js/tracing/reactnavigationv4.d.ts +0 -92
  253. package/dist/js/tracing/reactnavigationv4.d.ts.map +0 -1
  254. package/dist/js/tracing/reactnavigationv4.js +0 -229
  255. package/dist/js/tracing/reactnavigationv4.js.map +0 -1
  256. package/dist/js/tracing/routingInstrumentation.d.ts +0 -52
  257. package/dist/js/tracing/routingInstrumentation.d.ts.map +0 -1
  258. package/dist/js/tracing/routingInstrumentation.js +0 -36
  259. package/dist/js/tracing/routingInstrumentation.js.map +0 -1
  260. package/dist/js/tracing/stalltracking.d.ts +0 -99
  261. package/dist/js/tracing/stalltracking.d.ts.map +0 -1
  262. package/dist/js/tracing/stalltracking.js +0 -286
  263. package/dist/js/tracing/stalltracking.js.map +0 -1
  264. package/dist/js/tracing/transaction.d.ts +0 -11
  265. package/dist/js/tracing/transaction.d.ts.map +0 -1
  266. package/dist/js/tracing/transaction.js +0 -37
  267. package/dist/js/tracing/transaction.js.map +0 -1
  268. package/dist/js/transports/TextEncoder.d.ts +0 -3
  269. package/dist/js/transports/TextEncoder.d.ts.map +0 -1
  270. package/dist/js/transports/TextEncoder.js +0 -12
  271. package/dist/js/transports/TextEncoder.js.map +0 -1
  272. package/ts3.8/dist/js/integrations/index.d.ts +0 -16
  273. package/ts3.8/dist/js/scope.d.ts +0 -54
  274. package/ts3.8/dist/js/tracing/addTracingExtensions.d.ts +0 -8
  275. package/ts3.8/dist/js/tracing/nativeframes.d.ts +0 -60
  276. package/ts3.8/dist/js/tracing/reactnavigationv4.d.ts +0 -92
  277. package/ts3.8/dist/js/tracing/routingInstrumentation.d.ts +0 -52
  278. package/ts3.8/dist/js/tracing/stalltracking.d.ts +0 -99
  279. package/ts3.8/dist/js/tracing/transaction.d.ts +0 -11
  280. package/ts3.8/dist/js/transports/TextEncoder.d.ts +0 -3
@@ -1,92 +0,0 @@
1
- import type { TransactionContext } from '@sentry/types';
2
- import type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';
3
- import { InternalRoutingInstrumentation } from './routingInstrumentation';
4
- import type { BeforeNavigate } from './types';
5
- export interface NavigationRouteV4 {
6
- routeName: string;
7
- key: string;
8
- params?: Record<string, any>;
9
- }
10
- export interface NavigationStateV4 {
11
- index: number;
12
- key: string;
13
- isTransitioning: boolean;
14
- routeName?: string;
15
- routes: (NavigationRouteV4 | NavigationStateV4)[];
16
- }
17
- export interface AppContainerInstance {
18
- _navigation: {
19
- state: NavigationStateV4;
20
- router: {
21
- getStateForAction: (action: any, state: NavigationStateV4) => NavigationStateV4;
22
- };
23
- };
24
- }
25
- interface ReactNavigationV4Options {
26
- /**
27
- * How long the instrumentation will wait for the route to mount after a change has been initiated,
28
- * before the transaction is discarded.
29
- * Time is in ms.
30
- *
31
- * Default: 1000
32
- */
33
- routeChangeTimeoutMs: number;
34
- }
35
- /**
36
- * Instrumentation for React-Navigation V4.
37
- * Register the app container with `registerAppContainer` to use, or see docs for more details.
38
- */
39
- declare class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {
40
- static instrumentationName: string;
41
- readonly name: string;
42
- private _appContainer;
43
- private readonly _maxRecentRouteLen;
44
- private _prevRoute?;
45
- private _recentRouteKeys;
46
- private _latestTransaction?;
47
- private _initialStateHandled;
48
- private _stateChangeTimeout?;
49
- private _options;
50
- constructor(options?: Partial<ReactNavigationV4Options>);
51
- /**
52
- * Extends by calling _handleInitialState at the end.
53
- */
54
- registerRoutingInstrumentation(listener: TransactionCreator, beforeNavigate: BeforeNavigate, onConfirmRoute: OnConfirmRoute): void;
55
- /**
56
- * Pass the ref to the app container to register it to the instrumentation
57
- * @param appContainerRef Ref to an `AppContainer`
58
- */
59
- registerAppContainer(appContainerRef: any): void;
60
- /**
61
- * Updates the latest transaction with the current state and calls beforeNavigate.
62
- */
63
- private _updateLatestTransaction;
64
- /**
65
- * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the
66
- * new screen is mounted.
67
- */
68
- private _patchRouter;
69
- /**
70
- * To be called on navigation state changes and creates the transaction.
71
- */
72
- private _onStateChange;
73
- /** Creates final transaction context before confirmation */
74
- private _prepareFinalContext;
75
- /**
76
- * Gets the transaction context for a `NavigationRouteV4`
77
- */
78
- private _getTransactionContext;
79
- /**
80
- * Gets the current route given a navigation state
81
- */
82
- private _getCurrentRouteFromState;
83
- /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */
84
- private _pushRecentRouteKey;
85
- /** Helper to log a transaction that was not sampled due to beforeNavigate */
86
- private _onBeforeNavigateNotSampled;
87
- /** Cancels the latest transaction so it does not get sent to Sentry. */
88
- private _discardLatestTransaction;
89
- }
90
- declare const INITIAL_TRANSACTION_CONTEXT_V4: TransactionContext;
91
- export { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };
92
- //# sourceMappingURL=reactnavigationv4.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reactnavigationv4.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIrE,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,cA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cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAmBP;;;OAGG;IAEI,oBAAoB,CAAC,eAAe,EAAE,GAAG,GAAG,IAAI;IAmCvD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAchC;;;OAGG;IACH,OAAO,CAAC,YAAY;IAcpB;;OAEG;IACH,OAAO,CAAC,cAAc;IA4CtB,4DAA4D;IAC5D,OAAO,CAAC,oBAAoB;IAsB5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAiC9B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAejC,sGAAsG;IACtG,OAAO,CAAC,mBAAmB,CAMzB;IAEF,6EAA6E;IAC7E,OAAO,CAAC,2BAA2B,CAIjC;IAEF,wEAAwE;IACxE,OAAO,CAAC,yBAAyB;CAOlC;AAED,QAAA,MAAM,8BAA8B,EAAE,kBAUrC,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1,229 +0,0 @@
1
- import { logger } from '@sentry/utils';
2
- import { RN_GLOBAL_OBJ } from '../utils/worldwide';
3
- import { InternalRoutingInstrumentation } from './routingInstrumentation';
4
- import { customTransactionSource, defaultTransactionSource } from './utils';
5
- const defaultOptions = {
6
- routeChangeTimeoutMs: 1000,
7
- };
8
- /**
9
- * Instrumentation for React-Navigation V4.
10
- * Register the app container with `registerAppContainer` to use, or see docs for more details.
11
- */
12
- class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {
13
- constructor(options = {}) {
14
- super();
15
- this.name = ReactNavigationV4Instrumentation.instrumentationName;
16
- this._appContainer = null;
17
- this._maxRecentRouteLen = 200;
18
- this._recentRouteKeys = [];
19
- this._initialStateHandled = false;
20
- /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */
21
- this._pushRecentRouteKey = (key) => {
22
- this._recentRouteKeys.push(key);
23
- if (this._recentRouteKeys.length > this._maxRecentRouteLen) {
24
- this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);
25
- }
26
- };
27
- /** Helper to log a transaction that was not sampled due to beforeNavigate */
28
- this._onBeforeNavigateNotSampled = (transactionName) => {
29
- logger.log(`[ReactNavigationV4Instrumentation] Will not send transaction "${transactionName}" due to beforeNavigate.`);
30
- };
31
- this._options = Object.assign(Object.assign({}, defaultOptions), options);
32
- }
33
- /**
34
- * Extends by calling _handleInitialState at the end.
35
- */
36
- registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute) {
37
- super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);
38
- // Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.
39
- if (!this._initialStateHandled) {
40
- this._latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT_V4);
41
- if (this._appContainer) {
42
- this._updateLatestTransaction();
43
- this._initialStateHandled = true;
44
- }
45
- else {
46
- this._stateChangeTimeout = setTimeout(this._discardLatestTransaction.bind(this), this._options.routeChangeTimeoutMs);
47
- }
48
- }
49
- }
50
- /**
51
- * Pass the ref to the app container to register it to the instrumentation
52
- * @param appContainerRef Ref to an `AppContainer`
53
- */
54
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
55
- registerAppContainer(appContainerRef) {
56
- /* We prevent duplicate routing instrumentation to be initialized on fast refreshes
57
-
58
- Explanation: If the user triggers a fast refresh on the file that the instrumentation is
59
- initialized in, it will initialize a new instance and will cause undefined behavior.
60
- */
61
- if (!RN_GLOBAL_OBJ.__sentry_rn_v4_registered) {
62
- if ('current' in appContainerRef) {
63
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
64
- this._appContainer = appContainerRef.current;
65
- }
66
- else {
67
- this._appContainer = appContainerRef;
68
- }
69
- if (this._appContainer) {
70
- this._patchRouter();
71
- if (!this._initialStateHandled) {
72
- if (this._latestTransaction) {
73
- this._updateLatestTransaction();
74
- }
75
- else {
76
- logger.log('[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.');
77
- }
78
- this._initialStateHandled = true;
79
- }
80
- RN_GLOBAL_OBJ.__sentry_rn_v4_registered = true;
81
- }
82
- else {
83
- logger.warn('[ReactNavigationV4Instrumentation] Received invalid app container ref!');
84
- }
85
- }
86
- }
87
- /**
88
- * Updates the latest transaction with the current state and calls beforeNavigate.
89
- */
90
- _updateLatestTransaction() {
91
- // We can assume the ref is present as this is called from registerAppContainer
92
- if (this._appContainer && this._latestTransaction) {
93
- const state = this._appContainer._navigation.state;
94
- if (typeof this._stateChangeTimeout !== 'undefined') {
95
- clearTimeout(this._stateChangeTimeout);
96
- this._stateChangeTimeout = undefined;
97
- }
98
- this._onStateChange(state, true);
99
- }
100
- }
101
- /**
102
- * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the
103
- * new screen is mounted.
104
- */
105
- _patchRouter() {
106
- if (this._appContainer) {
107
- const originalGetStateForAction = this._appContainer._navigation.router.getStateForAction;
108
- this._appContainer._navigation.router.getStateForAction = (action, state) => {
109
- const newState = originalGetStateForAction(action, state);
110
- this._onStateChange(newState);
111
- return newState;
112
- };
113
- }
114
- }
115
- /**
116
- * To be called on navigation state changes and creates the transaction.
117
- */
118
- _onStateChange(state, updateLatestTransaction = false) {
119
- var _a;
120
- // it's not guaranteed that a state is always produced.
121
- // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301
122
- if (!state || state === undefined) {
123
- logger.warn('[ReactNavigationV4Instrumentation] onStateChange called without a valid state.');
124
- return;
125
- }
126
- const currentRoute = this._getCurrentRouteFromState(state);
127
- // If the route is a different key, this is so we ignore actions that pertain to the same screen.
128
- if (!this._prevRoute || currentRoute.key !== this._prevRoute.key) {
129
- const originalContext = this._getTransactionContext(currentRoute, this._prevRoute);
130
- let mergedContext = originalContext;
131
- if (updateLatestTransaction && this._latestTransaction) {
132
- mergedContext = Object.assign(Object.assign({}, this._latestTransaction.toContext()), originalContext);
133
- }
134
- const finalContext = this._prepareFinalContext(mergedContext);
135
- if (updateLatestTransaction && this._latestTransaction) {
136
- // Update the latest transaction instead of calling onRouteWillChange
137
- this._latestTransaction.updateWithContext(finalContext);
138
- const isCustomName = mergedContext.name !== finalContext.name;
139
- this._latestTransaction.setName(finalContext.name, isCustomName ? customTransactionSource : defaultTransactionSource);
140
- }
141
- else {
142
- this._latestTransaction = this.onRouteWillChange(finalContext);
143
- }
144
- (_a = this._onConfirmRoute) === null || _a === void 0 ? void 0 : _a.call(this, finalContext);
145
- this._pushRecentRouteKey(currentRoute.key);
146
- this._prevRoute = currentRoute;
147
- }
148
- }
149
- /** Creates final transaction context before confirmation */
150
- _prepareFinalContext(mergedContext) {
151
- var _a;
152
- let finalContext = (_a = this._beforeNavigate) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign({}, mergedContext));
153
- // This block is to catch users not returning a transaction context
154
- if (!finalContext) {
155
- logger.error(`[ReactNavigationV4Instrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`);
156
- finalContext = Object.assign(Object.assign({}, mergedContext), { sampled: false });
157
- }
158
- if (finalContext.sampled === false) {
159
- this._onBeforeNavigateNotSampled(finalContext.name);
160
- }
161
- return finalContext;
162
- }
163
- /**
164
- * Gets the transaction context for a `NavigationRouteV4`
165
- */
166
- _getTransactionContext(route, previousRoute) {
167
- const data = {
168
- route: {
169
- name: route.routeName,
170
- key: route.key,
171
- // TODO: filter PII params instead of dropping them all
172
- params: {},
173
- hasBeenSeen: this._recentRouteKeys.includes(route.key),
174
- },
175
- previousRoute: previousRoute
176
- ? {
177
- name: previousRoute.routeName,
178
- key: previousRoute.key,
179
- // TODO: filter PII params instead of dropping them all
180
- params: {},
181
- }
182
- : null,
183
- };
184
- return {
185
- name: route.routeName,
186
- op: 'navigation',
187
- tags: {
188
- 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,
189
- 'routing.route.name': route.routeName,
190
- },
191
- data,
192
- };
193
- }
194
- /**
195
- * Gets the current route given a navigation state
196
- */
197
- _getCurrentRouteFromState(state) {
198
- const parentRoute = state.routes[state.index];
199
- if ('index' in parentRoute &&
200
- 'routes' in parentRoute &&
201
- typeof parentRoute.index === 'number' &&
202
- Array.isArray(parentRoute.routes)) {
203
- return this._getCurrentRouteFromState(parentRoute);
204
- }
205
- return parentRoute;
206
- }
207
- /** Cancels the latest transaction so it does not get sent to Sentry. */
208
- _discardLatestTransaction() {
209
- if (this._latestTransaction) {
210
- this._latestTransaction.sampled = false;
211
- this._latestTransaction.finish();
212
- this._latestTransaction = undefined;
213
- }
214
- }
215
- }
216
- ReactNavigationV4Instrumentation.instrumentationName = 'react-navigation-v4';
217
- const INITIAL_TRANSACTION_CONTEXT_V4 = {
218
- name: 'App Launch',
219
- op: 'navigation',
220
- tags: {
221
- 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,
222
- },
223
- data: {},
224
- metadata: {
225
- source: 'view',
226
- },
227
- };
228
- export { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };
229
- //# sourceMappingURL=reactnavigationv4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reactnavigationv4.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAyC5E,MAAM,cAAc,GAA6B;IAC/C,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,gCAAiC,SAAQ,8BAA8B;IAkB3E,YAAmB,UAA6C,EAAE;QAChE,KAAK,EAAE,CAAC;QAhBM,SAAI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,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,gCAAgC,CAAC,mBAAmB;KAChF;IACD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Transaction, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource } from './utils';\n\nexport interface NavigationRouteV4 {\n routeName: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\nexport interface NavigationStateV4 {\n index: number;\n key: string;\n isTransitioning: boolean;\n routeName?: string;\n routes: (NavigationRouteV4 | NavigationStateV4)[];\n}\n\nexport interface AppContainerInstance {\n _navigation: {\n state: NavigationStateV4;\n router: {\n getStateForAction: (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n action: any,\n state: NavigationStateV4,\n ) => NavigationStateV4;\n };\n };\n}\n\ninterface ReactNavigationV4Options {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNavigationV4Options = {\n routeChangeTimeoutMs: 1000,\n};\n\n/**\n * Instrumentation for React-Navigation V4.\n * Register the app container with `registerAppContainer` to use, or see docs for more details.\n */\nclass ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v4';\n\n public readonly name: string = ReactNavigationV4Instrumentation.instrumentationName;\n\n private _appContainer: AppContainerInstance | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _prevRoute?: NavigationRouteV4;\n private _recentRouteKeys: string[] = [];\n\n private _latestTransaction?: Transaction;\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n\n private _options: ReactNavigationV4Options;\n\n public constructor(options: Partial<ReactNavigationV4Options> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.\n if (!this._initialStateHandled) {\n this._latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT_V4);\n if (this._appContainer) {\n this._updateLatestTransaction();\n\n this._initialStateHandled = true;\n } else {\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n }\n }\n\n /**\n * Pass the ref to the app container to register it to the instrumentation\n * @param appContainerRef Ref to an `AppContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerAppContainer(appContainerRef: any): void {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (!RN_GLOBAL_OBJ.__sentry_rn_v4_registered) {\n if ('current' in appContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._appContainer = appContainerRef.current;\n } else {\n this._appContainer = appContainerRef;\n }\n\n if (this._appContainer) {\n this._patchRouter();\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n this._updateLatestTransaction();\n } else {\n logger.log(\n '[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.',\n );\n }\n this._initialStateHandled = true;\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v4_registered = true;\n } else {\n logger.warn('[ReactNavigationV4Instrumentation] Received invalid app container ref!');\n }\n }\n }\n\n /**\n * Updates the latest transaction with the current state and calls beforeNavigate.\n */\n private _updateLatestTransaction(): void {\n // We can assume the ref is present as this is called from registerAppContainer\n if (this._appContainer && this._latestTransaction) {\n const state = this._appContainer._navigation.state;\n\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n\n this._onStateChange(state, true);\n }\n }\n\n /**\n * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the\n * new screen is mounted.\n */\n private _patchRouter(): void {\n if (this._appContainer) {\n const originalGetStateForAction = this._appContainer._navigation.router.getStateForAction;\n\n this._appContainer._navigation.router.getStateForAction = (action, state) => {\n const newState = originalGetStateForAction(action, state);\n\n this._onStateChange(newState);\n\n return newState;\n };\n }\n }\n\n /**\n * To be called on navigation state changes and creates the transaction.\n */\n private _onStateChange(state: NavigationStateV4 | undefined, updateLatestTransaction: boolean = false): void {\n // it's not guaranteed that a state is always produced.\n // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301\n if (!state || state === undefined) {\n logger.warn('[ReactNavigationV4Instrumentation] onStateChange called without a valid state.');\n\n return;\n }\n\n const currentRoute = this._getCurrentRouteFromState(state);\n\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (!this._prevRoute || currentRoute.key !== this._prevRoute.key) {\n const originalContext = this._getTransactionContext(currentRoute, this._prevRoute);\n\n let mergedContext = originalContext;\n if (updateLatestTransaction && this._latestTransaction) {\n mergedContext = {\n ...this._latestTransaction.toContext(),\n ...originalContext,\n };\n }\n\n const finalContext = this._prepareFinalContext(mergedContext);\n\n if (updateLatestTransaction && this._latestTransaction) {\n // Update the latest transaction instead of calling onRouteWillChange\n this._latestTransaction.updateWithContext(finalContext);\n const isCustomName = mergedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n } else {\n this._latestTransaction = this.onRouteWillChange(finalContext);\n }\n\n this._onConfirmRoute?.(finalContext);\n\n this._pushRecentRouteKey(currentRoute.key);\n this._prevRoute = currentRoute;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(mergedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...mergedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationV4Instrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...mergedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n this._onBeforeNavigateNotSampled(finalContext.name);\n }\n\n return finalContext;\n }\n\n /**\n * Gets the transaction context for a `NavigationRouteV4`\n */\n private _getTransactionContext(\n route: NavigationRouteV4,\n previousRoute?: NavigationRouteV4,\n ): ReactNavigationTransactionContext {\n const data: RouteChangeContextData = {\n route: {\n name: route.routeName, // Include name here too for use in `beforeNavigate`\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: this._recentRouteKeys.includes(route.key),\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.routeName,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n return {\n name: route.routeName,\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n 'routing.route.name': route.routeName,\n },\n data,\n };\n }\n\n /**\n * Gets the current route given a navigation state\n */\n private _getCurrentRouteFromState(state: NavigationStateV4): NavigationRouteV4 {\n const parentRoute = state.routes[state.index];\n\n if (\n 'index' in parentRoute &&\n 'routes' in parentRoute &&\n typeof parentRoute.index === 'number' &&\n Array.isArray(parentRoute.routes)\n ) {\n return this._getCurrentRouteFromState(parentRoute);\n }\n\n return parentRoute as NavigationRouteV4;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Helper to log a transaction that was not sampled due to beforeNavigate */\n private _onBeforeNavigateNotSampled = (transactionName: string): void => {\n logger.log(\n `[ReactNavigationV4Instrumentation] Will not send transaction \"${transactionName}\" due to beforeNavigate.`,\n );\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n }\n}\n\nconst INITIAL_TRANSACTION_CONTEXT_V4: TransactionContext = {\n name: 'App Launch',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n },\n data: {},\n metadata: {\n source: 'view',\n },\n};\n\nexport { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };\n"]}
@@ -1,52 +0,0 @@
1
- import type { Hub } from '@sentry/core';
2
- import type { Transaction, TransactionContext } from '@sentry/types';
3
- import type { BeforeNavigate } from './types';
4
- export type TransactionCreator = (context: TransactionContext) => Transaction | undefined;
5
- export type OnConfirmRoute = (context: TransactionContext) => void;
6
- export interface RoutingInstrumentationInstance {
7
- /**
8
- * Name of the routing instrumentation
9
- */
10
- readonly name: string;
11
- /**
12
- * Registers a listener that's called on every route change with a `TransactionContext`.
13
- *
14
- * Do not overwrite this unless you know what you are doing.
15
- *
16
- * @param listener A `RouteListener`
17
- * @param beforeNavigate BeforeNavigate
18
- * @param inConfirmRoute OnConfirmRoute
19
- */
20
- registerRoutingInstrumentation(listener: TransactionCreator, beforeNavigate: BeforeNavigate, onConfirmRoute: OnConfirmRoute): void;
21
- /**
22
- * To be called when the route changes, BEFORE the new route mounts.
23
- * If this is called after a route mounts the child spans will not be correctly attached.
24
- *
25
- * @param context A `TransactionContext` used to initialize the transaction.
26
- */
27
- onRouteWillChange(context: TransactionContext): Transaction | undefined;
28
- }
29
- /**
30
- * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.
31
- * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.
32
- */
33
- export declare class RoutingInstrumentation implements RoutingInstrumentationInstance {
34
- static instrumentationName: string;
35
- readonly name: string;
36
- protected _getCurrentHub?: () => Hub;
37
- protected _beforeNavigate?: BeforeNavigate;
38
- protected _onConfirmRoute?: OnConfirmRoute;
39
- protected _tracingListener?: TransactionCreator;
40
- /** @inheritdoc */
41
- registerRoutingInstrumentation(listener: TransactionCreator, beforeNavigate: BeforeNavigate, onConfirmRoute: OnConfirmRoute): void;
42
- /** @inheritdoc */
43
- onRouteWillChange(context: TransactionContext): Transaction | undefined;
44
- }
45
- /**
46
- * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange
47
- */
48
- export declare class InternalRoutingInstrumentation extends RoutingInstrumentation {
49
- /** @inheritdoc */
50
- onRouteWillChange(context: TransactionContext): Transaction | undefined;
51
- }
52
- //# sourceMappingURL=routingInstrumentation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routingInstrumentation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,WAAW,GAAG,SAAS,CAAC;AAE1F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEnE,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;OAQG;IACH,8BAA8B,CAC5B,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI,CAAC;IACR;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS,CAAC;CACzE;AAED;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,8BAA8B;IAC3E,OAAc,mBAAmB,EAAE,MAAM,CAAkC;IAE3E,SAAgB,IAAI,EAAE,MAAM,CAA8C;IAE1E,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC;IACrC,SAAS,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IAEhD,kBAAkB;IACX,8BAA8B,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAMP,kBAAkB;IACX,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS;CAS/E;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS;CAG/E"}
@@ -1,36 +0,0 @@
1
- /**
2
- * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.
3
- * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.
4
- */
5
- export class RoutingInstrumentation {
6
- constructor() {
7
- this.name = RoutingInstrumentation.instrumentationName;
8
- }
9
- /** @inheritdoc */
10
- registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute) {
11
- this._tracingListener = listener;
12
- this._beforeNavigate = beforeNavigate;
13
- this._onConfirmRoute = onConfirmRoute;
14
- }
15
- /** @inheritdoc */
16
- onRouteWillChange(context) {
17
- var _a, _b;
18
- const transaction = (_a = this._tracingListener) === null || _a === void 0 ? void 0 : _a.call(this, context);
19
- if (transaction) {
20
- (_b = this._onConfirmRoute) === null || _b === void 0 ? void 0 : _b.call(this, context);
21
- }
22
- return transaction;
23
- }
24
- }
25
- RoutingInstrumentation.instrumentationName = 'base-routing-instrumentation';
26
- /**
27
- * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange
28
- */
29
- export class InternalRoutingInstrumentation extends RoutingInstrumentation {
30
- /** @inheritdoc */
31
- onRouteWillChange(context) {
32
- var _a;
33
- return (_a = this._tracingListener) === null || _a === void 0 ? void 0 : _a.call(this, context);
34
- }
35
- }
36
- //# sourceMappingURL=routingInstrumentation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routingInstrumentation.js","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AAqCA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAGkB,SAAI,GAAW,sBAAsB,CAAC,mBAAmB,CAAC;IA4B5E,CAAC;IArBC,kBAAkB;IACX,8BAA8B,CACnC,QAA4B,EAC5B,cAA8B,EAC9B,cAA8B;QAE9B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;QAErD,IAAI,WAAW,EAAE;YACf,MAAA,IAAI,CAAC,eAAe,qDAAG,OAAO,CAAC,CAAC;SACjC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;;AA7Ba,0CAAmB,GAAW,8BAA8B,CAAC;AAgC7E;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,OAAO,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { Hub } from '@sentry/core';\nimport type { Transaction, TransactionContext } from '@sentry/types';\n\nimport type { BeforeNavigate } from './types';\n\nexport type TransactionCreator = (context: TransactionContext) => Transaction | undefined;\n\nexport type OnConfirmRoute = (context: TransactionContext) => void;\n\nexport interface RoutingInstrumentationInstance {\n /**\n * Name of the routing instrumentation\n */\n readonly name: string;\n /**\n * Registers a listener that's called on every route change with a `TransactionContext`.\n *\n * Do not overwrite this unless you know what you are doing.\n *\n * @param listener A `RouteListener`\n * @param beforeNavigate BeforeNavigate\n * @param inConfirmRoute OnConfirmRoute\n */\n registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void;\n /**\n * To be called when the route changes, BEFORE the new route mounts.\n * If this is called after a route mounts the child spans will not be correctly attached.\n *\n * @param context A `TransactionContext` used to initialize the transaction.\n */\n onRouteWillChange(context: TransactionContext): Transaction | undefined;\n}\n\n/**\n * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.\n * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.\n */\nexport class RoutingInstrumentation implements RoutingInstrumentationInstance {\n public static instrumentationName: string = 'base-routing-instrumentation';\n\n public readonly name: string = RoutingInstrumentation.instrumentationName;\n\n protected _getCurrentHub?: () => Hub;\n protected _beforeNavigate?: BeforeNavigate;\n protected _onConfirmRoute?: OnConfirmRoute;\n protected _tracingListener?: TransactionCreator;\n\n /** @inheritdoc */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n this._tracingListener = listener;\n this._beforeNavigate = beforeNavigate;\n this._onConfirmRoute = onConfirmRoute;\n }\n\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n const transaction = this._tracingListener?.(context);\n\n if (transaction) {\n this._onConfirmRoute?.(context);\n }\n\n return transaction;\n }\n}\n\n/**\n * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange\n */\nexport class InternalRoutingInstrumentation extends RoutingInstrumentation {\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n return this._tracingListener?.(context);\n }\n}\n"]}
@@ -1,99 +0,0 @@
1
- import type { IdleTransaction, Transaction } from '@sentry/core';
2
- import type { Measurements, MeasurementUnit } from '@sentry/types';
3
- import { STALL_COUNT, STALL_LONGEST_TIME, STALL_TOTAL_TIME } from '../measurements';
4
- export interface StallMeasurements extends Measurements {
5
- [STALL_COUNT]: {
6
- value: number;
7
- unit: MeasurementUnit;
8
- };
9
- [STALL_TOTAL_TIME]: {
10
- value: number;
11
- unit: MeasurementUnit;
12
- };
13
- [STALL_LONGEST_TIME]: {
14
- value: number;
15
- unit: MeasurementUnit;
16
- };
17
- }
18
- export type StallTrackingOptions = {
19
- /**
20
- * How long in milliseconds an event loop iteration can be delayed for before being considered a "stall."
21
- * @default 100
22
- */
23
- minimumStallThreshold: number;
24
- };
25
- /**
26
- * Stall measurement tracker inspired by the `JSEventLoopWatchdog` used internally in React Native:
27
- * https://github.com/facebook/react-native/blob/006f5afe120c290a37cf6ff896748fbc062bf7ed/Libraries/Interaction/JSEventLoopWatchdog.js
28
- *
29
- * However, we modified the interval implementation to instead have a fixed loop timeout interval of `LOOP_TIMEOUT_INTERVAL_MS`.
30
- * We then would consider that iteration a stall when the total time for that interval to run is greater than `LOOP_TIMEOUT_INTERVAL_MS + minimumStallThreshold`
31
- */
32
- export declare class StallTrackingInstrumentation {
33
- isTracking: boolean;
34
- private _minimumStallThreshold;
35
- /** Total amount of time of all stalls that occurred during the current tracking session */
36
- private _totalStallTime;
37
- /** Total number of stalls that occurred during the current tracking session */
38
- private _stallCount;
39
- /** The last timestamp the iteration ran in milliseconds */
40
- private _lastIntervalMs;
41
- private _timeout;
42
- private _isBackground;
43
- private _statsByTransaction;
44
- constructor(options?: StallTrackingOptions);
45
- /**
46
- * @inheritDoc
47
- * Not used for this integration. Instead call `registerTransactionStart` to start tracking.
48
- */
49
- setupOnce(): void;
50
- /**
51
- * Register a transaction as started. Starts stall tracking if not already running.
52
- * @returns A finish method that returns the stall measurements.
53
- */
54
- onTransactionStart(transaction: Transaction): void;
55
- /**
56
- * Logs a transaction as finished.
57
- * Stops stall tracking if no more transactions are running.
58
- * @returns The stall measurements
59
- */
60
- onTransactionFinish(transaction: Transaction | IdleTransaction, passedEndTimestamp?: number): void;
61
- /**
62
- * Switch that enables the iteraction once app moves from background to foreground.
63
- */
64
- private _backgroundEventListener;
65
- /**
66
- * Logs the finish time of the span for use in `trimEnd: true` transactions.
67
- */
68
- private _markSpanFinish;
69
- /**
70
- * Get the current stats for a transaction at a given time.
71
- */
72
- private _getCurrentStats;
73
- /**
74
- * Start tracking stalls
75
- */
76
- private _startTracking;
77
- /**
78
- * Stops the stall tracking interval and calls reset().
79
- */
80
- private _stopTracking;
81
- /**
82
- * Will stop tracking if there are no more transactions.
83
- */
84
- private _shouldStopTracking;
85
- /**
86
- * Clears all the collected stats
87
- */
88
- private _reset;
89
- /**
90
- * Iteration of the stall tracking interval. Measures how long the timer strayed from its expected time of running, and how
91
- * long the stall is for.
92
- */
93
- private _iteration;
94
- /**
95
- * Deletes leaked transactions (Earliest transactions when we have more than MAX_RUNNING_TRANSACTIONS transactions.)
96
- */
97
- private _flushLeakedTransactions;
98
- }
99
- //# sourceMappingURL=stalltracking.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"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