@sentry/react-native 5.29.0 → 6.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +90 -0
- package/dist/js/client.d.ts +5 -9
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +11 -42
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +5 -10
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +4 -21
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts +2 -8
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +1 -9
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +18 -7
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts +2 -8
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +0 -9
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/eventorigin.d.ts +2 -8
- package/dist/js/integrations/eventorigin.d.ts.map +1 -1
- package/dist/js/integrations/eventorigin.js +0 -8
- package/dist/js/integrations/eventorigin.js.map +1 -1
- package/dist/js/integrations/expocontext.d.ts +2 -8
- package/dist/js/integrations/expocontext.d.ts.map +1 -1
- package/dist/js/integrations/expocontext.js +0 -8
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +4 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +4 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts +2 -8
- package/dist/js/integrations/modulesloader.d.ts.map +1 -1
- package/dist/js/integrations/modulesloader.js +0 -8
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.d.ts +2 -8
- package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +0 -8
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +1 -8
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts +2 -8
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js +0 -8
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/release.d.ts +2 -8
- package/dist/js/integrations/release.d.ts.map +1 -1
- package/dist/js/integrations/release.js +0 -8
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/rewriteframes.js +1 -1
- package/dist/js/integrations/rewriteframes.js.map +1 -1
- package/dist/js/integrations/screenshot.d.ts +2 -8
- package/dist/js/integrations/screenshot.d.ts.map +1 -1
- package/dist/js/integrations/screenshot.js +2 -11
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.d.ts +2 -8
- package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
- package/dist/js/integrations/sdkinfo.js +0 -8
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts +2 -10
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js +1 -10
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.d.ts +2 -8
- package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +0 -8
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/options.d.ts +43 -0
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/profiling/cache.d.ts +1 -1
- package/dist/js/profiling/hermes.d.ts +1 -1
- package/dist/js/profiling/hermes.d.ts.map +1 -1
- package/dist/js/profiling/integration.d.ts +1 -7
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js +39 -25
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/utils.js +2 -1
- package/dist/js/profiling/utils.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +2 -2
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/scopeSync.d.ts +6 -0
- package/dist/js/scopeSync.d.ts.map +1 -0
- package/dist/js/scopeSync.js +60 -0
- package/dist/js/scopeSync.js.map +1 -0
- package/dist/js/sdk.d.ts +1 -20
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +20 -53
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/touchevents.d.ts +0 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +5 -9
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/gesturetracing.d.ts +1 -6
- package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
- package/dist/js/tracing/gesturetracing.js +8 -12
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/index.d.ts +6 -7
- package/dist/js/tracing/index.d.ts.map +1 -1
- package/dist/js/tracing/index.js +4 -7
- package/dist/js/tracing/index.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts +39 -0
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -0
- package/dist/js/tracing/integrations/appStart.js +301 -0
- package/dist/js/tracing/integrations/appStart.js.map +1 -0
- package/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
- package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -0
- package/dist/js/tracing/integrations/nativeFrames.js +256 -0
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -0
- package/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
- package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -0
- package/dist/js/tracing/integrations/stalltracking.js +236 -0
- package/dist/js/tracing/integrations/stalltracking.js.map +1 -0
- package/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
- package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -0
- package/dist/js/tracing/integrations/userInteraction.js +70 -0
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -0
- package/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
- package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -0
- package/dist/js/tracing/onSpanEndUtils.js +112 -0
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -0
- package/dist/js/tracing/origin.d.ts +2 -0
- package/dist/js/tracing/origin.d.ts.map +1 -0
- package/dist/js/tracing/origin.js +2 -0
- package/dist/js/tracing/origin.js.map +1 -0
- package/dist/js/tracing/reactnativenavigation.d.ts +21 -39
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js +98 -87
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +6 -13
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +44 -160
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +51 -481
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +18 -63
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +200 -205
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/semanticAttributes.d.ts +12 -0
- package/dist/js/tracing/semanticAttributes.d.ts.map +1 -0
- package/dist/js/tracing/semanticAttributes.js +12 -0
- package/dist/js/tracing/semanticAttributes.js.map +1 -0
- package/dist/js/tracing/span.d.ts +52 -0
- package/dist/js/tracing/span.d.ts.map +1 -0
- package/dist/js/tracing/span.js +82 -0
- package/dist/js/tracing/span.js.map +1 -0
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +14 -29
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/types.d.ts +2 -9
- package/dist/js/tracing/types.d.ts.map +1 -1
- package/dist/js/tracing/types.js.map +1 -1
- package/dist/js/tracing/utils.d.ts +19 -14
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js +38 -52
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/encodePolyfill.d.ts +3 -0
- package/dist/js/transports/encodePolyfill.d.ts.map +1 -0
- package/dist/js/transports/encodePolyfill.js +13 -0
- package/dist/js/transports/encodePolyfill.js.map +1 -0
- package/dist/js/transports/native.d.ts +2 -2
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js +2 -1
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/utils/fill.d.ts +7 -0
- package/dist/js/utils/fill.d.ts.map +1 -0
- package/dist/js/utils/fill.js +9 -0
- package/dist/js/utils/fill.js.map +1 -0
- package/dist/js/utils/span.d.ts +19 -0
- package/dist/js/utils/span.d.ts.map +1 -0
- package/dist/js/utils/span.js +29 -0
- package/dist/js/utils/span.js.map +1 -0
- package/dist/js/vendor/react-native/index.d.ts +1 -1
- package/dist/js/vendor/react-native/index.d.ts.map +1 -1
- package/dist/js/vendor/react-native/index.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +1 -0
- package/dist/js/wrapper.js.map +1 -1
- package/package.json +10 -12
- package/ts3.8/dist/js/client.d.ts +5 -9
- package/ts3.8/dist/js/index.d.ts +5 -10
- package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +2 -8
- package/ts3.8/dist/js/integrations/devicecontext.d.ts +2 -8
- package/ts3.8/dist/js/integrations/eventorigin.d.ts +2 -8
- package/ts3.8/dist/js/integrations/expocontext.d.ts +2 -8
- package/ts3.8/dist/js/integrations/exports.d.ts +4 -0
- package/ts3.8/dist/js/integrations/modulesloader.d.ts +2 -8
- package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +2 -8
- package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
- package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +2 -8
- package/ts3.8/dist/js/integrations/release.d.ts +2 -8
- package/ts3.8/dist/js/integrations/screenshot.d.ts +2 -8
- package/ts3.8/dist/js/integrations/sdkinfo.d.ts +2 -8
- package/ts3.8/dist/js/integrations/spotlight.d.ts +2 -10
- package/ts3.8/dist/js/integrations/viewhierarchy.d.ts +2 -8
- package/ts3.8/dist/js/options.d.ts +43 -0
- package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
- package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
- package/ts3.8/dist/js/profiling/integration.d.ts +1 -7
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +2 -2
- package/ts3.8/dist/js/scopeSync.d.ts +6 -0
- package/ts3.8/dist/js/sdk.d.ts +1 -20
- package/ts3.8/dist/js/touchevents.d.ts +0 -1
- package/ts3.8/dist/js/tracing/gesturetracing.d.ts +1 -6
- package/ts3.8/dist/js/tracing/index.d.ts +6 -7
- package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +39 -0
- package/ts3.8/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
- package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
- package/ts3.8/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
- package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
- package/ts3.8/dist/js/tracing/origin.d.ts +2 -0
- package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +21 -39
- package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +44 -160
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +18 -63
- package/ts3.8/dist/js/tracing/semanticAttributes.d.ts +12 -0
- package/ts3.8/dist/js/tracing/span.d.ts +52 -0
- package/ts3.8/dist/js/tracing/types.d.ts +2 -9
- package/ts3.8/dist/js/tracing/utils.d.ts +19 -14
- package/ts3.8/dist/js/transports/encodePolyfill.d.ts +3 -0
- package/ts3.8/dist/js/transports/native.d.ts +2 -2
- package/ts3.8/dist/js/utils/fill.d.ts +7 -0
- package/ts3.8/dist/js/utils/span.d.ts +19 -0
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +1 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/dist/js/integrations/index.d.ts +0 -16
- package/dist/js/integrations/index.d.ts.map +0 -1
- package/dist/js/integrations/index.js +0 -17
- package/dist/js/integrations/index.js.map +0 -1
- package/dist/js/scope.d.ts +0 -54
- package/dist/js/scope.d.ts.map +0 -1
- package/dist/js/scope.js +0 -89
- package/dist/js/scope.js.map +0 -1
- package/dist/js/tracing/addTracingExtensions.d.ts +0 -8
- package/dist/js/tracing/addTracingExtensions.d.ts.map +0 -1
- package/dist/js/tracing/addTracingExtensions.js +0 -66
- package/dist/js/tracing/addTracingExtensions.js.map +0 -1
- package/dist/js/tracing/nativeframes.d.ts +0 -60
- package/dist/js/tracing/nativeframes.d.ts.map +0 -1
- package/dist/js/tracing/nativeframes.js +0 -210
- package/dist/js/tracing/nativeframes.js.map +0 -1
- package/dist/js/tracing/reactnavigationv4.d.ts +0 -92
- package/dist/js/tracing/reactnavigationv4.d.ts.map +0 -1
- package/dist/js/tracing/reactnavigationv4.js +0 -229
- package/dist/js/tracing/reactnavigationv4.js.map +0 -1
- package/dist/js/tracing/routingInstrumentation.d.ts +0 -52
- package/dist/js/tracing/routingInstrumentation.d.ts.map +0 -1
- package/dist/js/tracing/routingInstrumentation.js +0 -36
- package/dist/js/tracing/routingInstrumentation.js.map +0 -1
- package/dist/js/tracing/stalltracking.d.ts +0 -99
- package/dist/js/tracing/stalltracking.d.ts.map +0 -1
- package/dist/js/tracing/stalltracking.js +0 -286
- package/dist/js/tracing/stalltracking.js.map +0 -1
- package/dist/js/tracing/transaction.d.ts +0 -11
- package/dist/js/tracing/transaction.d.ts.map +0 -1
- package/dist/js/tracing/transaction.js +0 -37
- package/dist/js/tracing/transaction.js.map +0 -1
- package/dist/js/transports/TextEncoder.d.ts +0 -3
- package/dist/js/transports/TextEncoder.d.ts.map +0 -1
- package/dist/js/transports/TextEncoder.js +0 -12
- package/dist/js/transports/TextEncoder.js.map +0 -1
- package/ts3.8/dist/js/integrations/index.d.ts +0 -16
- package/ts3.8/dist/js/scope.d.ts +0 -54
- package/ts3.8/dist/js/tracing/addTracingExtensions.d.ts +0 -8
- package/ts3.8/dist/js/tracing/nativeframes.d.ts +0 -60
- package/ts3.8/dist/js/tracing/reactnavigationv4.d.ts +0 -92
- package/ts3.8/dist/js/tracing/routingInstrumentation.d.ts +0 -52
- package/ts3.8/dist/js/tracing/stalltracking.d.ts +0 -99
- package/ts3.8/dist/js/tracing/transaction.d.ts +0 -11
- package/ts3.8/dist/js/transports/TextEncoder.d.ts +0 -3
|
@@ -1,490 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { NATIVE } from '../wrapper';
|
|
7
|
-
import { NativeFramesInstrumentation } from './nativeframes';
|
|
8
|
-
import { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';
|
|
9
|
-
import { StallTrackingInstrumentation } from './stalltracking';
|
|
10
|
-
import { cancelInBackground, onlySampleIfChildSpans } from './transaction';
|
|
11
|
-
import { adjustTransactionDuration, getBundleStartTimestampMs, getTimeOriginMilliseconds, isNearToNow, setSpanDurationAsMeasurement, } from './utils';
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
import { instrumentOutgoingRequests } from '@sentry/browser';
|
|
3
|
+
import { getClient } from '@sentry/core';
|
|
4
|
+
import { addDefaultOpForSpanFrom, defaultIdleOptions } from './span';
|
|
5
|
+
export const INTEGRATION_NAME = 'ReactNativeTracing';
|
|
12
6
|
const DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\/(?!\/)/];
|
|
13
|
-
const defaultReactNativeTracingOptions =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
: undefined)) !== null && _b !== void 0 ? _b : defaultReactNativeTracingOptions.finalTimeoutMs, idleTimeoutMs: (_d = (_c = options.idleTimeoutMs) !== null && _c !== void 0 ? _c :
|
|
37
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
38
|
-
options.idleTimeout) !== null && _d !== void 0 ? _d : defaultReactNativeTracingOptions.idleTimeoutMs });
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Registers routing and request instrumentation.
|
|
42
|
-
*/
|
|
43
|
-
setupOnce(addGlobalEventProcessor, getCurrentHub) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const hub = getCurrentHub();
|
|
46
|
-
const client = hub.getClient();
|
|
47
|
-
const clientOptions = client && client.getOptions();
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
49
|
-
const { traceFetch, traceXHR,
|
|
50
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
51
|
-
tracingOrigins, shouldCreateSpanForRequest,
|
|
52
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
53
|
-
tracePropagationTargets: thisOptionsTracePropagationTargets, routingInstrumentation, enableAppStartTracking, enableStallTracking, } = this.options;
|
|
54
|
-
this._getCurrentHub = getCurrentHub;
|
|
55
|
-
const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;
|
|
56
|
-
// There are three ways to configure tracePropagationTargets:
|
|
57
|
-
// 1. via top level client option `tracePropagationTargets`
|
|
58
|
-
// 2. via ReactNativeTracing option `tracePropagationTargets`
|
|
59
|
-
// 3. via ReactNativeTracing option `tracingOrigins` (deprecated)
|
|
60
|
-
//
|
|
61
|
-
// To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to
|
|
62
|
-
// ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).
|
|
63
|
-
//
|
|
64
|
-
// If both 1 and either one of 2 or 3 are set (from above), we log out a warning.
|
|
65
|
-
const tracePropagationTargets = clientOptionsTracePropagationTargets ||
|
|
66
|
-
(this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||
|
|
67
|
-
(this._hasSetTracingOrigins && tracingOrigins) ||
|
|
68
|
-
DEFAULT_TRACE_PROPAGATION_TARGETS;
|
|
69
|
-
if (__DEV__ &&
|
|
70
|
-
(this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&
|
|
71
|
-
clientOptionsTracePropagationTargets) {
|
|
72
|
-
logger.warn('[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.');
|
|
73
|
-
}
|
|
74
|
-
if (enableAppStartTracking) {
|
|
75
|
-
this._instrumentAppStart().then(undefined, (reason) => {
|
|
76
|
-
logger.error(`[ReactNativeTracing] Error while instrumenting app start:`, reason);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
this._enableNativeFramesTracking(addGlobalEventProcessor);
|
|
80
|
-
if (enableStallTracking) {
|
|
81
|
-
this.stallTrackingInstrumentation = new StallTrackingInstrumentation();
|
|
82
|
-
}
|
|
83
|
-
if (routingInstrumentation) {
|
|
84
|
-
routingInstrumentation.registerRoutingInstrumentation(this._onRouteWillChange.bind(this), this.options.beforeNavigate, this._onConfirmRoute.bind(this));
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
logger.log('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');
|
|
88
|
-
}
|
|
89
|
-
addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));
|
|
90
|
-
instrumentOutgoingRequests({
|
|
91
|
-
traceFetch,
|
|
92
|
-
traceXHR,
|
|
93
|
-
shouldCreateSpanForRequest,
|
|
94
|
-
tracePropagationTargets,
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* To be called on a transaction start. Can have async methods
|
|
100
|
-
*/
|
|
101
|
-
onTransactionStart(transaction) {
|
|
102
|
-
var _a, _b;
|
|
103
|
-
if (isNearToNow(transaction.startTimestamp)) {
|
|
104
|
-
// Only if this method is called at or within margin of error to the start timestamp.
|
|
105
|
-
(_a = this.nativeFramesInstrumentation) === null || _a === void 0 ? void 0 : _a.onTransactionStart(transaction);
|
|
106
|
-
(_b = this.stallTrackingInstrumentation) === null || _b === void 0 ? void 0 : _b.onTransactionStart(transaction);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
logger.warn(`[ReactNativeTracing] onTransactionStart called with delay (larger than margin of error) for transaction ${transaction.description} (${transaction.spanContext().spanId}). Not fetching native frames or tracking stalls.`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* To be called on a transaction finish. Cannot have async methods.
|
|
114
|
-
*/
|
|
115
|
-
onTransactionFinish(transaction, endTimestamp) {
|
|
116
|
-
var _a, _b;
|
|
117
|
-
(_a = this.nativeFramesInstrumentation) === null || _a === void 0 ? void 0 : _a.onTransactionFinish(transaction);
|
|
118
|
-
(_b = this.stallTrackingInstrumentation) === null || _b === void 0 ? void 0 : _b.onTransactionFinish(transaction, endTimestamp);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Called by the ReactNativeProfiler component on first component mount.
|
|
122
|
-
*/
|
|
123
|
-
onAppStartFinish(endTimestamp) {
|
|
124
|
-
this._appStartFinishTimestamp = endTimestamp;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Sets the root component first constructor call timestamp.
|
|
128
|
-
*/
|
|
129
|
-
setRootComponentFirstConstructorCallTimestampMs(timestamp) {
|
|
130
|
-
this._firstConstructorCallTimestampMs = timestamp;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Starts a new transaction for a user interaction.
|
|
134
|
-
* @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.
|
|
135
|
-
*/
|
|
136
|
-
startUserInteractionTransaction(userInteractionId) {
|
|
137
|
-
var _a, _b;
|
|
138
|
-
const { elementId, op } = userInteractionId;
|
|
139
|
-
if (!this.options.enableUserInteractionTracing) {
|
|
140
|
-
logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (!this.options.routingInstrumentation) {
|
|
144
|
-
logger.error('[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.');
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (!elementId) {
|
|
148
|
-
logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
if (!this._currentRoute) {
|
|
152
|
-
logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const hub = ((_a = this._getCurrentHub) === null || _a === void 0 ? void 0 : _a.call(this)) || getCurrentHub();
|
|
156
|
-
const activeTransaction = getActiveTransaction(hub);
|
|
157
|
-
const activeTransactionIsNotInteraction = (activeTransaction === null || activeTransaction === void 0 ? void 0 : activeTransaction.spanId) !== ((_b = this._inflightInteractionTransaction) === null || _b === void 0 ? void 0 : _b.spanId);
|
|
158
|
-
if (activeTransaction && activeTransactionIsNotInteraction) {
|
|
159
|
-
logger.warn(`[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (this._inflightInteractionTransaction) {
|
|
163
|
-
this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });
|
|
164
|
-
this._inflightInteractionTransaction = undefined;
|
|
165
|
-
}
|
|
166
|
-
const name = `${this._currentRoute}.${elementId}`;
|
|
167
|
-
const context = {
|
|
168
|
-
name,
|
|
169
|
-
op,
|
|
170
|
-
trimEnd: true,
|
|
171
|
-
};
|
|
172
|
-
this._inflightInteractionTransaction = this._startIdleTransaction(context);
|
|
173
|
-
this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction) => {
|
|
174
|
-
this._inflightInteractionTransaction = undefined;
|
|
175
|
-
this.onTransactionFinish(transaction);
|
|
176
|
-
});
|
|
177
|
-
this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);
|
|
178
|
-
this.onTransactionStart(this._inflightInteractionTransaction);
|
|
179
|
-
logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);
|
|
180
|
-
return this._inflightInteractionTransaction;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Enables or disables native frames tracking based on the `enableNativeFramesTracking` option.
|
|
184
|
-
*/
|
|
185
|
-
_enableNativeFramesTracking(addGlobalEventProcessor) {
|
|
186
|
-
if (this.options.enableNativeFramesTracking && !NATIVE.enableNative) {
|
|
187
|
-
// Do not enable native frames tracking if native is not available.
|
|
188
|
-
logger.warn('[ReactNativeTracing] NativeFramesTracking is not available on the Web, Expo Go and other platforms without native modules.');
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (!this.options.enableNativeFramesTracking && NATIVE.enableNative) {
|
|
192
|
-
// Disable native frames tracking when native available and option is false.
|
|
193
|
-
NATIVE.disableNativeFramesTracking();
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (!this.options.enableNativeFramesTracking) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
NATIVE.enableNativeFramesTracking();
|
|
200
|
-
this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {
|
|
201
|
-
const self = getCurrentHub().getIntegration(ReactNativeTracing);
|
|
202
|
-
if (self) {
|
|
203
|
-
return !!self.nativeFramesInstrumentation;
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Sets the current view name into the app context.
|
|
210
|
-
* @param event Le event.
|
|
211
|
-
*/
|
|
212
|
-
_getCurrentViewEventProcessor(event) {
|
|
213
|
-
if (event.contexts && this._currentViewName) {
|
|
214
|
-
event.contexts.app = Object.assign({ view_names: [this._currentViewName] }, event.contexts.app);
|
|
7
|
+
export const defaultReactNativeTracingOptions = {
|
|
8
|
+
traceFetch: true,
|
|
9
|
+
traceXHR: true,
|
|
10
|
+
enableHTTPTimings: true,
|
|
11
|
+
};
|
|
12
|
+
export const reactNativeTracingIntegration = (options = {}) => {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const state = {
|
|
15
|
+
currentRoute: undefined,
|
|
16
|
+
};
|
|
17
|
+
const finalOptions = Object.assign(Object.assign(Object.assign({}, defaultReactNativeTracingOptions), options), { beforeStartSpan: (_a = options.beforeStartSpan) !== null && _a !== void 0 ? _a : ((options) => options), finalTimeoutMs: (_b = options.finalTimeoutMs) !== null && _b !== void 0 ? _b : defaultIdleOptions.finalTimeout, idleTimeoutMs: (_c = options.idleTimeoutMs) !== null && _c !== void 0 ? _c : defaultIdleOptions.idleTimeout });
|
|
18
|
+
const setup = (client) => {
|
|
19
|
+
addDefaultOpForSpanFrom(client);
|
|
20
|
+
instrumentOutgoingRequests({
|
|
21
|
+
traceFetch: finalOptions.traceFetch,
|
|
22
|
+
traceXHR: finalOptions.traceXHR,
|
|
23
|
+
shouldCreateSpanForRequest: finalOptions.shouldCreateSpanForRequest,
|
|
24
|
+
tracePropagationTargets: client.getOptions().tracePropagationTargets || DEFAULT_TRACE_PROPAGATION_TARGETS,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const processEvent = (event) => {
|
|
28
|
+
if (event.contexts && state.currentRoute) {
|
|
29
|
+
event.contexts.app = Object.assign({ view_names: [state.currentRoute] }, event.contexts.app);
|
|
215
30
|
}
|
|
216
31
|
return event;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
* Instruments the app start measurements on the first route transaction.
|
|
230
|
-
* Starts a route transaction if there isn't routing instrumentation.
|
|
231
|
-
*/
|
|
232
|
-
_instrumentAppStart() {
|
|
233
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
if (!this.options.enableAppStartTracking || !NATIVE.enableNative) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
const appStart = yield NATIVE.fetchNativeAppStart();
|
|
238
|
-
if (!appStart) {
|
|
239
|
-
logger.warn('[ReactNativeTracing] Not instrumenting App Start because native returned null.');
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (appStart.has_fetched) {
|
|
243
|
-
logger.warn('[ReactNativeTracing] Not instrumenting App Start because this start was already reported.');
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (!this.useAppStartWithProfiler) {
|
|
247
|
-
logger.warn('[ReactNativeTracing] `Sentry.wrap` not detected, using JS context init as app start end.');
|
|
248
|
-
this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;
|
|
249
|
-
}
|
|
250
|
-
if (this.options.routingInstrumentation) {
|
|
251
|
-
this._awaitingAppStartData = appStart;
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
const idleTransaction = this._createRouteTransaction({
|
|
255
|
-
name: 'App Start',
|
|
256
|
-
op: UI_LOAD,
|
|
257
|
-
});
|
|
258
|
-
if (idleTransaction) {
|
|
259
|
-
this._addAppStartData(idleTransaction, appStart);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Adds app start measurements and starts a child span on a transaction.
|
|
266
|
-
*/
|
|
267
|
-
_addAppStartData(transaction, appStart) {
|
|
268
|
-
var _a, _b;
|
|
269
|
-
const appStartTimestampMs = appStart.app_start_timestamp_ms;
|
|
270
|
-
if (!appStartTimestampMs) {
|
|
271
|
-
logger.warn('App start timestamp could not be loaded from the native layer.');
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
const isAppStartWithinBounds = appStartTimestampMs >=
|
|
275
|
-
getTransactionStartTimestampMs(transaction) - ReactNativeTracing._maxAppStartBeforeTransactionMs;
|
|
276
|
-
if (!__DEV__ && !isAppStartWithinBounds) {
|
|
277
|
-
logger.warn('[ReactNativeTracing] App start timestamp is too far in the past to be used for app start span.');
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStartTimestampMs);
|
|
281
|
-
if (!appStartDurationMilliseconds) {
|
|
282
|
-
logger.warn('[ReactNativeTracing] App start end has not been recorded, not adding app start span.');
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
// we filter out app start more than 60s.
|
|
286
|
-
// this could be due to many different reasons.
|
|
287
|
-
// we've seen app starts with hours, days and even months.
|
|
288
|
-
if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {
|
|
289
|
-
logger.warn('[ReactNativeTracing] App start duration is over a minute long, not adding app start span.');
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
const appStartTimeSeconds = appStartTimestampMs / 1000;
|
|
293
|
-
transaction.startTimestamp = appStartTimeSeconds;
|
|
294
|
-
const maybeTtidSpan = (_a = transaction.spanRecorder) === null || _a === void 0 ? void 0 : _a.spans.find(span => span.op === 'ui.load.initial_display');
|
|
295
|
-
if (maybeTtidSpan) {
|
|
296
|
-
maybeTtidSpan.startTimestamp = appStartTimeSeconds;
|
|
297
|
-
setSpanDurationAsMeasurement('time_to_initial_display', maybeTtidSpan);
|
|
298
|
-
}
|
|
299
|
-
const maybeTtfdSpan = (_b = transaction.spanRecorder) === null || _b === void 0 ? void 0 : _b.spans.find(span => span.op === 'ui.load.full_display');
|
|
300
|
-
if (maybeTtfdSpan) {
|
|
301
|
-
maybeTtfdSpan.startTimestamp = appStartTimeSeconds;
|
|
302
|
-
setSpanDurationAsMeasurement('time_to_full_display', maybeTtfdSpan);
|
|
303
|
-
}
|
|
304
|
-
const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;
|
|
305
|
-
const appStartSpan = transaction.startChild({
|
|
306
|
-
description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',
|
|
307
|
-
op,
|
|
308
|
-
startTimestamp: appStartTimeSeconds,
|
|
309
|
-
endTimestamp: this._appStartFinishTimestamp,
|
|
310
|
-
});
|
|
311
|
-
this._addJSExecutionBeforeRoot(appStartSpan);
|
|
312
|
-
this._addNativeSpansTo(appStartSpan, appStart.spans);
|
|
313
|
-
const measurement = appStart.type === 'cold' ? APP_START_COLD : APP_START_WARM;
|
|
314
|
-
transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.
|
|
318
|
-
*/
|
|
319
|
-
_addJSExecutionBeforeRoot(appStartSpan) {
|
|
320
|
-
const bundleStartTimestampMs = getBundleStartTimestampMs();
|
|
321
|
-
if (!bundleStartTimestampMs) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
if (!this._firstConstructorCallTimestampMs) {
|
|
325
|
-
logger.warn('Missing the root component first constructor call timestamp.');
|
|
326
|
-
appStartSpan.startChild({
|
|
327
|
-
description: 'JS Bundle Execution Start',
|
|
328
|
-
op: appStartSpan.op,
|
|
329
|
-
startTimestamp: bundleStartTimestampMs / 1000,
|
|
330
|
-
endTimestamp: bundleStartTimestampMs / 1000,
|
|
331
|
-
});
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
appStartSpan.startChild({
|
|
335
|
-
description: 'JS Bundle Execution Before React Root',
|
|
336
|
-
op: appStartSpan.op,
|
|
337
|
-
startTimestamp: bundleStartTimestampMs / 1000,
|
|
338
|
-
endTimestamp: this._firstConstructorCallTimestampMs / 1000,
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Adds native spans to the app start span.
|
|
343
|
-
*/
|
|
344
|
-
_addNativeSpansTo(appStartSpan, nativeSpans) {
|
|
345
|
-
nativeSpans.forEach(span => {
|
|
346
|
-
if (span.description === 'UIKit init') {
|
|
347
|
-
return this._createUIKitSpan(appStartSpan, span);
|
|
348
|
-
}
|
|
349
|
-
appStartSpan.startChild({
|
|
350
|
-
op: appStartSpan.op,
|
|
351
|
-
description: span.description,
|
|
352
|
-
startTimestamp: span.start_timestamp_ms / 1000,
|
|
353
|
-
endTimestamp: span.end_timestamp_ms / 1000,
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* UIKit init is measured by the native layers till the native SDK start
|
|
359
|
-
* RN initializes the native SDK later, the end timestamp would be wrong
|
|
360
|
-
*/
|
|
361
|
-
_createUIKitSpan(parentSpan, nativeUIKitSpan) {
|
|
362
|
-
const bundleStart = getBundleStartTimestampMs();
|
|
363
|
-
// If UIKit init ends after the bundle start, the native SDK was auto-initialized
|
|
364
|
-
// and so the end timestamp is incorrect.
|
|
365
|
-
// The timestamps can't equal, as RN initializes after UIKit.
|
|
366
|
-
if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {
|
|
367
|
-
parentSpan.startChild({
|
|
368
|
-
op: parentSpan.op,
|
|
369
|
-
description: 'UIKit Init to JS Exec Start',
|
|
370
|
-
startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,
|
|
371
|
-
endTimestamp: bundleStart / 1000,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
parentSpan.startChild({
|
|
376
|
-
op: parentSpan.op,
|
|
377
|
-
description: 'UIKit Init',
|
|
378
|
-
startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,
|
|
379
|
-
endTimestamp: nativeUIKitSpan.end_timestamp_ms / 1000,
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
/** To be called when the route changes, but BEFORE the components of the new route mount. */
|
|
384
|
-
_onRouteWillChange(context) {
|
|
385
|
-
return this._createRouteTransaction(context);
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Creates a breadcrumb and sets the current route as a tag.
|
|
389
|
-
*/
|
|
390
|
-
_onConfirmRoute(context) {
|
|
391
|
-
var _a, _b, _c;
|
|
392
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
393
|
-
this._currentRoute = (_b = (_a = context.data) === null || _a === void 0 ? void 0 : _a.route) === null || _b === void 0 ? void 0 : _b.name;
|
|
394
|
-
(_c = this._getCurrentHub) === null || _c === void 0 ? void 0 : _c.call(this).configureScope(scope => {
|
|
395
|
-
var _a;
|
|
396
|
-
if (context.data) {
|
|
397
|
-
const contextData = context.data;
|
|
398
|
-
scope.addBreadcrumb({
|
|
399
|
-
category: 'navigation',
|
|
400
|
-
type: 'navigation',
|
|
401
|
-
// We assume that context.name is the name of the route.
|
|
402
|
-
message: `Navigation to ${context.name}`,
|
|
403
|
-
data: {
|
|
404
|
-
from: (_a = contextData.previousRoute) === null || _a === void 0 ? void 0 : _a.name,
|
|
405
|
-
to: contextData.route.name,
|
|
406
|
-
},
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
this._currentViewName = context.name;
|
|
410
|
-
/**
|
|
411
|
-
* @deprecated tag routing.route.name will be removed in the future.
|
|
412
|
-
*/
|
|
413
|
-
scope.setTag('routing.route.name', context.name);
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
/** Create routing idle transaction. */
|
|
417
|
-
_createRouteTransaction(context) {
|
|
418
|
-
if (!this._getCurrentHub) {
|
|
419
|
-
logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);
|
|
420
|
-
return undefined;
|
|
421
|
-
}
|
|
422
|
-
if (this._inflightInteractionTransaction) {
|
|
423
|
-
logger.log(`[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`);
|
|
424
|
-
this._inflightInteractionTransaction.setStatus('cancelled');
|
|
425
|
-
this._inflightInteractionTransaction.finish();
|
|
426
|
-
}
|
|
427
|
-
const { finalTimeoutMs } = this.options;
|
|
428
|
-
const expandedContext = Object.assign(Object.assign({}, context), { trimEnd: true });
|
|
429
|
-
const idleTransaction = this._startIdleTransaction(expandedContext);
|
|
430
|
-
this.onTransactionStart(idleTransaction);
|
|
431
|
-
logger.log(`[ReactNativeTracing] Starting ${context.op} transaction "${context.name}" on scope`);
|
|
432
|
-
idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {
|
|
433
|
-
this.onTransactionFinish(transaction, endTimestamp);
|
|
434
|
-
});
|
|
435
|
-
idleTransaction.registerBeforeFinishCallback(transaction => {
|
|
436
|
-
if (this.options.enableAppStartTracking && this._awaitingAppStartData) {
|
|
437
|
-
transaction.op = UI_LOAD;
|
|
438
|
-
this._addAppStartData(transaction, this._awaitingAppStartData);
|
|
439
|
-
this._awaitingAppStartData = undefined;
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {
|
|
443
|
-
adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);
|
|
444
|
-
});
|
|
445
|
-
if (this.options.ignoreEmptyBackNavigationTransactions) {
|
|
446
|
-
idleTransaction.registerBeforeFinishCallback(transaction => {
|
|
447
|
-
var _a, _b;
|
|
448
|
-
if (
|
|
449
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
450
|
-
((_b = (_a = transaction.data) === null || _a === void 0 ? void 0 : _a.route) === null || _b === void 0 ? void 0 : _b.hasBeenSeen) &&
|
|
451
|
-
(!transaction.spanRecorder ||
|
|
452
|
-
transaction.spanRecorder.spans.filter(span => span.spanId !== transaction.spanId &&
|
|
453
|
-
span.op !== 'ui.load.initial_display' &&
|
|
454
|
-
span.op !== 'navigation.processing').length === 0)) {
|
|
455
|
-
logger.log('[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.');
|
|
456
|
-
// Route has been seen before and has no child spans.
|
|
457
|
-
transaction.sampled = false;
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
return idleTransaction;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Start app state aware idle transaction on the scope.
|
|
465
|
-
*/
|
|
466
|
-
_startIdleTransaction(context) {
|
|
467
|
-
var _a;
|
|
468
|
-
const { idleTimeoutMs, finalTimeoutMs } = this.options;
|
|
469
|
-
const hub = ((_a = this._getCurrentHub) === null || _a === void 0 ? void 0 : _a.call(this)) || getCurrentHub();
|
|
470
|
-
const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);
|
|
471
|
-
cancelInBackground(tx);
|
|
472
|
-
return tx;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
name: INTEGRATION_NAME,
|
|
35
|
+
setup,
|
|
36
|
+
processEvent,
|
|
37
|
+
options: finalOptions,
|
|
38
|
+
state,
|
|
39
|
+
setCurrentRoute: (route) => {
|
|
40
|
+
state.currentRoute = route;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
475
44
|
/**
|
|
476
|
-
*
|
|
45
|
+
* Returns the current React Native Tracing integration.
|
|
477
46
|
*/
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
47
|
+
export function getCurrentReactNativeTracingIntegration() {
|
|
48
|
+
const client = getClient();
|
|
49
|
+
if (!client) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return getReactNativeTracingIntegration(client);
|
|
53
|
+
}
|
|
483
54
|
/**
|
|
484
|
-
* Returns
|
|
485
|
-
* If start timestamp is not available, returns 0.
|
|
55
|
+
* Returns React Native Tracing integration of given client.
|
|
486
56
|
*/
|
|
487
|
-
function
|
|
488
|
-
return (
|
|
57
|
+
export function getReactNativeTracingIntegration(client) {
|
|
58
|
+
return client.getIntegrationByName(INTEGRATION_NAME);
|
|
489
59
|
}
|
|
490
60
|
//# sourceMappingURL=reactnativetracing.js.map
|