@sentry/react-native 5.0.0-rc.1 → 5.1.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 (34) hide show
  1. package/CHANGELOG.md +94 -6
  2. package/RNSentry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  5. package/dist/js/integrations/devicecontext.js +6 -1
  6. package/dist/js/integrations/devicecontext.js.map +1 -1
  7. package/dist/js/measurements.d.ts +5 -0
  8. package/dist/js/measurements.d.ts.map +1 -1
  9. package/dist/js/measurements.js +8 -4
  10. package/dist/js/measurements.js.map +1 -1
  11. package/dist/js/tracing/index.d.ts +1 -0
  12. package/dist/js/tracing/index.d.ts.map +1 -1
  13. package/dist/js/tracing/index.js +1 -0
  14. package/dist/js/tracing/index.js.map +1 -1
  15. package/dist/js/tracing/ops.d.ts +6 -0
  16. package/dist/js/tracing/ops.d.ts.map +1 -0
  17. package/dist/js/tracing/ops.js +6 -0
  18. package/dist/js/tracing/ops.js.map +1 -0
  19. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  20. package/dist/js/tracing/reactnativetracing.js +7 -4
  21. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  22. package/dist/js/tracing/stalltracking.d.ts +4 -3
  23. package/dist/js/tracing/stalltracking.d.ts.map +1 -1
  24. package/dist/js/tracing/stalltracking.js +4 -3
  25. package/dist/js/tracing/stalltracking.js.map +1 -1
  26. package/dist/js/utils/ignorerequirecyclelogs.d.ts +1 -2
  27. package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -1
  28. package/dist/js/utils/ignorerequirecyclelogs.js +3 -10
  29. package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
  30. package/dist/js/version.d.ts +1 -1
  31. package/dist/js/version.d.ts.map +1 -1
  32. package/dist/js/version.js +1 -1
  33. package/dist/js/version.js.map +1 -1
  34. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Features
6
+
7
+ - Add App Context `in_foreground` ([#2826](https://github.com/getsentry/sentry-react-native/pull/2826))
8
+
9
+ ### Fixes
10
+
11
+ - Match app start measurements naming with other SDKs ([#2855](https://github.com/getsentry/sentry-react-native/pull/2855))
12
+ - `app.start.cold` to `app_start_cold`
13
+ - `app.start.warm` to `app_start_warm`
14
+
15
+ ### Dependencies
16
+
17
+ - Bump Cocoa SDK from v8.0.0 to v8.2.0 ([#2776](https://github.com/getsentry/sentry-react-native/pull/2776))
18
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#820)
19
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.0.0...8.2.0)
20
+ - Bump JavaScript SDK from v7.37.2 to v7.40.0 ([#2836](https://github.com/getsentry/sentry-react-native/pull/2836), [#2864](https://github.com/getsentry/sentry-react-native/pull/2864))
21
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7400)
22
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.37.2...7.40.0)
23
+ - Bump CLI from v2.10.0 to v2.14.3 ([#2848](https://github.com/getsentry/sentry-react-native/pull/2848), [#2869](https://github.com/getsentry/sentry-react-native/pull/2869))
24
+ - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2143)
25
+ - [diff](https://github.com/getsentry/sentry-cli/compare/2.10.0...2.14.3)
26
+ - Bump Android SDK from v6.14.0 to v6.15.0 ([#2868](https://github.com/getsentry/sentry-react-native/pull/2868))
27
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6150)
28
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.14.0...6.15.0)
29
+
30
+ ## 5.0.0
31
+
32
+ The React Native SDK version 5 supports both Legacy (from RN 0.65 and above) and New Architecture (from RN 0.69 and above) as well as the new React Native Gradle Plugin (introduced in RN 0.71). For detailed [migration guide visit our docs](https://docs.sentry.io/platforms/react-native/migration/#from-4x-to-5x).
33
+
34
+ ### Features
35
+
36
+ - Add support for the RN New Architecture, backwards compatible RNSentry Turbo Module ([#2522](https://github.com/getsentry/sentry-react-native/pull/2522))
37
+ - Add View Hierarchy to the crashed/errored events ([#2708](https://github.com/getsentry/sentry-react-native/pull/2708))
38
+ - Send react native js engine, turbo module, fabric flags and component stack in Event contexts ([#2552](https://github.com/getsentry/sentry-react-native/pull/2552))
39
+ - Sync `tags`, `extra`, `fingerprint`, `level`, `environment` and `breadcrumbs` from `sentry-cocoa` during event processing. ([#2713](https://github.com/getsentry/sentry-react-native/pull/2713))
40
+ - `breadcrumb.level` value `log` is transformed to `debug` when syncing with native layers.
41
+ - Remove `breadcrumb.level` value `critical` transformation to `fatal`.
42
+ - Default `breadcrumb.level` is `info`
43
+
44
+ ### Breaking changes
45
+
46
+ - Option `enableAutoPerformanceTracking` renamed to `enableAutoPerformanceTracing`
47
+ - Option `enableOutOfMemoryTracking` renamed to `enableWatchdogTerminationTracking`
48
+ - Remove link hooks (RN 0.68 and older) ([#2332](https://github.com/getsentry/sentry-react-native/pull/2332))
49
+ - iOS min target 11, Android API min 21, min React Native version 0.65 ([#2522](https://github.com/getsentry/sentry-react-native/pull/2522), [#2687](https://github.com/getsentry/sentry-react-native/pull/2687))
50
+ - New ReactNativeTracingOptions ([#2481](https://github.com/getsentry/sentry-react-native/pull/2481))
51
+ - `idleTimeout` renamed to `idleTimeoutMs`
52
+ - `maxTransactionDuration` renamed to `finalTimeoutMs`
53
+ - `touchEventBoundaryProps.labelName` property instead of default `accessibilityLabel` fallback ([#2712](https://github.com/getsentry/sentry-react-native/pull/2712))
54
+ - Message event current stack trace moved from `exception` to `threads` ([#2694](https://github.com/getsentry/sentry-react-native/pull/2694))
55
+
56
+ ### Fixes
57
+
58
+ - Unreachable fallback to fetch transport if native is not available ([#2695](https://github.com/getsentry/sentry-react-native/pull/2695))
59
+
60
+ ### Dependencies
61
+
62
+ - Bump Cocoa SDK from v7.31.5 to v8.0.0 ([#2756](https://github.com/getsentry/sentry-react-native/pull/2756))
63
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#800)
64
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/7.31.5...8.0.0)
65
+ - Bump CLI from v1.74.4 to v2.10.0 ([#2669](https://github.com/getsentry/sentry-react-native/pull/2669))
66
+ - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2100)
67
+ - [diff](https://github.com/getsentry/sentry-cli/compare/1.74.4...2.10.0)
68
+
69
+ ## 4.15.0
70
+
71
+ ### Features
72
+
73
+ - Collect modules script for XCode builds supports NODE_BINARY to set path to node executable ([#2805](https://github.com/getsentry/sentry-react-native/pull/2805))
74
+
75
+ ### Fixes
76
+
77
+ - React Native Error Handlers Integration doesn't crash if ErrorUtils are not available ([#2808](https://github.com/getsentry/sentry-react-native/pull/2808))
78
+
79
+ ### Dependencies
80
+
81
+ - Bump Android SDK from v6.12.1 to v6.14.0 ([#2790](https://github.com/getsentry/sentry-react-native/pull/2790), [#2809](https://github.com/getsentry/sentry-react-native/pull/2809), [#2828](https://github.com/getsentry/sentry-react-native/pull/2828))
82
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6140)
83
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.12.1...6.14.0)
84
+ - Bump Sample React Native from v0.71.0 to v0.71.1 ([#2767](https://github.com/getsentry/sentry-react-native/pull/2767))
85
+ - [changelog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md#v0711)
86
+ - [diff](https://github.com/facebook/react-native/compare/v0.71.0...v0.71.1)
87
+ - Bump JavaScript SDK from v7.32.1 to v7.37.2 ([#2785](https://github.com/getsentry/sentry-react-native/pull/2785), [#2799](https://github.com/getsentry/sentry-react-native/pull/2799), [#2818](https://github.com/getsentry/sentry-react-native/pull/2818))
88
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7372)
89
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.32.1...7.37.2)
90
+
3
91
  ## 5.0.0-rc.1
4
92
 
5
93
  ### Fixes
@@ -15,15 +103,15 @@
15
103
 
16
104
  ### Dependencies
17
105
 
18
- - Bump Android SDK from v6.12.1 to v6.13.1 ([#2790](https://github.com/getsentry/sentry-react-native/pull/2790), [#2809](https://github.com/getsentry/sentry-react-native/pull/2809))
19
- - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6131)
20
- - [diff](https://github.com/getsentry/sentry-java/compare/6.12.1...6.13.1)
106
+ - Bump Android SDK from v6.12.1 to v6.14.0 ([#2790](https://github.com/getsentry/sentry-react-native/pull/2790), [#2809](https://github.com/getsentry/sentry-react-native/pull/2809), [#2828](https://github.com/getsentry/sentry-react-native/pull/2828))
107
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6140)
108
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.12.1...6.14.0)
21
109
  - Bump Sample React Native from v0.71.0 to v0.71.1 ([#2767](https://github.com/getsentry/sentry-react-native/pull/2767))
22
110
  - [changelog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md#v0711)
23
111
  - [diff](https://github.com/facebook/react-native/compare/v0.71.0...v0.71.1)
24
- - Bump JavaScript SDK from v7.32.1 to v7.36.0 ([#2785](https://github.com/getsentry/sentry-react-native/pull/2785), [#2799](https://github.com/getsentry/sentry-react-native/pull/2799))
25
- - [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7360)
26
- - [diff](https://github.com/getsentry/sentry-javascript/compare/7.32.1...7.36.0)
112
+ - Bump JavaScript SDK from v7.32.1 to v7.37.2 ([#2785](https://github.com/getsentry/sentry-react-native/pull/2785), [#2799](https://github.com/getsentry/sentry-react-native/pull/2799), [#2818](https://github.com/getsentry/sentry-react-native/pull/2818))
113
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7372)
114
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.32.1...7.37.2)
27
115
 
28
116
  ## 5.0.0-beta.1
29
117
 
package/RNSentry.podspec CHANGED
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
19
19
  s.preserve_paths = '*.js'
20
20
 
21
21
  s.dependency 'React-Core'
22
- s.dependency 'Sentry/HybridSDK', '8.0.0'
22
+ s.dependency 'Sentry/HybridSDK', '8.2.0'
23
23
 
24
24
  s.source_files = 'ios/**/*.{h,mm}'
25
25
  s.public_header_files = 'ios/RNSentry.h'
@@ -42,5 +42,5 @@ android {
42
42
 
43
43
  dependencies {
44
44
  implementation 'com.facebook.react:react-native:+'
45
- api 'io.sentry:sentry-android:6.13.1'
45
+ api 'io.sentry:sentry-android:6.15.0'
46
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"devicecontext.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO7E,uCAAuC;AACvC,qBAAa,aAAc,YAAW,WAAW;IAC/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAmB;IAE3C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAoB;IAEvC;;OAEG;IACI,SAAS,CACd,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC3D,aAAa,EAAE,MAAM,GAAG,GACvB,IAAI;CAmER"}
1
+ {"version":3,"file":"devicecontext.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ7E,uCAAuC;AACvC,qBAAa,aAAc,YAAW,WAAW;IAC/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAmB;IAE3C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAoB;IAEvC;;OAEG;IACI,SAAS,CACd,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC3D,aAAa,EAAE,MAAM,GAAG,GACvB,IAAI;CA0ER"}
@@ -1,5 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { logger, severityLevelFromString } from '@sentry/utils';
3
+ import { AppState } from 'react-native';
3
4
  import { breadcrumbFromObject } from '../breadcrumb';
4
5
  import { NATIVE } from '../wrapper';
5
6
  /** Load device context from native. */
@@ -34,7 +35,11 @@ export class DeviceContext {
34
35
  if (!event.user && nativeUser) {
35
36
  event.user = nativeUser;
36
37
  }
37
- const nativeContext = native.context;
38
+ let nativeContext = native.context;
39
+ if (AppState.currentState !== 'unknown') {
40
+ nativeContext = nativeContext || {};
41
+ nativeContext.app = Object.assign(Object.assign({}, nativeContext.app), { in_foreground: AppState.currentState === 'active' });
42
+ }
38
43
  if (nativeContext) {
39
44
  event.contexts = Object.assign(Object.assign({}, nativeContext), event.contexts);
40
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"devicecontext.js","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,uCAAuC;AACvC,MAAM,OAAO,aAAa;IAA1B;QAME;;WAEG;QACI,SAAI,GAAW,aAAa,CAAC,EAAE,CAAC;IA2EzC,CAAC;IAzEC;;OAEG;IACI,SAAS,CACd,uBAA2D,EAC3D,aAAwB;QAExB,uBAAuB,CAAC,CAAO,KAAY,EAAE,EAAE;;YAC7C,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAC3D,IAAI,CAAC,IAAI,EAAE;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AA,CAAC,CAChF,CAAA;aACF;YAED,MAAM,WAAW,GAAG,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,QAAQ;gBACrD,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC1C,CAAC,CAAC,SAAS,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,WAAW,EAAE;gBAC/B,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC;aAC3B;YAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;YAChD,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,iBAAiB,EAAE;gBAC3C,KAAK,CAAC,WAAW,GAAG,iBAAiB,CAAC;aACvC;YAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC5D,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;gBACjD,CAAC,CAAC,SAAS,CAAC;YACd,IAAI,iBAAiB,EAAE;gBACrB,KAAK,CAAC,WAAW,GAAG,iBAAiB,CAAC;aACvC;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AAlFD;;GAEG;AACW,gBAAE,GAAW,eAAe,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Event, EventProcessor, Hub, Integration } from '@sentry/types';\nimport { logger, severityLevelFromString } from '@sentry/utils';\n\nimport { breadcrumbFromObject } from '../breadcrumb';\nimport type { NativeDeviceContextsResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\n/** Load device context from native. */\nexport class DeviceContext implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DeviceContext';\n\n /**\n * @inheritDoc\n */\n public name: string = DeviceContext.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub,\n ): void {\n addGlobalEventProcessor(async (event: Event) => {\n const self = getCurrentHub().getIntegration(DeviceContext);\n if (!self) {\n return event;\n }\n\n let native: NativeDeviceContextsResponse | null = null;\n try {\n native = await NATIVE.fetchNativeDeviceContexts();\n } catch (e) {\n logger.log(`Failed to get device context from native: ${e}`);\n }\n\n if (!native) {\n return event;\n }\n\n const nativeUser = native.user;\n if (!event.user && nativeUser) {\n event.user = nativeUser;\n }\n\n const nativeContext = native.context;\n if (nativeContext) {\n event.contexts = { ...nativeContext, ...event.contexts };\n }\n\n const nativeTags = native.tags;\n if (nativeTags) {\n event.tags = { ...nativeTags, ...event.tags };\n }\n\n const nativeExtra = native.extra;\n if (nativeExtra) {\n event.extra = { ...nativeExtra, ...event.extra };\n }\n\n const nativeFingerprint = native.fingerprint;\n if (nativeFingerprint) {\n event.fingerprint = (event.fingerprint ?? []).concat(\n nativeFingerprint.filter((item) => (event.fingerprint ?? []).indexOf(item) < 0),\n )\n }\n\n const nativeLevel = typeof native['level'] === 'string'\n ? severityLevelFromString(native['level'])\n : undefined;\n if (!event.level && nativeLevel) {\n event.level = nativeLevel;\n }\n\n const nativeEnvironment = native['environment'];\n if (!event.environment && nativeEnvironment) {\n event.environment = nativeEnvironment;\n }\n\n const nativeBreadcrumbs = Array.isArray(native['breadcrumbs'])\n ? native['breadcrumbs'].map(breadcrumbFromObject)\n : undefined;\n if (nativeBreadcrumbs) {\n event.breadcrumbs = nativeBreadcrumbs;\n }\n\n return event;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"devicecontext.js","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,uCA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;aACvC;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AAzFD;;GAEG;AACW,gBAAE,GAAW,eAAe,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Event, EventProcessor, Hub, Integration } from '@sentry/types';\nimport { logger, severityLevelFromString } from '@sentry/utils';\nimport { AppState } from 'react-native';\n\nimport { breadcrumbFromObject } from '../breadcrumb';\nimport type { NativeDeviceContextsResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\n/** Load device context from native. */\nexport class DeviceContext implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DeviceContext';\n\n /**\n * @inheritDoc\n */\n public name: string = DeviceContext.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub,\n ): void {\n addGlobalEventProcessor(async (event: Event) => {\n const self = getCurrentHub().getIntegration(DeviceContext);\n if (!self) {\n return event;\n }\n\n let native: NativeDeviceContextsResponse | null = null;\n try {\n native = await NATIVE.fetchNativeDeviceContexts();\n } catch (e) {\n logger.log(`Failed to get device context from native: ${e}`);\n }\n\n if (!native) {\n return event;\n }\n\n const nativeUser = native.user;\n if (!event.user && nativeUser) {\n event.user = nativeUser;\n }\n\n let nativeContext = native.context;\n if (AppState.currentState !== 'unknown') {\n nativeContext = nativeContext || {};\n nativeContext.app = {\n ...nativeContext.app,\n in_foreground: AppState.currentState === 'active',\n }\n }\n if (nativeContext) {\n event.contexts = { ...nativeContext, ...event.contexts };\n }\n\n const nativeTags = native.tags;\n if (nativeTags) {\n event.tags = { ...nativeTags, ...event.tags };\n }\n\n const nativeExtra = native.extra;\n if (nativeExtra) {\n event.extra = { ...nativeExtra, ...event.extra };\n }\n\n const nativeFingerprint = native.fingerprint;\n if (nativeFingerprint) {\n event.fingerprint = (event.fingerprint ?? []).concat(\n nativeFingerprint.filter((item) => (event.fingerprint ?? []).indexOf(item) < 0),\n )\n }\n\n const nativeLevel = typeof native['level'] === 'string'\n ? severityLevelFromString(native['level'])\n : undefined;\n if (!event.level && nativeLevel) {\n event.level = nativeLevel;\n }\n\n const nativeEnvironment = native['environment'];\n if (!event.environment && nativeEnvironment) {\n event.environment = nativeEnvironment;\n }\n\n const nativeBreadcrumbs = Array.isArray(native['breadcrumbs'])\n ? native['breadcrumbs'].map(breadcrumbFromObject)\n : undefined;\n if (nativeBreadcrumbs) {\n event.breadcrumbs = nativeBreadcrumbs;\n }\n\n return event;\n });\n }\n}\n"]}
@@ -1,6 +1,11 @@
1
1
  import type { Hub } from '@sentry/core';
2
2
  import type { Transaction } from '@sentry/tracing';
3
3
  import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
4
+ export declare const APP_START_WARM = "app_start_warm";
5
+ export declare const APP_START_COLD = "app_start_cold";
6
+ export declare const STALL_COUNT = "stall_count";
7
+ export declare const STALL_TOTAL_TIME = "stall_total_time";
8
+ export declare const STALL_LONGEST_TIME = "stall_longest_time";
4
9
  /**
5
10
  * Adds React Native's extensions. Needs to be called after @sentry/tracing's extension methods are added
6
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../../src/js/measurements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAqB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMlG;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAmB5C;AAED,oBAAY,wBAAwB,GAAG,CACrC,IAAI,EAAE,GAAG,EACT,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,CAAC,EAAE,qBAAqB,KAC1C,WAAW,CAAC"}
1
+ {"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../../src/js/measurements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAqB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIlG,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAmB5C;AAED,oBAAY,wBAAwB,GAAG,CACrC,IAAI,EAAE,GAAG,EACT,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,CAAC,EAAE,qBAAqB,KAC1C,WAAW,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import { getCurrentHub, getMainCarrier } from '@sentry/core';
2
- import { ReactNativeTracing } from './tracing';
3
- const SPAN_OP_DEFAULT = 'default';
2
+ import { DEFAULT, ReactNativeTracing } from './tracing';
3
+ export const APP_START_WARM = 'app_start_warm';
4
+ export const APP_START_COLD = 'app_start_cold';
5
+ export const STALL_COUNT = 'stall_count';
6
+ export const STALL_TOTAL_TIME = 'stall_total_time';
7
+ export const STALL_LONGEST_TIME = 'stall_longest_time';
4
8
  /**
5
9
  * Adds React Native's extensions. Needs to be called after @sentry/tracing's extension methods are added
6
10
  */
@@ -30,7 +34,7 @@ const _patchStartTransaction = (originalStartTransaction) => {
30
34
  function _startTransaction(transactionContext, customSamplingContext) {
31
35
  // Native SDKs require op to be set - for JS Relay sets `default`
32
36
  if (!transactionContext.op) {
33
- transactionContext.op = SPAN_OP_DEFAULT;
37
+ transactionContext.op = DEFAULT;
34
38
  }
35
39
  const transaction = originalStartTransaction.apply(this, [
36
40
  transactionContext,
@@ -40,7 +44,7 @@ const _patchStartTransaction = (originalStartTransaction) => {
40
44
  transaction.startChild = (spanContext) => {
41
45
  return originalStartChild(Object.assign(Object.assign({}, spanContext), {
42
46
  // Native SDKs require op to be set
43
- op: (spanContext === null || spanContext === void 0 ? void 0 : spanContext.op) || SPAN_OP_DEFAULT }));
47
+ op: (spanContext === null || spanContext === void 0 ? void 0 : spanContext.op) || DEFAULT }));
44
48
  };
45
49
  const reactNativeTracing = getCurrentHub().getIntegration(ReactNativeTracing);
46
50
  if (reactNativeTracing) {
@@ -1 +1 @@
1
- {"version":3,"file":"measurements.js","sourceRoot":"","sources":["../../src/js/measurements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,OAAO,CAAC,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;QACpE,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAClD,MAAM,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU;iBAC3D,gBAA4C,CAAC;YAEhD;;;cAGE;YACF,MAAM,iBAAiB,GAAG,sBAAsB,CAC9C,wBAAwB,CACzB,CAAC;YAEF,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;SACpE;KACF;AACH,CAAC;AAQD;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAC7B,wBAAkD,EACxB,EAAE;IAC5B;;OAEG;IACH,SAAS,iBAAiB,CAExB,kBAAsC,EACtC,qBAA6C;QAE7C,iEAAiE;QACjE,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE;YAC1B,kBAAkB,CAAC,EAAE,GAAG,eAAe,CAAC;SACzC;QAED,MAAM,WAAW,GAAgB,wBAAwB,CAAC,KAAK,CAAC,IAAI,EAAE;YACpE,kBAAkB;YAClB,qBAAqB;SACtB,CAAC,CAAC;QACH,MAAM,kBAAkB,GAA8B,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/F,WAAW,CAAC,UAAU,GAAG,CACvB,WAAmG,EAC7F,EAAE;YACR,OAAO,kBAAkB,iCACpB,WAAW;gBACd,mCAAmC;gBACnC,EAAE,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,EAAE,KAAI,eAAe,IACtC,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,kBAAkB,GAAG,aAAa,EAAE,CAAC,cAAc,CACvD,kBAAkB,CACnB,CAAC;QAEF,IAAI,kBAAkB,EAAE;YACtB,kBAAkB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAEnD,6DAA6D;YAC7D,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC;YAE1C,WAAW,CAAC,MAAM,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACxD,IAAI,kBAAkB,EAAE;oBACtB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;iBACrD;gBAED,OAAO,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3D,CAAC,CAAC;SACH;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import type { Hub } from '@sentry/core';\nimport { getCurrentHub, getMainCarrier } from '@sentry/core';\nimport type { Transaction } from '@sentry/tracing';\nimport type { CustomSamplingContext, Span, SpanContext, TransactionContext } from '@sentry/types';\n\nimport { ReactNativeTracing } from './tracing';\n\nconst SPAN_OP_DEFAULT = 'default';\n\n/**\n * Adds React Native's extensions. Needs to be called after @sentry/tracing's extension methods are added\n */\nexport function _addTracingExtensions(): void {\n const carrier = getMainCarrier();\n if (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (carrier.__SENTRY__.extensions.startTransaction) {\n const originalStartTransaction = carrier.__SENTRY__.extensions\n .startTransaction as StartTransactionFunction;\n\n /*\n Overwrites the transaction start and finish to start and finish stall tracking.\n Preferably instead of overwriting add a callback method for this in the Transaction itself.\n */\n const _startTransaction = _patchStartTransaction(\n originalStartTransaction\n );\n\n carrier.__SENTRY__.extensions.startTransaction = _startTransaction;\n }\n }\n}\n\nexport type StartTransactionFunction = (\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext\n) => Transaction;\n\n/**\n * Overwrite the startTransaction extension method to start and end stall tracking.\n */\nconst _patchStartTransaction = (\n originalStartTransaction: StartTransactionFunction\n): StartTransactionFunction => {\n /**\n * Method to overwrite with\n */\n function _startTransaction(\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext\n ): Transaction {\n // Native SDKs require op to be set - for JS Relay sets `default`\n if (!transactionContext.op) {\n transactionContext.op = SPAN_OP_DEFAULT;\n }\n\n const transaction: Transaction = originalStartTransaction.apply(this, [\n transactionContext,\n customSamplingContext,\n ]);\n const originalStartChild: Transaction['startChild'] = transaction.startChild.bind(transaction);\n transaction.startChild = (\n spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,\n ): Span => {\n return originalStartChild({\n ...spanContext,\n // Native SDKs require op to be set\n op: spanContext?.op || SPAN_OP_DEFAULT,\n });\n };\n\n const reactNativeTracing = getCurrentHub().getIntegration(\n ReactNativeTracing\n );\n\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionStart(transaction);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalFinish = transaction.finish;\n\n transaction.finish = (endTimestamp: number | undefined) => {\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionFinish(transaction);\n }\n\n return originalFinish.apply(transaction, [endTimestamp]);\n };\n }\n\n return transaction;\n }\n\n return _startTransaction;\n};\n"]}
1
+ {"version":3,"file":"measurements.js","sourceRoot":"","sources":["../../src/js/measurements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,EAAE,OAAO,EAAC,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,OAAO,CAAC,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;QACpE,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAClD,MAAM,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU;iBAC3D,gBAA4C,CAAC;YAEhD;;;cAGE;YACF,MAAM,iBAAiB,GAAG,sBAAsB,CAC9C,wBAAwB,CACzB,CAAC;YAEF,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;SACpE;KACF;AACH,CAAC;AAQD;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAC7B,wBAAkD,EACxB,EAAE;IAC5B;;OAEG;IACH,SAAS,iBAAiB,CAExB,kBAAsC,EACtC,qBAA6C;QAE7C,iEAAiE;QACjE,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE;YAC1B,kBAAkB,CAAC,EAAE,GAAG,OAAO,CAAC;SACjC;QAED,MAAM,WAAW,GAAgB,wBAAwB,CAAC,KAAK,CAAC,IAAI,EAAE;YACpE,kBAAkB;YAClB,qBAAqB;SACtB,CAAC,CAAC;QACH,MAAM,kBAAkB,GAA8B,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/F,WAAW,CAAC,UAAU,GAAG,CACvB,WAAmG,EAC7F,EAAE;YACR,OAAO,kBAAkB,iCACpB,WAAW;gBACd,mCAAmC;gBACnC,EAAE,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,EAAE,KAAI,OAAO,IAC9B,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,kBAAkB,GAAG,aAAa,EAAE,CAAC,cAAc,CACvD,kBAAkB,CACnB,CAAC;QAEF,IAAI,kBAAkB,EAAE;YACtB,kBAAkB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAEnD,6DAA6D;YAC7D,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC;YAE1C,WAAW,CAAC,MAAM,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACxD,IAAI,kBAAkB,EAAE;oBACtB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;iBACrD;gBAED,OAAO,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3D,CAAC,CAAC;SACH;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import type { Hub } from '@sentry/core';\nimport { getCurrentHub, getMainCarrier } from '@sentry/core';\nimport type { Transaction } from '@sentry/tracing';\nimport type { CustomSamplingContext, Span, SpanContext, TransactionContext } from '@sentry/types';\n\nimport { DEFAULT,ReactNativeTracing } from './tracing';\n\nexport const APP_START_WARM = 'app_start_warm';\nexport const APP_START_COLD = 'app_start_cold';\n\nexport const STALL_COUNT = 'stall_count';\nexport const STALL_TOTAL_TIME = 'stall_total_time';\nexport const STALL_LONGEST_TIME = 'stall_longest_time';\n\n/**\n * Adds React Native's extensions. Needs to be called after @sentry/tracing's extension methods are added\n */\nexport function _addTracingExtensions(): void {\n const carrier = getMainCarrier();\n if (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (carrier.__SENTRY__.extensions.startTransaction) {\n const originalStartTransaction = carrier.__SENTRY__.extensions\n .startTransaction as StartTransactionFunction;\n\n /*\n Overwrites the transaction start and finish to start and finish stall tracking.\n Preferably instead of overwriting add a callback method for this in the Transaction itself.\n */\n const _startTransaction = _patchStartTransaction(\n originalStartTransaction\n );\n\n carrier.__SENTRY__.extensions.startTransaction = _startTransaction;\n }\n }\n}\n\nexport type StartTransactionFunction = (\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext\n) => Transaction;\n\n/**\n * Overwrite the startTransaction extension method to start and end stall tracking.\n */\nconst _patchStartTransaction = (\n originalStartTransaction: StartTransactionFunction\n): StartTransactionFunction => {\n /**\n * Method to overwrite with\n */\n function _startTransaction(\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext\n ): Transaction {\n // Native SDKs require op to be set - for JS Relay sets `default`\n if (!transactionContext.op) {\n transactionContext.op = DEFAULT;\n }\n\n const transaction: Transaction = originalStartTransaction.apply(this, [\n transactionContext,\n customSamplingContext,\n ]);\n const originalStartChild: Transaction['startChild'] = transaction.startChild.bind(transaction);\n transaction.startChild = (\n spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,\n ): Span => {\n return originalStartChild({\n ...spanContext,\n // Native SDKs require op to be set\n op: spanContext?.op || DEFAULT,\n });\n };\n\n const reactNativeTracing = getCurrentHub().getIntegration(\n ReactNativeTracing\n );\n\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionStart(transaction);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalFinish = transaction.finish;\n\n transaction.finish = (endTimestamp: number | undefined) => {\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionFinish(transaction);\n }\n\n return originalFinish.apply(transaction, [endTimestamp]);\n };\n }\n\n return transaction;\n }\n\n return _startTransaction;\n};\n"]}
@@ -5,4 +5,5 @@ export { ReactNavigationV4Instrumentation } from './reactnavigationv4';
5
5
  export { ReactNativeNavigationInstrumentation } from './reactnativenavigation';
6
6
  export { ReactNavigationCurrentRoute, ReactNavigationRoute, ReactNavigationTransactionContext, } from './types';
7
7
  export { ReactNativeProfiler } from './reactnativeprofiler';
8
+ export * from './ops';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,8BAA8B,EAE9B,gCAAgC,GACjC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,8BAA8B,EAE9B,gCAAgC,GACjC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,cAAc,OAAO,CAAC"}
@@ -6,4 +6,5 @@ ReactNavigationV5Instrumentation, } from './reactnavigation';
6
6
  export { ReactNavigationV4Instrumentation } from './reactnavigationv4';
7
7
  export { ReactNativeNavigationInstrumentation } from './reactnativenavigation';
8
8
  export { ReactNativeProfiler } from './reactnativeprofiler';
9
+ export * from './ops';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,sBAAsB,GAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,8BAA8B;AAC9B,mDAAmD;AACnD,gCAAgC,GACjC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAQ/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { ReactNativeTracing } from './reactnativetracing';\n\nexport {\n RoutingInstrumentation,\n RoutingInstrumentationInstance,\n} from './routingInstrumentation';\n\nexport {\n ReactNavigationInstrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n} from './reactnavigation';\nexport { ReactNavigationV4Instrumentation } from './reactnavigationv4';\nexport { ReactNativeNavigationInstrumentation } from './reactnativenavigation';\n\nexport {\n ReactNavigationCurrentRoute,\n ReactNavigationRoute,\n ReactNavigationTransactionContext,\n} from './types';\n\nexport { ReactNativeProfiler } from './reactnativeprofiler';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,sBAAsB,GAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,8BAA8B;AAC9B,mDAAmD;AACnD,gCAAgC,GACjC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAQ/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,cAAc,OAAO,CAAC","sourcesContent":["export { ReactNativeTracing } from './reactnativetracing';\n\nexport {\n RoutingInstrumentation,\n RoutingInstrumentationInstance,\n} from './routingInstrumentation';\n\nexport {\n ReactNavigationInstrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n} from './reactnavigation';\nexport { ReactNavigationV4Instrumentation } from './reactnavigationv4';\nexport { ReactNativeNavigationInstrumentation } from './reactnativenavigation';\n\nexport {\n ReactNavigationCurrentRoute,\n ReactNavigationRoute,\n ReactNavigationTransactionContext,\n} from './types';\n\nexport { ReactNativeProfiler } from './reactnativeprofiler';\n\nexport * from './ops';\n"]}
@@ -0,0 +1,6 @@
1
+ export declare const DEFAULT = "default";
2
+ export declare const UI_LOAD = "ui.load";
3
+ export declare const NAVIGATION = "navigation";
4
+ export declare const APP_START_COLD = "app.start.cold";
5
+ export declare const APP_START_WARM = "app.start.warm";
6
+ //# sourceMappingURL=ops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/ops.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const DEFAULT = 'default';
2
+ export const UI_LOAD = 'ui.load';
3
+ export const NAVIGATION = 'navigation';
4
+ export const APP_START_COLD = 'app.start.cold';
5
+ export const APP_START_WARM = 'app.start.warm';
6
+ //# sourceMappingURL=ops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../src/js/tracing/ops.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC","sourcesContent":["\nexport const DEFAULT = 'default';\nexport const UI_LOAD = 'ui.load';\nexport const NAVIGATION = 'navigation';\n\nexport const APP_START_COLD = 'app.start.cold';\nexport const APP_START_WARM = 'app.start.warm';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAEV,6BAA6B,EAC7B,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAGZ,MAAM,eAAe,CAAC;AAIvB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAExF,OAAO,E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CjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiCxB,6FAA6F;IAC7F,OAAO,CAAC,kBAAkB;IAM1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB,uCAAuC;IACvC,OAAO,CAAC,uBAAuB;CAkFhC"}
@@ -1,8 +1,10 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { defaultRequestInstrumentationOptions, instrumentOutgoingRequests, startIdleTransaction } from '@sentry/tracing';
3
3
  import { logger } from '@sentry/utils';
4
+ import { APP_START_COLD, APP_START_WARM } from '../measurements';
4
5
  import { NATIVE } from '../wrapper';
5
6
  import { NativeFramesInstrumentation } from './nativeframes';
7
+ import { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD, } from './ops';
6
8
  import { StallTrackingInstrumentation } from './stalltracking';
7
9
  import { adjustTransactionDuration, getTimeOriginMilliseconds, isNearToNow, } from './utils';
8
10
  const defaultReactNativeTracingOptions = Object.assign(Object.assign({}, defaultRequestInstrumentationOptions), { idleTimeout: 1000, maxTransactionDuration: 600, idleTimeoutMs: 1000, finalTimeoutMs: 600000, ignoreEmptyBackNavigationTransactions: true, beforeNavigate: (context) => context, enableAppStartTracking: true, enableNativeFramesTracking: true, enableStallTracking: true });
@@ -116,7 +118,7 @@ export class ReactNativeTracing {
116
118
  const appStartTimeSeconds = appStart.appStartTime / 1000;
117
119
  const idleTransaction = this._createRouteTransaction({
118
120
  name: 'App Start',
119
- op: 'ui.load',
121
+ op: UI_LOAD,
120
122
  startTimestamp: appStartTimeSeconds,
121
123
  });
122
124
  if (idleTransaction) {
@@ -134,10 +136,10 @@ export class ReactNativeTracing {
134
136
  return;
135
137
  }
136
138
  const appStartTimeSeconds = appStart.appStartTime / 1000;
137
- const appStartMode = appStart.isColdStart ? 'app.start.cold' : 'app.start.warm';
139
+ const op = appStart.isColdStart ? APP_START_COLD_OP : APP_START_WARM_OP;
138
140
  transaction.startChild({
139
141
  description: appStart.isColdStart ? 'Cold App Start' : 'Warm App Start',
140
- op: appStartMode,
142
+ op,
141
143
  startTimestamp: appStartTimeSeconds,
142
144
  endTimestamp: this._appStartFinishTimestamp,
143
145
  });
@@ -148,7 +150,8 @@ export class ReactNativeTracing {
148
150
  if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {
149
151
  return;
150
152
  }
151
- transaction.setMeasurement(appStartMode, appStartDurationMilliseconds, 'millisecond');
153
+ const measurement = appStart.isColdStart ? APP_START_COLD : APP_START_WARM;
154
+ transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');
152
155
  }
153
156
  /** To be called when the route changes, but BEFORE the components of the new route mount. */
154
157
  _onRouteWillChange(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAOA,OAAO,EACL,oCAAoC,EACpC,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,GACZ,MAAM,SAAS,CAAC;AA4EjB,MAAM,gCAAgC,mCACjC,oCAAoC,KACvC,WAAW,EAAE,IAAI,EACjB,sBAAsB,EAAE,GAAG,EAC3B,aAAa,EAAE,IAAI,EACnB,cAAc,EAAE,MAAM,EACtB,qCAAqC,EAAE,IAAI,EAC3C,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EACpC,sBAAsB,EAAE,IAAI,EAC5B,0BAA0B,EAAE,IAAI,EAChC,mBAAmB,EAAE,IAAI,GAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,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AC;QAEF,IAAI,IAAI,CAAC,OAAO,CAAC,qCAAqC,EAAE;YACtD,eAAe,CAAC,4BAA4B,CAAC,CAAC,WAAW,EAAE,EAAE;;gBAC3D;gBACE,sEAAsE;gBACtE,aAAA,WAAW,CAAC,IAAI,0CAAE,KAAK,0CAAE,WAAW;oBACpC,CAAC,CAAC,WAAW,CAAC,YAAY;wBACxB,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CACnC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAC7C,CAAC,MAAM,KAAK,CAAC,CAAC,EACjB;oBACA,MAAM,CAAC,GAAG,CACR,0JAA0J,CAC3J,CAAC;oBACF,qDAAqD;oBACrD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC7B;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;;AAxUD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Hub } from '@sentry/core';\nimport type {\n IdleTransaction,\n RequestInstrumentationOptions,\n Transaction\n} from '@sentry/tracing';\nimport {\n defaultRequestInstrumentationOptions,\n instrumentOutgoingRequests,\n startIdleTransaction\n} from '@sentry/tracing';\nimport type {\n EventProcessor,\n Integration,\n Transaction as TransactionType,\n TransactionContext,\n} from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport {\n adjustTransactionDuration,\n getTimeOriginMilliseconds,\n isNearToNow,\n} from './utils';\n\nexport interface ReactNativeTracingOptions\n extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * Default: true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n}\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: (context) => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs: options.finalTimeoutMs\n // eslint-disable-next-line deprecation/deprecation\n ?? (typeof options.maxTransactionDuration === 'number'\n // eslint-disable-next-line deprecation/deprecation\n ? options.maxTransactionDuration * 1000\n : undefined)\n ?? defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs: options.idleTimeoutMs\n // eslint-disable-next-line deprecation/deprecation\n ?? options.idleTimeout\n ?? defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public setupOnce(\n // @ts-ignore TODO\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub\n ): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n // @ts-ignore TODO\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableNativeFramesTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n if (enableAppStartTracking) {\n void this._instrumentAppStart();\n }\n\n if (enableNativeFramesTracking) {\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(\n addGlobalEventProcessor,\n () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n }\n );\n } else {\n NATIVE.disableNativeFramesTracking();\n }\n\n if (enableStallTracking) {\n this.stallTrackingInstrumentation = new StallTrackingInstrumentation();\n }\n\n if (routingInstrumentation) {\n routingInstrumentation.registerRoutingInstrumentation(\n this._onRouteWillChange.bind(this),\n this.options.beforeNavigate,\n this._onConfirmRoute.bind(this)\n );\n } else {\n logger.log(\n '[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.'\n );\n }\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n tracingOrigins,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(\n transaction: Transaction,\n endTimestamp?: number\n ): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(\n transaction,\n endTimestamp\n );\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Instruments the app start measurements on the first route transaction.\n * Starts a route transaction if there isn't routing instrumentation.\n */\n private async _instrumentAppStart(): Promise<void> {\n if (!this.options.enableAppStartTracking || !NATIVE.enableNative) {\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n\n if (!appStart || appStart.didFetchAppStart) {\n return;\n }\n\n if (!this.useAppStartWithProfiler) {\n this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;\n }\n\n if (this.options.routingInstrumentation) {\n this._awaitingAppStartData = appStart;\n } else {\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n const idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: 'ui.load',\n startTimestamp: appStartTimeSeconds,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(\n transaction: IdleTransaction,\n appStart: NativeAppStartResponse\n ): void {\n if (!this._appStartFinishTimestamp) {\n logger.warn('App start was never finished.');\n return;\n }\n\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n const appStartMode = appStart.isColdStart ? 'app.start.cold' : 'app.start.warm';\n transaction.startChild({\n description: appStart.isColdStart ? 'Cold App Start' : 'Warm App Start',\n op: appStartMode,\n startTimestamp: appStartTimeSeconds,\n endTimestamp: this._appStartFinishTimestamp,\n });\n\n const appStartDurationMilliseconds =\n this._appStartFinishTimestamp * 1000 - appStart.appStartTime;\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n return;\n }\n\n transaction.setMeasurement(appStartMode, appStartDurationMilliseconds, 'millisecond');\n }\n\n /** To be called when the route changes, but BEFORE the components of the new route mount. */\n private _onRouteWillChange(\n context: TransactionContext\n ): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n this._getCurrentHub?.().configureScope((scope) => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(\n context: TransactionContext\n ): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`\n );\n return undefined;\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const hub = this._getCurrentHub();\n const idleTransaction = startIdleTransaction(\n hub as Hub,\n expandedContext,\n idleTimeoutMs,\n finalTimeoutMs,\n true\n );\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(\n `[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`\n );\n\n idleTransaction.registerBeforeFinishCallback(\n (transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n }\n );\n\n idleTransaction.registerBeforeFinishCallback((transaction) => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.startTimestamp =\n this._awaitingAppStartData.appStartTime / 1000;\n transaction.op = 'ui.load';\n\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback(\n (transaction, endTimestamp) => {\n adjustTransactionDuration(\n finalTimeoutMs,\n transaction,\n endTimestamp\n );\n }\n );\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback((transaction) => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(\n (span) => span.spanId !== transaction.spanId\n ).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.'\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n}\n"]}
1
+ {"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAOA,OAAO,EACL,oCAAoC,EACpC,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACL,cAAc,IAAI,iBAAiB,EACnC,cAAc,IAAI,iBAAiB,EACnC,OAAO,GACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,GACZ,MAAM,SAAS,CAAC;AA4EjB,MAAM,gCAAgC,mCACjC,oCAAoC,KACvC,WAAW,EAAE,IAAI,EACjB,sBAAsB,EAAE,GAAG,EAC3B,aAAa,EAAE,IAAI,EACnB,cAAc,EAAE,MAAM,EACtB,qCAAqC,EAAE,IAAI,EAC3C,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EACpC,sBAAsB,EAAE,IAAI,EAC5B,0BAA0B,EAAE,IAAI,EAChC,mBAAmB,EAAE,IAAI,GAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAuB7B,YAAmB,UAA8C,EAAE;;QAhBnE;;WAEG;QACI,SAAI,GAAW,kBAAkB,CAAC,EAAE,CAAC;QAOrC,4BAAuB,GAAY,KAAK,CAAC;QAO9C,IAAI,CAAC,OAAO,iDACP,gCAAgC,GAChC,OAAO,KACV,cAAc,cAAE,OAAO,CAAC,cAAc,mCAEjC,CAAC,OAAO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C,IAAI,0CAAE,KAAK,0CAAE,WAAW;oBACpC,CAAC,CAAC,WAAW,CAAC,YAAY;wBACxB,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CACnC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAC7C,CAAC,MAAM,KAAK,CAAC,CAAC,EACjB;oBACA,MAAM,CAAC,GAAG,CACR,0JAA0J,CAC3J,CAAC;oBACF,qDAAqD;oBACrD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC7B;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;;AAzUD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Hub } from '@sentry/core';\nimport type {\n IdleTransaction,\n RequestInstrumentationOptions,\n Transaction\n} from '@sentry/tracing';\nimport {\n defaultRequestInstrumentationOptions,\n instrumentOutgoingRequests,\n startIdleTransaction\n} from '@sentry/tracing';\nimport type {\n EventProcessor,\n Integration,\n Transaction as TransactionType,\n TransactionContext,\n} from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { APP_START_COLD, APP_START_WARM } from '../measurements';\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD,\n} from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport {\n adjustTransactionDuration,\n getTimeOriginMilliseconds,\n isNearToNow,\n} from './utils';\n\nexport interface ReactNativeTracingOptions\n extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * Default: true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n}\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: (context) => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs: options.finalTimeoutMs\n // eslint-disable-next-line deprecation/deprecation\n ?? (typeof options.maxTransactionDuration === 'number'\n // eslint-disable-next-line deprecation/deprecation\n ? options.maxTransactionDuration * 1000\n : undefined)\n ?? defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs: options.idleTimeoutMs\n // eslint-disable-next-line deprecation/deprecation\n ?? options.idleTimeout\n ?? defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public setupOnce(\n // @ts-ignore TODO\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub\n ): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n // @ts-ignore TODO\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableNativeFramesTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n if (enableAppStartTracking) {\n void this._instrumentAppStart();\n }\n\n if (enableNativeFramesTracking) {\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(\n addGlobalEventProcessor,\n () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n }\n );\n } else {\n NATIVE.disableNativeFramesTracking();\n }\n\n if (enableStallTracking) {\n this.stallTrackingInstrumentation = new StallTrackingInstrumentation();\n }\n\n if (routingInstrumentation) {\n routingInstrumentation.registerRoutingInstrumentation(\n this._onRouteWillChange.bind(this),\n this.options.beforeNavigate,\n this._onConfirmRoute.bind(this)\n );\n } else {\n logger.log(\n '[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.'\n );\n }\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n tracingOrigins,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(\n transaction: Transaction,\n endTimestamp?: number\n ): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(\n transaction,\n endTimestamp\n );\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Instruments the app start measurements on the first route transaction.\n * Starts a route transaction if there isn't routing instrumentation.\n */\n private async _instrumentAppStart(): Promise<void> {\n if (!this.options.enableAppStartTracking || !NATIVE.enableNative) {\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n\n if (!appStart || appStart.didFetchAppStart) {\n return;\n }\n\n if (!this.useAppStartWithProfiler) {\n this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;\n }\n\n if (this.options.routingInstrumentation) {\n this._awaitingAppStartData = appStart;\n } else {\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n const idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n startTimestamp: appStartTimeSeconds,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(\n transaction: IdleTransaction,\n appStart: NativeAppStartResponse\n ): void {\n if (!this._appStartFinishTimestamp) {\n logger.warn('App start was never finished.');\n return;\n }\n\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n const op = appStart.isColdStart ? APP_START_COLD_OP : APP_START_WARM_OP;\n transaction.startChild({\n description: appStart.isColdStart ? 'Cold App Start' : 'Warm App Start',\n op,\n startTimestamp: appStartTimeSeconds,\n endTimestamp: this._appStartFinishTimestamp,\n });\n\n const appStartDurationMilliseconds =\n this._appStartFinishTimestamp * 1000 - appStart.appStartTime;\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n return;\n }\n\n const measurement = appStart.isColdStart ? APP_START_COLD : APP_START_WARM;\n transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');\n }\n\n /** To be called when the route changes, but BEFORE the components of the new route mount. */\n private _onRouteWillChange(\n context: TransactionContext\n ): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n this._getCurrentHub?.().configureScope((scope) => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(\n context: TransactionContext\n ): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`\n );\n return undefined;\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const hub = this._getCurrentHub();\n const idleTransaction = startIdleTransaction(\n hub as Hub,\n expandedContext,\n idleTimeoutMs,\n finalTimeoutMs,\n true\n );\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(\n `[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`\n );\n\n idleTransaction.registerBeforeFinishCallback(\n (transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n }\n );\n\n idleTransaction.registerBeforeFinishCallback((transaction) => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.startTimestamp =\n this._awaitingAppStartData.appStartTime / 1000;\n transaction.op = 'ui.load';\n\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback(\n (transaction, endTimestamp) => {\n adjustTransactionDuration(\n finalTimeoutMs,\n transaction,\n endTimestamp\n );\n }\n );\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback((transaction) => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(\n (span) => span.spanId !== transaction.spanId\n ).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.'\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n}\n"]}
@@ -1,15 +1,16 @@
1
1
  import type { IdleTransaction, Transaction } from '@sentry/tracing';
2
2
  import type { Measurements, MeasurementUnit } from '@sentry/types';
3
+ import { STALL_COUNT, STALL_LONGEST_TIME, STALL_TOTAL_TIME } from '../measurements';
3
4
  export interface StallMeasurements extends Measurements {
4
- 'stall_count': {
5
+ [STALL_COUNT]: {
5
6
  value: number;
6
7
  unit: MeasurementUnit;
7
8
  };
8
- 'stall_total_time': {
9
+ [STALL_TOTAL_TIME]: {
9
10
  value: number;
10
11
  unit: MeasurementUnit;
11
12
  };
12
- 'stall_longest_time': {
13
+ [STALL_LONGEST_TIME]: {
13
14
  value: number;
14
15
  unit: MeasurementUnit;
15
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"stalltracking.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/stalltracking.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAQ,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGnE,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACxD,kBAAkB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IAC7D,oBAAoB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CAChE;AAED,oBAAY,oBAAoB,GAAG;IACjC;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AASF;;;;;;GAMG;AACH,qBAAa,4BAA4B;IAChC,UAAU,EAAE,OAAO,CAAS;IAEnC,OAAO,CAAC,sBAAsB,CAAS;IAEvC,2FAA2F;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TAL_TIME } from '../measurements';
2
3
  /** Margin of error of 20ms */
3
4
  const MARGIN_OF_ERROR_SECONDS = 0.02;
4
5
  /** How long between each iteration in the event loop tracker timeout */
@@ -136,11 +137,11 @@ export class StallTrackingInstrumentation {
136
137
  }
137
138
  return;
138
139
  }
139
- transaction.setMeasurement('stall_count', statsOnFinish.stall_count.value -
140
+ transaction.setMeasurement(STALL_COUNT, statsOnFinish.stall_count.value -
140
141
  transactionStats.atStart.stall_count.value, transactionStats.atStart.stall_count.unit);
141
- transaction.setMeasurement('stall_total_time', statsOnFinish.stall_total_time.value -
142
+ transaction.setMeasurement(STALL_TOTAL_TIME, statsOnFinish.stall_total_time.value -
142
143
  transactionStats.atStart.stall_total_time.value, transactionStats.atStart.stall_total_time.unit);
143
- transaction.setMeasurement('stall_longest_time', statsOnFinish.stall_longest_time.value, statsOnFinish.stall_longest_time.unit);
144
+ transaction.setMeasurement(STALL_LONGEST_TIME, statsOnFinish.stall_longest_time.value, statsOnFinish.stall_longest_time.unit);
144
145
  }
145
146
  /**
146
147
  * Logs the finish time of the span for use in `trimEnd: true` transactions.
@@ -1 +1 @@
1
- {"version":3,"file":"stalltracking.js","sourceRoot":"","sources":["../../../src/js/tracing/stalltracking.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAgB3D,8BAA8B;AAC9B,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,wEAAwE;AACxE,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,qIAAqI;AACrI,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,OAAO,4BAA4B;IA0BvC,YACE,UAAgC,EAAE,qBAAqB,EAAE,EAAE,EAAE;QA1BxD,eAAU,GAAY,KAAK,CAAC;QAInC,2FAA2F;QACnF,oBAAe,GAAW,CAAC,CAAC;QACpC,+EAA+E;QACvE,gBAAW,GAAW,CAAC,CAAC;QAEhC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ry/tracing';\nimport type { Measurements, MeasurementUnit } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nexport interface StallMeasurements extends Measurements {\n 'stall_count': { value: number, unit: MeasurementUnit };\n 'stall_total_time': { value: number, unit: MeasurementUnit };\n 'stall_longest_time': { value: number, unit: MeasurementUnit };\n}\n\nexport type StallTrackingOptions = {\n /**\n * How long in milliseconds an event loop iteration can be delayed for before being considered a \"stall.\"\n * @default 100\n */\n minimumStallThreshold: number;\n};\n\n/** Margin of error of 20ms */\nconst MARGIN_OF_ERROR_SECONDS = 0.02;\n/** How long between each iteration in the event loop tracker timeout */\nconst LOOP_TIMEOUT_INTERVAL_MS = 50;\n/** Limit for how many transactions the stall tracker will track at a time to prevent leaks due to transactions not being finished */\nconst MAX_RUNNING_TRANSACTIONS = 10;\n\n/**\n * Stall measurement tracker inspired by the `JSEventLoopWatchdog` used internally in React Native:\n * https://github.com/facebook/react-native/blob/006f5afe120c290a37cf6ff896748fbc062bf7ed/Libraries/Interaction/JSEventLoopWatchdog.js\n *\n * However, we modified the interval implementation to instead have a fixed loop timeout interval of `LOOP_TIMEOUT_INTERVAL_MS`.\n * 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`\n */\nexport class StallTrackingInstrumentation {\n public isTracking: boolean = false;\n\n private _minimumStallThreshold: number;\n\n /** Total amount of time of all stalls that occurred during the current tracking session */\n private _totalStallTime: number = 0;\n /** Total number of stalls that occurred during the current tracking session */\n private _stallCount: number = 0;\n\n /** The last timestamp the iteration ran in milliseconds */\n private _lastIntervalMs: number = 0;\n private _timeout: ReturnType<typeof setTimeout> | null = null;\n\n private _statsByTransaction: Map<\n Transaction,\n {\n longestStallTime: number;\n atStart: StallMeasurements;\n atTimestamp: {\n timestamp: number;\n stats: StallMeasurements;\n } | null;\n }\n > = new Map();\n\n public constructor(\n options: StallTrackingOptions = { minimumStallThreshold: 50 }\n ) {\n this._minimumStallThreshold = options.minimumStallThreshold;\n }\n\n /**\n * @inheritDoc\n * Not used for this integration. Instead call `registerTransactionStart` to start tracking.\n */\n public setupOnce(): void {\n // Do nothing.\n }\n\n /**\n * Register a transaction as started. Starts stall tracking if not already running.\n * @returns A finish method that returns the stall measurements.\n */\n public onTransactionStart(transaction: Transaction): void {\n if (this._statsByTransaction.has(transaction)) {\n logger.error(\n '[StallTracking] Tried to start stall tracking on a transaction already being tracked. Measurements might be lost.'\n );\n\n return;\n }\n\n this._startTracking();\n this._statsByTransaction.set(transaction, {\n longestStallTime: 0,\n atTimestamp: null,\n atStart: this._getCurrentStats(transaction),\n });\n this._flushLeakedTransactions();\n\n if (transaction.spanRecorder) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalAdd = transaction.spanRecorder.add;\n\n transaction.spanRecorder.add = (span: Span): void => {\n originalAdd.apply(transaction.spanRecorder, [span]);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanFinish = span.finish;\n\n span.finish = (endTimestamp?: number) => {\n // We let the span determine its own end timestamp as well in case anything gets changed upstream\n originalSpanFinish.apply(span, [endTimestamp]);\n\n // The span should set a timestamp, so this would be defined.\n if (span.endTimestamp) {\n this._markSpanFinish(transaction, span.endTimestamp);\n }\n };\n };\n }\n }\n\n /**\n * Logs a transaction as finished.\n * Stops stall tracking if no more transactions are running.\n * @returns The stall measurements\n */\n public onTransactionFinish(\n transaction: Transaction | IdleTransaction,\n passedEndTimestamp?: number\n ): void {\n const transactionStats = this._statsByTransaction.get(transaction);\n\n if (!transactionStats) {\n // Transaction has been flushed out somehow, we return null.\n logger.log(\n '[StallTracking] Stall measurements were not added to transaction due to exceeding the max count.'\n );\n\n this._statsByTransaction.delete(transaction);\n this._shouldStopTracking();\n\n return;\n }\n\n const endTimestamp = passedEndTimestamp ?? transaction.endTimestamp;\n\n const spans = transaction.spanRecorder\n ? transaction.spanRecorder.spans\n : [];\n const finishedSpanCount = spans.reduce(\n (count, s) => (s !== transaction && s.endTimestamp ? count + 1 : count),\n 0\n );\n\n const trimEnd = transaction.toContext().trimEnd;\n const endWillBeTrimmed = trimEnd && finishedSpanCount > 0;\n\n /*\n This is not safe in the case that something changes upstream, but if we're planning to move this over to @sentry/javascript anyways,\n we can have this temporarily for now.\n */\n const isIdleTransaction = 'activities' in transaction;\n\n let statsOnFinish: StallMeasurements | undefined;\n if (endTimestamp && isIdleTransaction) {\n /*\n There is different behavior regarding child spans in a normal transaction and an idle transaction. In normal transactions,\n the child spans that aren't finished will be dumped, while in an idle transaction they're cancelled and finished.\n\n Note: `endTimestamp` will always be defined if this is called on an idle transaction finish. This is because we only instrument\n idle transactions inside `ReactNativeTracing`, which will pass an `endTimestamp`.\n */\n\n // There will be cancelled spans, which means that the end won't be trimmed\n const spansWillBeCancelled = spans.some(\n (s) =>\n s !== transaction &&\n s.startTimestamp < endTimestamp &&\n !s.endTimestamp\n );\n\n if (endWillBeTrimmed && !spansWillBeCancelled) {\n // the last span's timestamp will be used.\n\n if (transactionStats.atTimestamp) {\n statsOnFinish = transactionStats.atTimestamp.stats;\n }\n } else {\n // this endTimestamp will be used.\n statsOnFinish = this._getCurrentStats(transaction);\n }\n } else if (endWillBeTrimmed) {\n // If `trimEnd` is used, and there is a span to trim to. If there isn't, then the transaction should use `endTimestamp` or generate one.\n if (transactionStats.atTimestamp) {\n statsOnFinish = transactionStats.atTimestamp.stats;\n }\n } else if (!endTimestamp) {\n statsOnFinish = this._getCurrentStats(transaction);\n }\n\n this._statsByTransaction.delete(transaction);\n this._shouldStopTracking();\n\n if (!statsOnFinish) {\n if (typeof endTimestamp !== 'undefined') {\n logger.log(\n '[StallTracking] Stall measurements not added due to `endTimestamp` being set.'\n );\n } else if (trimEnd) {\n logger.log(\n '[StallTracking] Stall measurements not added due to `trimEnd` being set but we could not determine the stall measurements at that time.'\n );\n }\n\n return;\n }\n\n transaction.setMeasurement('stall_count',\n statsOnFinish.stall_count.value -\n transactionStats.atStart.stall_count.value,\n transactionStats.atStart.stall_count.unit);\n\n transaction.setMeasurement('stall_total_time',\n statsOnFinish.stall_total_time.value -\n transactionStats.atStart.stall_total_time.value,\n transactionStats.atStart.stall_total_time.unit);\n\n transaction.setMeasurement('stall_longest_time',\n statsOnFinish.stall_longest_time.value,\n statsOnFinish.stall_longest_time.unit);\n }\n\n /**\n * Logs the finish time of the span for use in `trimEnd: true` transactions.\n */\n private _markSpanFinish(\n transaction: Transaction,\n spanEndTimestamp: number\n ): void {\n const previousStats = this._statsByTransaction.get(transaction);\n if (previousStats) {\n if (\n Math.abs(timestampInSeconds() - spanEndTimestamp) >\n MARGIN_OF_ERROR_SECONDS\n ) {\n logger.log(\n '[StallTracking] Span end not logged due to end timestamp being outside the margin of error from now.'\n );\n\n if (\n previousStats.atTimestamp &&\n previousStats.atTimestamp.timestamp < spanEndTimestamp\n ) {\n // We also need to delete the stat for the last span, as the transaction would be trimmed to this span not the last one.\n this._statsByTransaction.set(transaction, {\n ...previousStats,\n atTimestamp: null,\n });\n }\n } else {\n this._statsByTransaction.set(transaction, {\n ...previousStats,\n atTimestamp: {\n timestamp: spanEndTimestamp,\n stats: this._getCurrentStats(transaction),\n },\n });\n }\n }\n }\n\n /**\n * Get the current stats for a transaction at a given time.\n */\n private _getCurrentStats(transaction: Transaction): StallMeasurements {\n return {\n stall_count: { value: this._stallCount, unit: 'none' },\n stall_total_time: { value: this._totalStallTime, unit: 'millisecond' },\n stall_longest_time: {\n value: this._statsByTransaction.get(transaction)?.longestStallTime ?? 0, unit: 'millisecond'\n },\n };\n }\n\n /**\n * Start tracking stalls\n */\n private _startTracking(): void {\n if (!this.isTracking) {\n this.isTracking = true;\n this._lastIntervalMs = Math.floor(timestampInSeconds() * 1000);\n\n this._iteration();\n }\n }\n\n /**\n * Stops the stall tracking interval and calls reset().\n */\n private _stopTracking(): void {\n this.isTracking = false;\n\n if (this._timeout !== null) {\n clearTimeout(this._timeout);\n this._timeout = null;\n }\n\n this._reset();\n }\n\n /**\n * Will stop tracking if there are no more transactions.\n */\n private _shouldStopTracking(): void {\n if (this._statsByTransaction.size === 0) {\n this._stopTracking();\n }\n }\n\n /**\n * Clears all the collected stats\n */\n private _reset(): void {\n this._stallCount = 0;\n this._totalStallTime = 0;\n this._lastIntervalMs = 0;\n this._statsByTransaction.clear();\n }\n\n /**\n * Iteration of the stall tracking interval. Measures how long the timer strayed from its expected time of running, and how\n * long the stall is for.\n */\n private _iteration(): void {\n const now = timestampInSeconds() * 1000;\n const totalTimeTaken = now - this._lastIntervalMs;\n\n if (\n totalTimeTaken >=\n LOOP_TIMEOUT_INTERVAL_MS + this._minimumStallThreshold\n ) {\n const stallTime = totalTimeTaken - LOOP_TIMEOUT_INTERVAL_MS;\n this._stallCount += 1;\n this._totalStallTime += stallTime;\n\n for (const [transaction, value] of this._statsByTransaction.entries()) {\n const longestStallTime = Math.max(\n value.longestStallTime ?? 0,\n stallTime\n );\n\n this._statsByTransaction.set(transaction, {\n ...value,\n longestStallTime,\n });\n }\n }\n\n this._lastIntervalMs = now;\n\n if (this.isTracking) {\n this._timeout = setTimeout(\n this._iteration.bind(this),\n LOOP_TIMEOUT_INTERVAL_MS\n );\n }\n }\n\n /**\n * Deletes leaked transactions (Earliest transactions when we have more than MAX_RUNNING_TRANSACTIONS transactions.)\n */\n private _flushLeakedTransactions(): void {\n if (this._statsByTransaction.size > MAX_RUNNING_TRANSACTIONS) {\n let counter = 0;\n const len = this._statsByTransaction.size - MAX_RUNNING_TRANSACTIONS;\n const transactions = this._statsByTransaction.keys();\n for (const t of transactions) {\n if (counter >= len) break;\n counter += 1;\n this._statsByTransaction.delete(t);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"stalltracking.js","sourceRoot":"","sources":["../../../src/js/tracing/stalltracking.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAg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I,CAAC,mBAAmB,CAAC,IAAI,GAAG,wBAAwB,CAAC;YACrE,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACrD,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE;gBAC5B,IAAI,OAAO,IAAI,GAAG;oBAAE,MAAM;gBAC1B,OAAO,IAAI,CAAC,CAAC;gBACb,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aACpC;SACF;IACH,CAAC;CACF","sourcesContent":["/* eslint-disable max-lines */\nimport type { IdleTransaction, Span, Transaction } from '@sentry/tracing';\nimport type { Measurements, MeasurementUnit } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport { STALL_COUNT, STALL_LONGEST_TIME, STALL_TOTAL_TIME } from '../measurements';\n\nexport interface StallMeasurements extends Measurements {\n [STALL_COUNT]: { value: number, unit: MeasurementUnit };\n [STALL_TOTAL_TIME]: { value: number, unit: MeasurementUnit };\n [STALL_LONGEST_TIME]: { value: number, unit: MeasurementUnit };\n}\n\nexport type StallTrackingOptions = {\n /**\n * How long in milliseconds an event loop iteration can be delayed for before being considered a \"stall.\"\n * @default 100\n */\n minimumStallThreshold: number;\n};\n\n/** Margin of error of 20ms */\nconst MARGIN_OF_ERROR_SECONDS = 0.02;\n/** How long between each iteration in the event loop tracker timeout */\nconst LOOP_TIMEOUT_INTERVAL_MS = 50;\n/** Limit for how many transactions the stall tracker will track at a time to prevent leaks due to transactions not being finished */\nconst MAX_RUNNING_TRANSACTIONS = 10;\n\n/**\n * Stall measurement tracker inspired by the `JSEventLoopWatchdog` used internally in React Native:\n * https://github.com/facebook/react-native/blob/006f5afe120c290a37cf6ff896748fbc062bf7ed/Libraries/Interaction/JSEventLoopWatchdog.js\n *\n * However, we modified the interval implementation to instead have a fixed loop timeout interval of `LOOP_TIMEOUT_INTERVAL_MS`.\n * 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`\n */\nexport class StallTrackingInstrumentation {\n public isTracking: boolean = false;\n\n private _minimumStallThreshold: number;\n\n /** Total amount of time of all stalls that occurred during the current tracking session */\n private _totalStallTime: number = 0;\n /** Total number of stalls that occurred during the current tracking session */\n private _stallCount: number = 0;\n\n /** The last timestamp the iteration ran in milliseconds */\n private _lastIntervalMs: number = 0;\n private _timeout: ReturnType<typeof setTimeout> | null = null;\n\n private _statsByTransaction: Map<\n Transaction,\n {\n longestStallTime: number;\n atStart: StallMeasurements;\n atTimestamp: {\n timestamp: number;\n stats: StallMeasurements;\n } | null;\n }\n > = new Map();\n\n public constructor(\n options: StallTrackingOptions = { minimumStallThreshold: 50 }\n ) {\n this._minimumStallThreshold = options.minimumStallThreshold;\n }\n\n /**\n * @inheritDoc\n * Not used for this integration. Instead call `registerTransactionStart` to start tracking.\n */\n public setupOnce(): void {\n // Do nothing.\n }\n\n /**\n * Register a transaction as started. Starts stall tracking if not already running.\n * @returns A finish method that returns the stall measurements.\n */\n public onTransactionStart(transaction: Transaction): void {\n if (this._statsByTransaction.has(transaction)) {\n logger.error(\n '[StallTracking] Tried to start stall tracking on a transaction already being tracked. Measurements might be lost.'\n );\n\n return;\n }\n\n this._startTracking();\n this._statsByTransaction.set(transaction, {\n longestStallTime: 0,\n atTimestamp: null,\n atStart: this._getCurrentStats(transaction),\n });\n this._flushLeakedTransactions();\n\n if (transaction.spanRecorder) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalAdd = transaction.spanRecorder.add;\n\n transaction.spanRecorder.add = (span: Span): void => {\n originalAdd.apply(transaction.spanRecorder, [span]);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanFinish = span.finish;\n\n span.finish = (endTimestamp?: number) => {\n // We let the span determine its own end timestamp as well in case anything gets changed upstream\n originalSpanFinish.apply(span, [endTimestamp]);\n\n // The span should set a timestamp, so this would be defined.\n if (span.endTimestamp) {\n this._markSpanFinish(transaction, span.endTimestamp);\n }\n };\n };\n }\n }\n\n /**\n * Logs a transaction as finished.\n * Stops stall tracking if no more transactions are running.\n * @returns The stall measurements\n */\n public onTransactionFinish(\n transaction: Transaction | IdleTransaction,\n passedEndTimestamp?: number\n ): void {\n const transactionStats = this._statsByTransaction.get(transaction);\n\n if (!transactionStats) {\n // Transaction has been flushed out somehow, we return null.\n logger.log(\n '[StallTracking] Stall measurements were not added to transaction due to exceeding the max count.'\n );\n\n this._statsByTransaction.delete(transaction);\n this._shouldStopTracking();\n\n return;\n }\n\n const endTimestamp = passedEndTimestamp ?? transaction.endTimestamp;\n\n const spans = transaction.spanRecorder\n ? transaction.spanRecorder.spans\n : [];\n const finishedSpanCount = spans.reduce(\n (count, s) => (s !== transaction && s.endTimestamp ? count + 1 : count),\n 0\n );\n\n const trimEnd = transaction.toContext().trimEnd;\n const endWillBeTrimmed = trimEnd && finishedSpanCount > 0;\n\n /*\n This is not safe in the case that something changes upstream, but if we're planning to move this over to @sentry/javascript anyways,\n we can have this temporarily for now.\n */\n const isIdleTransaction = 'activities' in transaction;\n\n let statsOnFinish: StallMeasurements | undefined;\n if (endTimestamp && isIdleTransaction) {\n /*\n There is different behavior regarding child spans in a normal transaction and an idle transaction. In normal transactions,\n the child spans that aren't finished will be dumped, while in an idle transaction they're cancelled and finished.\n\n Note: `endTimestamp` will always be defined if this is called on an idle transaction finish. This is because we only instrument\n idle transactions inside `ReactNativeTracing`, which will pass an `endTimestamp`.\n */\n\n // There will be cancelled spans, which means that the end won't be trimmed\n const spansWillBeCancelled = spans.some(\n (s) =>\n s !== transaction &&\n s.startTimestamp < endTimestamp &&\n !s.endTimestamp\n );\n\n if (endWillBeTrimmed && !spansWillBeCancelled) {\n // the last span's timestamp will be used.\n\n if (transactionStats.atTimestamp) {\n statsOnFinish = transactionStats.atTimestamp.stats;\n }\n } else {\n // this endTimestamp will be used.\n statsOnFinish = this._getCurrentStats(transaction);\n }\n } else if (endWillBeTrimmed) {\n // If `trimEnd` is used, and there is a span to trim to. If there isn't, then the transaction should use `endTimestamp` or generate one.\n if (transactionStats.atTimestamp) {\n statsOnFinish = transactionStats.atTimestamp.stats;\n }\n } else if (!endTimestamp) {\n statsOnFinish = this._getCurrentStats(transaction);\n }\n\n this._statsByTransaction.delete(transaction);\n this._shouldStopTracking();\n\n if (!statsOnFinish) {\n if (typeof endTimestamp !== 'undefined') {\n logger.log(\n '[StallTracking] Stall measurements not added due to `endTimestamp` being set.'\n );\n } else if (trimEnd) {\n logger.log(\n '[StallTracking] Stall measurements not added due to `trimEnd` being set but we could not determine the stall measurements at that time.'\n );\n }\n\n return;\n }\n\n transaction.setMeasurement(STALL_COUNT,\n statsOnFinish.stall_count.value -\n transactionStats.atStart.stall_count.value,\n transactionStats.atStart.stall_count.unit);\n\n transaction.setMeasurement(STALL_TOTAL_TIME,\n statsOnFinish.stall_total_time.value -\n transactionStats.atStart.stall_total_time.value,\n transactionStats.atStart.stall_total_time.unit);\n\n transaction.setMeasurement(STALL_LONGEST_TIME,\n statsOnFinish.stall_longest_time.value,\n statsOnFinish.stall_longest_time.unit);\n }\n\n /**\n * Logs the finish time of the span for use in `trimEnd: true` transactions.\n */\n private _markSpanFinish(\n transaction: Transaction,\n spanEndTimestamp: number\n ): void {\n const previousStats = this._statsByTransaction.get(transaction);\n if (previousStats) {\n if (\n Math.abs(timestampInSeconds() - spanEndTimestamp) >\n MARGIN_OF_ERROR_SECONDS\n ) {\n logger.log(\n '[StallTracking] Span end not logged due to end timestamp being outside the margin of error from now.'\n );\n\n if (\n previousStats.atTimestamp &&\n previousStats.atTimestamp.timestamp < spanEndTimestamp\n ) {\n // We also need to delete the stat for the last span, as the transaction would be trimmed to this span not the last one.\n this._statsByTransaction.set(transaction, {\n ...previousStats,\n atTimestamp: null,\n });\n }\n } else {\n this._statsByTransaction.set(transaction, {\n ...previousStats,\n atTimestamp: {\n timestamp: spanEndTimestamp,\n stats: this._getCurrentStats(transaction),\n },\n });\n }\n }\n }\n\n /**\n * Get the current stats for a transaction at a given time.\n */\n private _getCurrentStats(transaction: Transaction): StallMeasurements {\n return {\n stall_count: { value: this._stallCount, unit: 'none' },\n stall_total_time: { value: this._totalStallTime, unit: 'millisecond' },\n stall_longest_time: {\n value: this._statsByTransaction.get(transaction)?.longestStallTime ?? 0, unit: 'millisecond'\n },\n };\n }\n\n /**\n * Start tracking stalls\n */\n private _startTracking(): void {\n if (!this.isTracking) {\n this.isTracking = true;\n this._lastIntervalMs = Math.floor(timestampInSeconds() * 1000);\n\n this._iteration();\n }\n }\n\n /**\n * Stops the stall tracking interval and calls reset().\n */\n private _stopTracking(): void {\n this.isTracking = false;\n\n if (this._timeout !== null) {\n clearTimeout(this._timeout);\n this._timeout = null;\n }\n\n this._reset();\n }\n\n /**\n * Will stop tracking if there are no more transactions.\n */\n private _shouldStopTracking(): void {\n if (this._statsByTransaction.size === 0) {\n this._stopTracking();\n }\n }\n\n /**\n * Clears all the collected stats\n */\n private _reset(): void {\n this._stallCount = 0;\n this._totalStallTime = 0;\n this._lastIntervalMs = 0;\n this._statsByTransaction.clear();\n }\n\n /**\n * Iteration of the stall tracking interval. Measures how long the timer strayed from its expected time of running, and how\n * long the stall is for.\n */\n private _iteration(): void {\n const now = timestampInSeconds() * 1000;\n const totalTimeTaken = now - this._lastIntervalMs;\n\n if (\n totalTimeTaken >=\n LOOP_TIMEOUT_INTERVAL_MS + this._minimumStallThreshold\n ) {\n const stallTime = totalTimeTaken - LOOP_TIMEOUT_INTERVAL_MS;\n this._stallCount += 1;\n this._totalStallTime += stallTime;\n\n for (const [transaction, value] of this._statsByTransaction.entries()) {\n const longestStallTime = Math.max(\n value.longestStallTime ?? 0,\n stallTime\n );\n\n this._statsByTransaction.set(transaction, {\n ...value,\n longestStallTime,\n });\n }\n }\n\n this._lastIntervalMs = now;\n\n if (this.isTracking) {\n this._timeout = setTimeout(\n this._iteration.bind(this),\n LOOP_TIMEOUT_INTERVAL_MS\n );\n }\n }\n\n /**\n * Deletes leaked transactions (Earliest transactions when we have more than MAX_RUNNING_TRANSACTIONS transactions.)\n */\n private _flushLeakedTransactions(): void {\n if (this._statsByTransaction.size > MAX_RUNNING_TRANSACTIONS) {\n let counter = 0;\n const len = this._statsByTransaction.size - MAX_RUNNING_TRANSACTIONS;\n const transactions = this._statsByTransaction.keys();\n for (const t of transactions) {\n if (counter >= len) break;\n counter += 1;\n this._statsByTransaction.delete(t);\n }\n }\n }\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  /**
2
- * This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning
3
- * YellowBox deprecated and replaced with with LogBox in RN 0.63
2
+ * This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.
4
3
  */
5
4
  export declare function ignoreRequireCycleLogs(): void;
6
5
  //# sourceMappingURL=ignorerequirecyclelogs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ignorerequirecyclelogs.d.ts","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C"}
1
+ {"version":3,"file":"ignorerequirecyclelogs.d.ts","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -1,15 +1,8 @@
1
- /* eslint-disable deprecation/deprecation */
2
- import { LogBox, YellowBox } from 'react-native';
1
+ import { LogBox } from 'react-native';
3
2
  /**
4
- * This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning
5
- * YellowBox deprecated and replaced with with LogBox in RN 0.63
3
+ * This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.
6
4
  */
7
5
  export function ignoreRequireCycleLogs() {
8
- if (LogBox) {
9
- LogBox.ignoreLogs(['Require cycle:']);
10
- }
11
- else {
12
- YellowBox.ignoreWarnings(['Require cycle:']);
13
- }
6
+ LogBox.ignoreLogs(['Require cycle:']);
14
7
  }
15
8
  //# sourceMappingURL=ignorerequirecyclelogs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ignorerequirecyclelogs.js","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACvC;SAAM;QACL,SAAS,CAAC,cAAc,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;KAC9C;AACH,CAAC","sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { LogBox, YellowBox } from 'react-native';\n\n/**\n * This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning\n * YellowBox deprecated and replaced with with LogBox in RN 0.63\n */\nexport function ignoreRequireCycleLogs(): void {\n if (LogBox) {\n LogBox.ignoreLogs(['Require cycle:']);\n } else {\n YellowBox.ignoreWarnings(['Require cycle:']);\n }\n}\n"]}
1
+ {"version":3,"file":"ignorerequirecyclelogs.js","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { LogBox } from 'react-native';\n\n/**\n * This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.\n */\nexport function ignoreRequireCycleLogs(): void {\n LogBox.ignoreLogs(['Require cycle:']);\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.0.0-rc.1";
3
+ export declare const SDK_VERSION = "5.1.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAC3D,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,eAAe,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAC3D,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '5.0.0-rc.1';
3
+ export const SDK_VERSION = '5.1.0';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.0.0-rc.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.1.0';\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "5.0.0-rc.1",
5
+ "version": "5.1.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -42,21 +42,21 @@
42
42
  "react-native": ">=0.65.0"
43
43
  },
44
44
  "dependencies": {
45
- "@sentry/browser": "7.36.0",
46
- "@sentry/cli": "2.10.0",
47
- "@sentry/core": "7.36.0",
48
- "@sentry/hub": "7.36.0",
49
- "@sentry/integrations": "7.36.0",
50
- "@sentry/react": "7.36.0",
51
- "@sentry/tracing": "7.36.0",
52
- "@sentry/types": "7.36.0",
53
- "@sentry/utils": "7.36.0"
45
+ "@sentry/browser": "7.40.0",
46
+ "@sentry/cli": "2.14.3",
47
+ "@sentry/core": "7.40.0",
48
+ "@sentry/hub": "7.40.0",
49
+ "@sentry/integrations": "7.40.0",
50
+ "@sentry/react": "7.40.0",
51
+ "@sentry/tracing": "7.40.0",
52
+ "@sentry/types": "7.40.0",
53
+ "@sentry/utils": "7.40.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@sentry-internal/eslint-config-sdk": "7.36.0",
57
- "@sentry-internal/eslint-plugin-sdk": "7.36.0",
56
+ "@sentry-internal/eslint-config-sdk": "7.40.0",
57
+ "@sentry-internal/eslint-plugin-sdk": "7.40.0",
58
58
  "@sentry/typescript": "^5.20.1",
59
- "@sentry/wizard": "2.2.0",
59
+ "@sentry/wizard": "2.6.0",
60
60
  "@types/jest": "^29.2.5",
61
61
  "@types/react": "^18.0.25",
62
62
  "babel-jest": "^29.3.1",