@sentry/react-native 5.12.0 → 5.13.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.
- package/CHANGELOG.md +36 -0
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/dist/js/index.d.ts +1 -1
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +1 -5
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +3 -0
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +6 -0
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +15 -0
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/package.json +12 -12
- package/ts3.8/dist/js/index.d.ts +1 -1
- package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +6 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.13.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Export New JS Performance API ([#3371](https://github.com/getsentry/sentry-react-native/pull/3371))
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
// Start a span that tracks the duration of expensiveFunction
|
|
11
|
+
const result = Sentry.startSpan({ name: 'important function' }, () => {
|
|
12
|
+
return expensiveFunction();
|
|
13
|
+
});
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690
|
|
17
|
+
|
|
18
|
+
- Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339))
|
|
19
|
+
|
|
20
|
+
### Fixes
|
|
21
|
+
|
|
22
|
+
- Remove `platform: node` from Debug Builds Events ([#3377](https://github.com/getsentry/sentry-react-native/pull/3377))
|
|
23
|
+
|
|
24
|
+
### Dependencies
|
|
25
|
+
|
|
26
|
+
- Bump Android SDK from v6.32.0 to v6.33.1 ([#3374](https://github.com/getsentry/sentry-react-native/pull/3374))
|
|
27
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6331)
|
|
28
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.32.0...6.33.1)
|
|
29
|
+
- Bump Cocoa SDK from v8.14.2 to v8.15.2 ([#3376](https://github.com/getsentry/sentry-react-native/pull/3376))
|
|
30
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8152)
|
|
31
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.14.2...8.15.2)
|
|
32
|
+
- Bump CLI from v2.21.2 to v2.21.3 ([#3381](https://github.com/getsentry/sentry-react-native/pull/3381))
|
|
33
|
+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2213)
|
|
34
|
+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.21.2...2.21.3)
|
|
35
|
+
- Bump JavaScript SDK from v7.76.0 to v7.80.0 ([#3372](https://github.com/getsentry/sentry-react-native/pull/3372))
|
|
36
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7800)
|
|
37
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.76.0...7.80.0)
|
|
38
|
+
|
|
3
39
|
## 5.12.0
|
|
4
40
|
|
|
5
41
|
### Features
|
package/RNSentry.podspec
CHANGED
package/android/build.gradle
CHANGED
package/dist/js/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
2
|
+
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, } from '@sentry/core';
|
|
3
3
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
4
4
|
export { lastEventId } from '@sentry/browser';
|
|
5
5
|
import * as Integrations from './integrations';
|
package/dist/js/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,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, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
1
|
+
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, } from '@sentry/core';
|
|
2
2
|
import { _addTracingExtensions } from './measurements';
|
|
3
3
|
_addTracingExtensions();
|
|
4
4
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,qBAAqB,EAAE,CAAC;AAExB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI;AACJ,mDAAmD;AACnD,OAAO;AACP,mDAAmD;AACnD,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC;AAChC,mDAAmD;AACnD,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EAEtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export {\n Breadcrumb,\n Request,\n SdkInfo,\n Event,\n Exception,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n} from '@sentry/types';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startTransaction,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n} from '@sentry/core';\n\nimport { _addTracingExtensions } from './measurements';\n_addTracingExtensions();\n\nexport {\n Integrations as BrowserIntegrations,\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport { lastEventId } from '@sentry/browser';\n\nimport * as Integrations from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\nexport { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport {\n init,\n wrap,\n // eslint-disable-next-line deprecation/deprecation\n setDist,\n // eslint-disable-next-line deprecation/deprecation\n setRelease,\n nativeCrash,\n flush,\n close,\n captureUserFeedback,\n withScope,\n configureScope,\n} from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n ReactNativeTracing,\n ReactNavigationV4Instrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n ReactNavigationInstrumentation,\n ReactNativeNavigationInstrumentation,\n RoutingInstrumentation,\n ReactNavigationTransactionContext,\n sentryTraceGesture,\n} from './tracing';\n\nexport { Integrations, SDK_NAME, SDK_VERSION };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,WAAW,EAAc,MAAM,eAAe,CAAC;AAoB/E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,qBAAa,iBAAkB,YAAW,WAAW;IACnD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAuB;IAC/C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACI,SAAS,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,WAAW,EAAc,MAAM,eAAe,CAAC;AAoB/E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,qBAAa,iBAAkB,YAAW,WAAW;IACnD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAuB;IAC/C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACI,SAAS,IAAI,IAAI;IA2BxB;;;OAGG;YACW,YAAY;IAiC1B;;;OAGG;YACW,uCAAuC;IA4CrD;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;;OAKG;YACW,iBAAiB;CA0BhC"}
|
|
@@ -31,7 +31,6 @@ export class DebugSymbolicator {
|
|
|
31
31
|
stack = parseErrorStack(reactError.stack);
|
|
32
32
|
}
|
|
33
33
|
yield self._symbolicate(event, stack);
|
|
34
|
-
event.platform = 'node'; // Setting platform node makes sure we do not show source maps errors
|
|
35
34
|
return event;
|
|
36
35
|
}));
|
|
37
36
|
}
|
|
@@ -84,8 +83,6 @@ export class DebugSymbolicator {
|
|
|
84
83
|
catch (_oO) {
|
|
85
84
|
// We can't load devserver URL
|
|
86
85
|
}
|
|
87
|
-
// Below you will find lines marked with :HACK to prevent showing errors in the sentry ui
|
|
88
|
-
// But since this is a debug only feature: This is Fine (TM)
|
|
89
86
|
return Promise.all(frames.map((frame) => __awaiter(this, void 0, void 0, function* () {
|
|
90
87
|
let inApp = !!frame.column && !!frame.lineNumber;
|
|
91
88
|
inApp =
|
|
@@ -94,12 +91,11 @@ export class DebugSymbolicator {
|
|
|
94
91
|
!frame.file.includes('node_modules') &&
|
|
95
92
|
!frame.file.includes('native code');
|
|
96
93
|
const newFrame = {
|
|
94
|
+
lineno: frame.lineNumber,
|
|
97
95
|
colno: frame.column,
|
|
98
96
|
filename: frame.file,
|
|
99
97
|
function: frame.methodName,
|
|
100
98
|
in_app: inApp,
|
|
101
|
-
lineno: inApp ? frame.lineNumber : undefined,
|
|
102
|
-
platform: inApp ? 'javascript' : 'node', // :HACK
|
|
103
99
|
};
|
|
104
100
|
// The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and
|
|
105
101
|
// leaves a trailing `(address at` in the function name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AA2B/G,6DAA6D;AAC7D,MAAM,OAAO,iBAAiB;IAA9B;QAKE;;WAEG;QACI,SAAI,GAAW,iBAAiB,CAAC,EAAE,CAAC;IA0K7C,CAAC;IAxKC;;OAEG;IACI,SAAS;QACd,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAgB,EAAE,EAAE;YAC/D,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAE/D,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;gBACvE,OAAO,KAAK,CAAC;aACd;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAqC,CAAC;YAE9D,8DAA8D;YAC9D,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YAExF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CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;4BAC/E,MAAM,EAAE,KAAK;yBACd,CAAC,CAAC;wBAEH,IAAI,QAAQ,CAAC,EAAE,EAAE;4BACf,MAAM;yBACP;qBACF;iBACF;aACF;YAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAElC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACjC;;KACF;;AAhLD;;GAEG;AACW,oBAAE,GAAW,mBAAmB,CAAC","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport type { Event, EventHint, Integration, StackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\ninterface GetDevServer {\n (): { url: string };\n}\n\n/**\n * React Native Stack Frame\n */\ninterface ReactNativeFrame {\n // arguments: []\n column: number;\n file: string;\n lineNumber: number;\n methodName: string;\n}\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport class DebugSymbolicator implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DebugSymbolicator';\n /**\n * @inheritDoc\n */\n public name: string = DebugSymbolicator.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self || hint === undefined || hint.originalException === undefined) {\n return event;\n }\n\n const reactError = hint.originalException as ReactNativeError;\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n\n let stack;\n try {\n stack = parseErrorStack(reactError);\n } catch (e) {\n // In RN 0.64 `parseErrorStack` now only takes a string\n stack = parseErrorStack(reactError.stack);\n }\n\n await self._symbolicate(event, stack);\n\n event.platform = 'node'; // Setting platform node makes sure we do not show source maps errors\n\n return event;\n });\n }\n\n /**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\n private async _symbolicate(event: Event, stack: string | undefined): Promise<void> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n const prettyStack = await symbolicateStackTrace(stack);\n\n if (prettyStack) {\n let newStack = prettyStack;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (prettyStack.stack) {\n // This has been changed in an react-native version so stack is contained in here\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n newStack = prettyStack.stack;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const stackWithoutInternalCallsites = newStack.filter(\n (frame: { file?: string }) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n const symbolicatedFrames = await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n this._replaceFramesInEvent(event, symbolicatedFrames);\n } else {\n logger.error('The stack is null');\n }\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNativeFrame[]): Promise<StackFrame[]> {\n let getDevServer: GetDevServer;\n try {\n getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n } catch (_oO) {\n // We can't load devserver URL\n }\n // Below you will find lines marked with :HACK to prevent showing errors in the sentry ui\n // But since this is a debug only feature: This is Fine (TM)\n return Promise.all(\n frames.map(async (frame: ReactNativeFrame): Promise<StackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: StackFrame = {\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n lineno: inApp ? frame.lineNumber : undefined, // :HACK\n platform: inApp ? 'javascript' : 'node', // :HACK\n };\n\n // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and\n // leaves a trailing `(address at` in the function name.\n // `react-native@0.62` seems to have custom logic to parse hermes frames specially.\n // Anyway, all we do here is throw away the bogus suffix.\n if (newFrame.function) {\n const addressAtPos = newFrame.function.indexOf('(address at');\n if (addressAtPos >= 0) {\n newFrame.function = newFrame.function.substring(0, addressAtPos).trim();\n }\n }\n\n if (inApp) {\n await this._addSourceContext(newFrame, getDevServer);\n }\n\n return newFrame;\n }),\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceFramesInEvent(event: Event, frames: StackFrame[]): void {\n if (\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].stacktrace\n ) {\n event.exception.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\n private async _addSourceContext(frame: StackFrame, getDevServer?: GetDevServer): Promise<void> {\n let response;\n\n const segments = frame.filename?.split('/') ?? [];\n\n if (getDevServer) {\n for (const idx in segments) {\n if (Object.prototype.hasOwnProperty.call(segments, idx)) {\n response = await fetch(`${getDevServer().url}${segments.slice(-idx).join('/')}`, {\n method: 'GET',\n });\n\n if (response.ok) {\n break;\n }\n }\n }\n }\n\n if (response && response.ok) {\n const content = await response.text();\n const lines = content.split('\\n');\n\n addContextToFrame(lines, frame);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AA2B/G,6DAA6D;AAC7D,MAAM,OAAO,iBAAiB;IAA9B;QAKE;;WAEG;QACI,SAAI,GAAW,iBAAiB,CAAC,EAAE,CAAC;IAqK7C,CAAC;IAnKC;;OAEG;IACI,SAAS;QACd,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAgB,EAAE,EAAE;YAC/D,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAE/D,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;gBACvE,OAAO,KAAK,CAAC;aACd;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAqC,CAAC;YAE9D,8DAA8D;YAC9D,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YAExF,IAAI,KAAK,CAAC;YACV,IAAI;gBACF,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;aACrC;YAAC,OAAO,CAAC,EAAE;gBACV,uDAAuD;gBACvD,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aAC3C;YAED,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAEtC,OAAO,KAAK,CAAC;QACf,CAA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sentry/core';\nimport type { Event, EventHint, Integration, StackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\ninterface GetDevServer {\n (): { url: string };\n}\n\n/**\n * React Native Stack Frame\n */\ninterface ReactNativeFrame {\n // arguments: []\n column: number;\n file: string;\n lineNumber: number;\n methodName: string;\n}\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport class DebugSymbolicator implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DebugSymbolicator';\n /**\n * @inheritDoc\n */\n public name: string = DebugSymbolicator.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self || hint === undefined || hint.originalException === undefined) {\n return event;\n }\n\n const reactError = hint.originalException as ReactNativeError;\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n\n let stack;\n try {\n stack = parseErrorStack(reactError);\n } catch (e) {\n // In RN 0.64 `parseErrorStack` now only takes a string\n stack = parseErrorStack(reactError.stack);\n }\n\n await self._symbolicate(event, stack);\n\n return event;\n });\n }\n\n /**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\n private async _symbolicate(event: Event, stack: string | undefined): Promise<void> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n const prettyStack = await symbolicateStackTrace(stack);\n\n if (prettyStack) {\n let newStack = prettyStack;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (prettyStack.stack) {\n // This has been changed in an react-native version so stack is contained in here\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n newStack = prettyStack.stack;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const stackWithoutInternalCallsites = newStack.filter(\n (frame: { file?: string }) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n const symbolicatedFrames = await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n this._replaceFramesInEvent(event, symbolicatedFrames);\n } else {\n logger.error('The stack is null');\n }\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNativeFrame[]): Promise<StackFrame[]> {\n let getDevServer: GetDevServer;\n try {\n getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n } catch (_oO) {\n // We can't load devserver URL\n }\n return Promise.all(\n frames.map(async (frame: ReactNativeFrame): Promise<StackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: StackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and\n // leaves a trailing `(address at` in the function name.\n // `react-native@0.62` seems to have custom logic to parse hermes frames specially.\n // Anyway, all we do here is throw away the bogus suffix.\n if (newFrame.function) {\n const addressAtPos = newFrame.function.indexOf('(address at');\n if (addressAtPos >= 0) {\n newFrame.function = newFrame.function.substring(0, addressAtPos).trim();\n }\n }\n\n if (inApp) {\n await this._addSourceContext(newFrame, getDevServer);\n }\n\n return newFrame;\n }),\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceFramesInEvent(event: Event, frames: StackFrame[]): void {\n if (\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].stacktrace\n ) {\n event.exception.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\n private async _addSourceContext(frame: StackFrame, getDevServer?: GetDevServer): Promise<void> {\n let response;\n\n const segments = frame.filename?.split('/') ?? [];\n\n if (getDevServer) {\n for (const idx in segments) {\n if (Object.prototype.hasOwnProperty.call(segments, idx)) {\n response = await fetch(`${getDevServer().url}${segments.slice(-idx).join('/')}`, {\n method: 'GET',\n });\n\n if (response.ok) {\n break;\n }\n }\n }\n }\n\n if (response && response.ok) {\n const content = await response.text();\n const lines = content.split('\\n');\n\n addContextToFrame(lines, frame);\n }\n }\n}\n"]}
|
|
@@ -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;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,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;
|
|
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,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;CA2E9G"}
|
|
@@ -42,6 +42,9 @@ export class DeviceContext {
|
|
|
42
42
|
}
|
|
43
43
|
if (nativeContexts) {
|
|
44
44
|
event.contexts = Object.assign(Object.assign({}, nativeContexts), event.contexts);
|
|
45
|
+
if (nativeContexts.app) {
|
|
46
|
+
event.contexts.app = Object.assign(Object.assign({}, nativeContexts.app), event.contexts.app);
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
const nativeTags = native.tags;
|
|
47
50
|
if (nativeTags) {
|
|
@@ -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;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,uCAAuC;AACvC,MAAM,OAAO,aAAa;IAA1B;QAME;;WAEG;QACI,SAAI,GAAW,aAAa,CAAC,EAAE,CAAC;
|
|
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,OAA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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;;AAvFD;;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(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): 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 nativeContexts = native.contexts;\n if (AppState.currentState !== 'unknown') {\n nativeContexts = nativeContexts || {};\n nativeContexts.app = {\n ...nativeContexts.app,\n in_foreground: AppState.currentState === 'active',\n };\n }\n if (nativeContexts) {\n event.contexts = { ...nativeContexts, ...event.contexts };\n if (nativeContexts.app) {\n event.contexts.app = { ...nativeContexts.app, ...event.contexts.app };\n }\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' ? severityLevelFromString(native['level']) : 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"]}
|
|
@@ -98,6 +98,7 @@ export declare class ReactNativeTracing implements Integration {
|
|
|
98
98
|
private _currentRoute?;
|
|
99
99
|
private _hasSetTracePropagationTargets;
|
|
100
100
|
private _hasSetTracingOrigins;
|
|
101
|
+
private _currentViewName;
|
|
101
102
|
constructor(options?: Partial<ReactNativeTracingOptions>);
|
|
102
103
|
/**
|
|
103
104
|
* Registers routing and request instrumentation.
|
|
@@ -123,6 +124,11 @@ export declare class ReactNativeTracing implements Integration {
|
|
|
123
124
|
elementId: string | undefined;
|
|
124
125
|
op: string;
|
|
125
126
|
}): TransactionType | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Sets the current view name into the app context.
|
|
129
|
+
* @param event Le event.
|
|
130
|
+
*/
|
|
131
|
+
private _getCurrentViewEventProcessor;
|
|
126
132
|
/**
|
|
127
133
|
* Returns the App Start Duration in Milliseconds. Also returns undefined if not able do
|
|
128
134
|
* define the duration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,GAAG,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,GAAG,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAEV,cAAc,EACd,WAAW,EACX,WAAW,IAAI,eAAe,EAE/B,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAExF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAA0B,MAAM,SAAS,CAAC;AAGtE,MAAM,WAAW,yBAA0B,SAAQ,6BAA6B;IAC9E;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IAExD;;;;;OAKG;IACH,qCAAqC,EAAE,OAAO,CAAC;IAE/C;;;;;;;OAOG;IACH,cAAc,EAAE,cAAc,CAAC;IAE/B;;;;;OAKG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAEhC;;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,EAAE;QACxD,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,EAAE,EAAE,MAAM,CAAC;KACZ,GAAG,eAAe,GAAG,SAAS;IAsD/B;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAOrC;;;OAGG;IACH,OAAO,CAAC,gCAAgC;IAOxC;;;OAGG;YACW,mBAAmB;IA6BjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA8BxB,6FAA6F;IAC7F,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB,uCAAuC;IACvC,OAAO,CAAC,uBAAuB;IAgE/B;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAO9B"}
|
|
@@ -95,6 +95,7 @@ export class ReactNativeTracing {
|
|
|
95
95
|
else {
|
|
96
96
|
logger.log('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');
|
|
97
97
|
}
|
|
98
|
+
addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));
|
|
98
99
|
instrumentOutgoingRequests({
|
|
99
100
|
traceFetch,
|
|
100
101
|
traceXHR,
|
|
@@ -177,6 +178,16 @@ export class ReactNativeTracing {
|
|
|
177
178
|
logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);
|
|
178
179
|
return this._inflightInteractionTransaction;
|
|
179
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Sets the current view name into the app context.
|
|
183
|
+
* @param event Le event.
|
|
184
|
+
*/
|
|
185
|
+
_getCurrentViewEventProcessor(event) {
|
|
186
|
+
if (event.contexts && this._currentViewName) {
|
|
187
|
+
event.contexts.app = Object.assign({ view_names: [this._currentViewName] }, event.contexts.app);
|
|
188
|
+
}
|
|
189
|
+
return event;
|
|
190
|
+
}
|
|
180
191
|
/**
|
|
181
192
|
* Returns the App Start Duration in Milliseconds. Also returns undefined if not able do
|
|
182
193
|
* define the duration.
|
|
@@ -270,6 +281,10 @@ export class ReactNativeTracing {
|
|
|
270
281
|
},
|
|
271
282
|
});
|
|
272
283
|
}
|
|
284
|
+
this._currentViewName = context.name;
|
|
285
|
+
/**
|
|
286
|
+
* @deprecated tag routing.route.name will be removed in the future.
|
|
287
|
+
*/
|
|
273
288
|
scope.setTag('routing.route.name', context.name);
|
|
274
289
|
});
|
|
275
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzF,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,EAAE,cAAc,IAAI,iBAAiB,EAAE,cAAc,IAAI,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAgF5F,MAAM,iCAAiC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAErE,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,OAA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C,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,EACjG;oBACA,MAAM,CAAC,GAAG,CACR,0JAA0J,CAC3J,CAAC;oBACF,qDAAqD;oBACrD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC7B;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,OAA2B;;QACvD,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACvD,MAAM,GAAG,GAAG,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,aAAa,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QACnF,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;;AAlaD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { RequestInstrumentationOptions } from '@sentry/browser';\nimport { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry/browser';\nimport type { Hub, IdleTransaction, Transaction } from '@sentry/core';\nimport { getActiveTransaction, getCurrentHub, startIdleTransaction } from '@sentry/core';\nimport type { EventProcessor, Integration, Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { APP_START_COLD, APP_START_WARM } from '../measurements';\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport { cancelInBackground, onlySampleIfChildSpans } from './transaction';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport { adjustTransactionDuration, getTimeOriginMilliseconds, isNearToNow } from './utils';\n\nexport interface ReactNativeTracingOptions extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * Default: true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n */\n enableUserInteractionTracing: boolean;\n}\n\nconst DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\\/(?!\\/)/];\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: context => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _inflightInteractionTransaction?: IdleTransaction;\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n private _currentRoute?: string;\n private _hasSetTracePropagationTargets: boolean;\n private _hasSetTracingOrigins: boolean;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this._hasSetTracePropagationTargets = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracePropagationTargets\n );\n this._hasSetTracingOrigins = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracingOrigins\n );\n\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs:\n options.finalTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n (typeof options.maxTransactionDuration === 'number'\n ? // eslint-disable-next-line deprecation/deprecation\n options.maxTransactionDuration * 1000\n : undefined) ??\n defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs:\n options.idleTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n options.idleTimeout ??\n defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n const hub = getCurrentHub();\n const client = hub.getClient();\n const clientOptions = client && client.getOptions();\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n shouldCreateSpanForRequest,\n // eslint-disable-next-line deprecation/deprecation\n tracePropagationTargets: thisOptionsTracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableNativeFramesTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;\n // There are three ways to configure tracePropagationTargets:\n // 1. via top level client option `tracePropagationTargets`\n // 2. via ReactNativeTracing option `tracePropagationTargets`\n // 3. via ReactNativeTracing option `tracingOrigins` (deprecated)\n //\n // To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to\n // ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).\n //\n // If both 1 and either one of 2 or 3 are set (from above), we log out a warning.\n const tracePropagationTargets =\n clientOptionsTracePropagationTargets ||\n (this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||\n (this._hasSetTracingOrigins && tracingOrigins) ||\n DEFAULT_TRACE_PROPAGATION_TARGETS;\n if (\n __DEV__ &&\n (this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&\n clientOptionsTracePropagationTargets\n ) {\n logger.warn(\n '[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',\n );\n }\n\n if (enableAppStartTracking) {\n void this._instrumentAppStart();\n }\n\n if (enableNativeFramesTracking) {\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n });\n } 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('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');\n }\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(transaction: Transaction, endTimestamp?: number): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Starts a new transaction for a user interaction.\n * @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.\n */\n public startUserInteractionTransaction(userInteractionId: {\n elementId: string | undefined;\n op: string;\n }): TransactionType | undefined {\n const { elementId, op } = userInteractionId;\n if (!this.options.enableUserInteractionTracing) {\n logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');\n return;\n }\n if (!this.options.routingInstrumentation) {\n logger.error(\n '[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.',\n );\n return;\n }\n if (!elementId) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');\n return;\n }\n if (!this._currentRoute) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');\n return;\n }\n\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const activeTransaction = getActiveTransaction(hub);\n const activeTransactionIsNotInteraction =\n activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`,\n );\n return;\n }\n\n if (this._inflightInteractionTransaction) {\n this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });\n this._inflightInteractionTransaction = undefined;\n }\n\n const name = `${this._currentRoute}.${elementId}`;\n const context: TransactionContext = {\n name,\n op,\n trimEnd: true,\n };\n this._inflightInteractionTransaction = this._startIdleTransaction(context);\n this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction: IdleTransaction) => {\n this._inflightInteractionTransaction = undefined;\n this.onTransactionFinish(transaction);\n });\n this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);\n this.onTransactionStart(this._inflightInteractionTransaction);\n logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);\n return this._inflightInteractionTransaction;\n }\n\n /**\n * Returns the App Start Duration in Milliseconds. Also returns undefined if not able do\n * define the duration.\n */\n private _getAppStartDurationMilliseconds(appStart: NativeAppStartResponse): number | undefined {\n if (!this._appStartFinishTimestamp) {\n return undefined;\n }\n return this._appStartFinishTimestamp * 1000 - appStart.appStartTime;\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 idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(transaction: IdleTransaction, appStart: NativeAppStartResponse): void {\n const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStart);\n if (!appStartDurationMilliseconds) {\n logger.warn('App start was never finished.');\n return;\n }\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n return;\n }\n\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n transaction.startTimestamp = appStartTimeSeconds;\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 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(context: TransactionContext): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._currentRoute = context.data?.route?.name;\n\n this._getCurrentHub?.().configureScope(scope => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n if (this._inflightInteractionTransaction) {\n logger.log(\n `[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`,\n );\n this._inflightInteractionTransaction.setStatus('cancelled');\n this._inflightInteractionTransaction.finish();\n }\n\n const { finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const idleTransaction = this._startIdleTransaction(expandedContext);\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(`[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`);\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n });\n\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.op = UI_LOAD;\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);\n });\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(span => span.spanId !== transaction.spanId).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.',\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n\n /**\n * Start app state aware idle transaction on the scope.\n */\n private _startIdleTransaction(context: TransactionContext): IdleTransaction {\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);\n cancelInBackground(tx);\n return tx;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAQzF,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,EAAE,cAAc,IAAI,iBAAiB,EAAE,cAAc,IAAI,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAgF5F,MAAM,iCAAiC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAErE,MAAM,gCAAgC,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AApbD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { RequestInstrumentationOptions } from '@sentry/browser';\nimport { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry/browser';\nimport type { Hub, IdleTransaction, Transaction } from '@sentry/core';\nimport { getActiveTransaction, getCurrentHub, startIdleTransaction } from '@sentry/core';\nimport type {\n Event,\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 { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport { cancelInBackground, onlySampleIfChildSpans } from './transaction';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport { adjustTransactionDuration, getTimeOriginMilliseconds, isNearToNow } from './utils';\n\nexport interface ReactNativeTracingOptions extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * Default: true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n */\n enableUserInteractionTracing: boolean;\n}\n\nconst DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\\/(?!\\/)/];\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: context => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _inflightInteractionTransaction?: IdleTransaction;\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n private _currentRoute?: string;\n private _hasSetTracePropagationTargets: boolean;\n private _hasSetTracingOrigins: boolean;\n private _currentViewName: string | undefined;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this._hasSetTracePropagationTargets = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracePropagationTargets\n );\n this._hasSetTracingOrigins = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracingOrigins\n );\n\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs:\n options.finalTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n (typeof options.maxTransactionDuration === 'number'\n ? // eslint-disable-next-line deprecation/deprecation\n options.maxTransactionDuration * 1000\n : undefined) ??\n defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs:\n options.idleTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n options.idleTimeout ??\n defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n const hub = getCurrentHub();\n const client = hub.getClient();\n const clientOptions = client && client.getOptions();\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n shouldCreateSpanForRequest,\n // eslint-disable-next-line deprecation/deprecation\n tracePropagationTargets: thisOptionsTracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableNativeFramesTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;\n // There are three ways to configure tracePropagationTargets:\n // 1. via top level client option `tracePropagationTargets`\n // 2. via ReactNativeTracing option `tracePropagationTargets`\n // 3. via ReactNativeTracing option `tracingOrigins` (deprecated)\n //\n // To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to\n // ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).\n //\n // If both 1 and either one of 2 or 3 are set (from above), we log out a warning.\n const tracePropagationTargets =\n clientOptionsTracePropagationTargets ||\n (this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||\n (this._hasSetTracingOrigins && tracingOrigins) ||\n DEFAULT_TRACE_PROPAGATION_TARGETS;\n if (\n __DEV__ &&\n (this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&\n clientOptionsTracePropagationTargets\n ) {\n logger.warn(\n '[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',\n );\n }\n\n if (enableAppStartTracking) {\n void this._instrumentAppStart();\n }\n\n if (enableNativeFramesTracking) {\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n });\n } 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('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');\n }\n\n addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(transaction: Transaction, endTimestamp?: number): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Starts a new transaction for a user interaction.\n * @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.\n */\n public startUserInteractionTransaction(userInteractionId: {\n elementId: string | undefined;\n op: string;\n }): TransactionType | undefined {\n const { elementId, op } = userInteractionId;\n if (!this.options.enableUserInteractionTracing) {\n logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');\n return;\n }\n if (!this.options.routingInstrumentation) {\n logger.error(\n '[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.',\n );\n return;\n }\n if (!elementId) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');\n return;\n }\n if (!this._currentRoute) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');\n return;\n }\n\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const activeTransaction = getActiveTransaction(hub);\n const activeTransactionIsNotInteraction =\n activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`,\n );\n return;\n }\n\n if (this._inflightInteractionTransaction) {\n this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });\n this._inflightInteractionTransaction = undefined;\n }\n\n const name = `${this._currentRoute}.${elementId}`;\n const context: TransactionContext = {\n name,\n op,\n trimEnd: true,\n };\n this._inflightInteractionTransaction = this._startIdleTransaction(context);\n this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction: IdleTransaction) => {\n this._inflightInteractionTransaction = undefined;\n this.onTransactionFinish(transaction);\n });\n this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);\n this.onTransactionStart(this._inflightInteractionTransaction);\n logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);\n return this._inflightInteractionTransaction;\n }\n\n /**\n * Sets the current view name into the app context.\n * @param event Le event.\n */\n private _getCurrentViewEventProcessor(event: Event): Event {\n if (event.contexts && this._currentViewName) {\n event.contexts.app = { view_names: [this._currentViewName], ...event.contexts.app };\n }\n return event;\n }\n\n /**\n * Returns the App Start Duration in Milliseconds. Also returns undefined if not able do\n * define the duration.\n */\n private _getAppStartDurationMilliseconds(appStart: NativeAppStartResponse): number | undefined {\n if (!this._appStartFinishTimestamp) {\n return undefined;\n }\n return this._appStartFinishTimestamp * 1000 - appStart.appStartTime;\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 idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(transaction: IdleTransaction, appStart: NativeAppStartResponse): void {\n const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStart);\n if (!appStartDurationMilliseconds) {\n logger.warn('App start was never finished.');\n return;\n }\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n return;\n }\n\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n transaction.startTimestamp = appStartTimeSeconds;\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 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(context: TransactionContext): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._currentRoute = context.data?.route?.name;\n\n this._getCurrentHub?.().configureScope(scope => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n this._currentViewName = context.name;\n /**\n * @deprecated tag routing.route.name will be removed in the future.\n */\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n if (this._inflightInteractionTransaction) {\n logger.log(\n `[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`,\n );\n this._inflightInteractionTransaction.setStatus('cancelled');\n this._inflightInteractionTransaction.finish();\n }\n\n const { finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const idleTransaction = this._startIdleTransaction(expandedContext);\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(`[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`);\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n });\n\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.op = UI_LOAD;\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);\n });\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(span => span.spanId !== transaction.spanId).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.',\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n\n /**\n * Start app state aware idle transaction on the scope.\n */\n private _startIdleTransaction(context: TransactionContext): IdleTransaction {\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);\n cancelInBackground(tx);\n return tx;\n }\n}\n"]}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.13.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.
|
|
5
|
+
"version": "5.13.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",
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"react-native": ">=0.65.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@sentry/browser": "7.
|
|
62
|
-
"@sentry/cli": "2.21.
|
|
63
|
-
"@sentry/core": "7.
|
|
64
|
-
"@sentry/hub": "7.
|
|
65
|
-
"@sentry/integrations": "7.
|
|
66
|
-
"@sentry/react": "7.
|
|
67
|
-
"@sentry/types": "7.
|
|
68
|
-
"@sentry/utils": "7.
|
|
61
|
+
"@sentry/browser": "7.80.0",
|
|
62
|
+
"@sentry/cli": "2.21.3",
|
|
63
|
+
"@sentry/core": "7.80.0",
|
|
64
|
+
"@sentry/hub": "7.80.0",
|
|
65
|
+
"@sentry/integrations": "7.80.0",
|
|
66
|
+
"@sentry/react": "7.80.0",
|
|
67
|
+
"@sentry/types": "7.80.0",
|
|
68
|
+
"@sentry/utils": "7.80.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@sentry-internal/eslint-config-sdk": "7.
|
|
72
|
-
"@sentry-internal/eslint-plugin-sdk": "7.
|
|
71
|
+
"@sentry-internal/eslint-config-sdk": "7.80.0",
|
|
72
|
+
"@sentry-internal/eslint-plugin-sdk": "7.80.0",
|
|
73
73
|
"@sentry/typescript": "^5.20.1",
|
|
74
|
-
"@sentry/wizard": "3.16.
|
|
74
|
+
"@sentry/wizard": "3.16.3",
|
|
75
75
|
"@types/jest": "^29.5.3",
|
|
76
76
|
"@types/react": "^18.2.14",
|
|
77
77
|
"@types/uglify-js": "^3.17.2",
|
package/ts3.8/dist/js/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
2
|
+
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, } from '@sentry/core';
|
|
3
3
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
4
4
|
export { lastEventId } from '@sentry/browser';
|
|
5
5
|
import * as Integrations from './integrations';
|
|
@@ -98,6 +98,7 @@ export declare class ReactNativeTracing implements Integration {
|
|
|
98
98
|
private _currentRoute?;
|
|
99
99
|
private _hasSetTracePropagationTargets;
|
|
100
100
|
private _hasSetTracingOrigins;
|
|
101
|
+
private _currentViewName;
|
|
101
102
|
constructor(options?: Partial<ReactNativeTracingOptions>);
|
|
102
103
|
/**
|
|
103
104
|
* Registers routing and request instrumentation.
|
|
@@ -123,6 +124,11 @@ export declare class ReactNativeTracing implements Integration {
|
|
|
123
124
|
elementId: string | undefined;
|
|
124
125
|
op: string;
|
|
125
126
|
}): TransactionType | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Sets the current view name into the app context.
|
|
129
|
+
* @param event Le event.
|
|
130
|
+
*/
|
|
131
|
+
private _getCurrentViewEventProcessor;
|
|
126
132
|
/**
|
|
127
133
|
* Returns the App Start Duration in Milliseconds. Also returns undefined if not able do
|
|
128
134
|
* define the duration.
|