@sentry/react-native 6.0.0-beta.0 → 6.0.0-rc.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/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +18 -11
- package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +18 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +2 -2
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +2 -2
- package/dist/js/NativeRNSentry.d.ts +1 -1
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +3 -0
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/default.js +3 -3
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/options.d.ts +5 -28
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/profiling/integration.d.ts +11 -3
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js +10 -7
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +1 -1
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts +11 -2
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +42 -2
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +6 -2
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
- package/dist/js/tracing/gesturetracing.js +6 -2
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts +14 -0
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +32 -2
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.js +2 -2
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
- package/dist/js/tracing/origin.d.ts +8 -0
- package/dist/js/tracing/origin.d.ts.map +1 -1
- package/dist/js/tracing/origin.js +8 -0
- package/dist/js/tracing/origin.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js +3 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +3 -3
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +8 -2
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +4 -1
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/span.d.ts.map +1 -1
- package/dist/js/tracing/span.js +4 -3
- package/dist/js/tracing/span.js.map +1 -1
- package/dist/js/tracing/timetodisplay.d.ts +1 -0
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +16 -3
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/utils/environment.d.ts +2 -0
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +4 -0
- package/dist/js/utils/environment.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 +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +2 -2
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +7 -3
- package/package.json +10 -10
- package/scripts/sentry-xcode-debug-files.sh +4 -1
- package/scripts/sentry-xcode.sh +4 -1
- package/src/js/NativeRNSentry.ts +1 -1
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
- package/ts3.8/dist/js/options.d.ts +5 -28
- package/ts3.8/dist/js/profiling/integration.d.ts +11 -3
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +1 -1
- package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +14 -0
- package/ts3.8/dist/js/tracing/origin.d.ts +8 -0
- package/ts3.8/dist/js/tracing/timetodisplay.d.ts +1 -0
- package/ts3.8/dist/js/utils/environment.d.ts +2 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
/* eslint-disable complexity */
|
|
3
|
-
import { getCapturedScopesOnSpan, getClient, getCurrentScope, SentryNonRecordingSpan, startInactiveSpan, } from '@sentry/core';
|
|
3
|
+
import { getCapturedScopesOnSpan, getClient, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, startInactiveSpan, } from '@sentry/core';
|
|
4
4
|
import { logger, timestampInSeconds } from '@sentry/utils';
|
|
5
5
|
import { APP_START_COLD as APP_START_COLD_MEASUREMENT, APP_START_WARM as APP_START_WARM_MEASUREMENT, } from '../../measurements';
|
|
6
6
|
import { convertSpanToTransaction, setEndTimeValue } from '../../utils/span';
|
|
7
7
|
import { NATIVE } from '../../wrapper';
|
|
8
8
|
import { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD as UI_LOAD_OP, } from '../ops';
|
|
9
|
+
import { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';
|
|
9
10
|
import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';
|
|
10
11
|
import { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';
|
|
11
12
|
const INTEGRATION_NAME = 'AppStart';
|
|
@@ -20,12 +21,22 @@ const MAX_APP_START_AGE_MS = 60000;
|
|
|
20
21
|
/** App Start transaction name */
|
|
21
22
|
const APP_START_TX_NAME = 'App Start';
|
|
22
23
|
let recordedAppStartEndTimestampMs = undefined;
|
|
24
|
+
let isRecordedAppStartEndTimestampMsManual = false;
|
|
23
25
|
let rootComponentCreationTimestampMs = undefined;
|
|
26
|
+
let isRootComponentCreationTimestampMsManual = false;
|
|
24
27
|
/**
|
|
25
28
|
* Records the application start end.
|
|
26
29
|
* Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.
|
|
27
30
|
*/
|
|
28
31
|
export function captureAppStart() {
|
|
32
|
+
return _captureAppStart({ isManual: true });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* For internal use only.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
export function _captureAppStart({ isManual }) {
|
|
29
40
|
var _a;
|
|
30
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
42
|
const client = getClient();
|
|
@@ -33,6 +44,7 @@ export function captureAppStart() {
|
|
|
33
44
|
logger.warn('[AppStart] Could not capture App Start, missing client.');
|
|
34
45
|
return;
|
|
35
46
|
}
|
|
47
|
+
isRecordedAppStartEndTimestampMsManual = isManual;
|
|
36
48
|
_setAppStartEndTimestampMs(timestampInSeconds() * 1000);
|
|
37
49
|
yield ((_a = client.getIntegrationByName(INTEGRATION_NAME)) === null || _a === void 0 ? void 0 : _a.captureStandaloneAppStart());
|
|
38
50
|
});
|
|
@@ -46,6 +58,16 @@ export function setRootComponentCreationTimestampMs(timestampMs) {
|
|
|
46
58
|
logger.warn('Setting Root component creation timestamp after app start end is set.');
|
|
47
59
|
rootComponentCreationTimestampMs && logger.warn('Overwriting already set root component creation timestamp.');
|
|
48
60
|
rootComponentCreationTimestampMs = timestampMs;
|
|
61
|
+
isRootComponentCreationTimestampMsManual = true;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* For internal use only.
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
export function _setRootComponentCreationTimestampMs(timestampMs) {
|
|
69
|
+
setRootComponentCreationTimestampMs(timestampMs);
|
|
70
|
+
isRootComponentCreationTimestampMsManual = false;
|
|
49
71
|
}
|
|
50
72
|
/**
|
|
51
73
|
* For internal use only.
|
|
@@ -170,6 +192,9 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
|
|
|
170
192
|
event.contexts.trace.data = event.contexts.trace.data || {};
|
|
171
193
|
event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;
|
|
172
194
|
event.contexts.trace.op = UI_LOAD_OP;
|
|
195
|
+
const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;
|
|
196
|
+
event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;
|
|
197
|
+
event.contexts.trace.origin = origin;
|
|
173
198
|
const appStartTimestampSeconds = appStartTimestampMs / 1000;
|
|
174
199
|
event.start_timestamp = appStartTimestampSeconds;
|
|
175
200
|
event.spans = event.spans || [];
|
|
@@ -198,7 +223,7 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
|
|
|
198
223
|
timestamp: appStartEndTimestampSeconds,
|
|
199
224
|
trace_id: event.contexts.trace.trace_id,
|
|
200
225
|
parent_span_id: event.contexts.trace.span_id,
|
|
201
|
-
origin
|
|
226
|
+
origin,
|
|
202
227
|
});
|
|
203
228
|
const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);
|
|
204
229
|
const appStartSpans = [
|
|
@@ -251,12 +276,14 @@ function createJSExecutionStartSpan(parentSpan, rootComponentCreationTimestampMs
|
|
|
251
276
|
description: 'JS Bundle Execution Start',
|
|
252
277
|
start_timestamp: bundleStartTimestampMs / 1000,
|
|
253
278
|
timestamp: bundleStartTimestampMs / 1000,
|
|
279
|
+
origin: SPAN_ORIGIN_AUTO_APP_START,
|
|
254
280
|
});
|
|
255
281
|
}
|
|
256
282
|
return createChildSpanJSON(parentSpan, {
|
|
257
283
|
description: 'JS Bundle Execution Before React Root',
|
|
258
284
|
start_timestamp: bundleStartTimestampMs / 1000,
|
|
259
285
|
timestamp: rootComponentCreationTimestampMs / 1000,
|
|
286
|
+
origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,
|
|
260
287
|
});
|
|
261
288
|
}
|
|
262
289
|
/**
|
|
@@ -271,6 +298,7 @@ function convertNativeSpansToSpanJSON(parentSpan, nativeSpans) {
|
|
|
271
298
|
description: span.description,
|
|
272
299
|
start_timestamp: span.start_timestamp_ms / 1000,
|
|
273
300
|
timestamp: span.end_timestamp_ms / 1000,
|
|
301
|
+
origin: SPAN_ORIGIN_AUTO_APP_START,
|
|
274
302
|
});
|
|
275
303
|
});
|
|
276
304
|
}
|
|
@@ -288,6 +316,7 @@ function createUIKitSpan(parentSpan, nativeUIKitSpan) {
|
|
|
288
316
|
description: 'UIKit Init to JS Exec Start',
|
|
289
317
|
start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,
|
|
290
318
|
timestamp: bundleStart / 1000,
|
|
319
|
+
origin: SPAN_ORIGIN_AUTO_APP_START,
|
|
291
320
|
});
|
|
292
321
|
}
|
|
293
322
|
else {
|
|
@@ -295,6 +324,7 @@ function createUIKitSpan(parentSpan, nativeUIKitSpan) {
|
|
|
295
324
|
description: 'UIKit Init',
|
|
296
325
|
start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,
|
|
297
326
|
timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,
|
|
327
|
+
origin: SPAN_ORIGIN_AUTO_APP_START,
|
|
298
328
|
});
|
|
299
329
|
}
|
|
300
330
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appStart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AG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;SACnD,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n SentryNonRecordingSpan,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { Client, Event, Integration, SpanJSON, TransactionEvent } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\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 */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\nlet recordedAppStartEndTimestampMs: number | undefined = undefined;\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport async function captureAppStart(): Promise<void> {\n const client = getClient();\n if (!client) {\n logger.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n _setAppStartEndTimestampMs(timestampInSeconds() * 1000);\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n recordedAppStartEndTimestampMs &&\n logger.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && logger.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndTimestampMs = (timestampMs: number): void => {\n recordedAppStartEndTimestampMs && logger.warn('Overwriting already set app start.');\n recordedAppStartEndTimestampMs = timestampMs;\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n\n const setup = (client: Client): void => {\n _client = client;\n const clientOptions = client.getOptions() as ReactNativeClientOptions;\n\n const { enableAppStartTracking } = clientOptions;\n if (!enableAppStartTracking) {\n isEnabled = false;\n logger.warn('[AppStart] App start tracking is disabled.');\n }\n };\n\n const afterAllSetup = (_client: Client): void => {\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!standalone) {\n logger.debug(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n logger.debug('[AppStart] App start tracking standalone root span (transaction).');\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n logger.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction\n return;\n }\n\n if (!event.contexts || !event.contexts.trace) {\n logger.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n logger.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n return;\n }\n if (appStart.has_fetched) {\n logger.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartEndTimestampMs = recordedAppStartEndTimestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n logger.warn(\n '[AppStart] Javascript failed to record app start end. `setAppStartEndTimestampMs` was not called nor could the bundle start be found.',\n );\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n logger.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n logger.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n logger.debug(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin: 'auto',\n });\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n logger.debug('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n logger.debug(\n `[AppStart] Added app start measurement to transaction event.`,\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n };\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n logger.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampMs / 1000,\n timestamp: bundleStartTimestampMs / 1000,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampMs / 1000,\n timestamp: rootComponentCreationTimestampMs / 1000,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans.map(span => {\n if (span.description === 'UIKit init') {\n return createUIKitSpan(parentSpan, span);\n }\n\n return createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n });\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gCAAgC,EAChC,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE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AkB,GAAG,IAAI;YAC/C,SAAS,EAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI;YACvC,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,UAAoB,EAAE,eAAwD;IACrG,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD,iFAAiF;IACjF,yCAAyC;IACzC,6DAA6D;IAC7D,IAAI,WAAW,IAAI,WAAW,GAAG,eAAe,CAAC,gBAAgB,EAAE;QACjE,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,6BAA6B;YAC1C,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,WAAW,GAAG,IAAI;YAC7B,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,YAAY;YACzB,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { Client, Event, Integration, SpanJSON, TransactionEvent } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\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 */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\nlet recordedAppStartEndTimestampMs: number | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n const client = getClient();\n if (!client) {\n logger.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n _setAppStartEndTimestampMs(timestampInSeconds() * 1000);\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n recordedAppStartEndTimestampMs &&\n logger.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && logger.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndTimestampMs = (timestampMs: number): void => {\n recordedAppStartEndTimestampMs && logger.warn('Overwriting already set app start.');\n recordedAppStartEndTimestampMs = timestampMs;\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n\n const setup = (client: Client): void => {\n _client = client;\n const clientOptions = client.getOptions() as ReactNativeClientOptions;\n\n const { enableAppStartTracking } = clientOptions;\n if (!enableAppStartTracking) {\n isEnabled = false;\n logger.warn('[AppStart] App start tracking is disabled.');\n }\n };\n\n const afterAllSetup = (_client: Client): void => {\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!standalone) {\n logger.debug(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n logger.debug('[AppStart] App start tracking standalone root span (transaction).');\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n logger.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction\n return;\n }\n\n if (!event.contexts || !event.contexts.trace) {\n logger.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n logger.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n return;\n }\n if (appStart.has_fetched) {\n logger.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartEndTimestampMs = recordedAppStartEndTimestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n logger.warn(\n '[AppStart] Javascript failed to record app start end. `setAppStartEndTimestampMs` was not called nor could the bundle start be found.',\n );\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n logger.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n logger.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n logger.debug(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n logger.debug('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n logger.debug(\n `[AppStart] Added app start measurement to transaction event.`,\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n };\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n logger.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampMs / 1000,\n timestamp: bundleStartTimestampMs / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampMs / 1000,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans.map(span => {\n if (span.description === 'UIKit init') {\n return createUIKitSpan(parentSpan, span);\n }\n\n return createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getActiveSpan, getClient, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';
|
|
2
2
|
import { logger } from '@sentry/utils';
|
|
3
3
|
import { onlySampleIfChildSpans } from '../onSpanEndUtils';
|
|
4
|
-
import {
|
|
4
|
+
import { SPAN_ORIGIN_MANUAL_INTERACTION } from '../origin';
|
|
5
5
|
import { getCurrentReactNativeTracingIntegration } from '../reactnativetracing';
|
|
6
6
|
import { clearActiveSpanFromScope, isSentryInteractionSpan, startIdleSpan } from '../span';
|
|
7
7
|
const INTEGRATION_NAME = 'UserInteraction';
|
|
@@ -62,7 +62,7 @@ export const startUserInteractionSpan = (userInteractionId) => {
|
|
|
62
62
|
idleTimeout: tracing.options.idleTimeoutMs,
|
|
63
63
|
finalTimeout: tracing.options.finalTimeoutMs,
|
|
64
64
|
});
|
|
65
|
-
newSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
|
|
65
|
+
newSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_INTERACTION);
|
|
66
66
|
onlySampleIfChildSpans(client, newSpan);
|
|
67
67
|
logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing Created ${op} transaction ${name}.`);
|
|
68
68
|
return newSpan;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userInteraction.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/userInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,gCAAgC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEvH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,
|
|
1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C1C,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc;KAC7C,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,CAAC,gCAAgC,EAAE,8BAA8B,CAAC,CAAC;IACvF,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,IAAI,gBAAgB,sCAAsC,EAAE,gBAAgB,IAAI,GAAG,CAAC,CAAC;IAChG,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { getActiveSpan, getClient, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport type { Integration, Span, StartSpanOptions } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport type { ReactNativeClientOptions } from '../../options';\nimport { onlySampleIfChildSpans } from '../onSpanEndUtils';\nimport { SPAN_ORIGIN_MANUAL_INTERACTION } from '../origin';\nimport { getCurrentReactNativeTracingIntegration } from '../reactnativetracing';\nimport { clearActiveSpanFromScope, isSentryInteractionSpan, startIdleSpan } from '../span';\n\nconst INTEGRATION_NAME = 'UserInteraction';\n\nexport const userInteractionIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n };\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 */\nexport const startUserInteractionSpan = (userInteractionId: {\n elementId: string | undefined;\n op: string;\n}): Span | undefined => {\n const client = getClient();\n if (!client) {\n return undefined;\n }\n\n const tracing = getCurrentReactNativeTracingIntegration();\n if (!tracing) {\n logger.log(`[${INTEGRATION_NAME}] Tracing integration is not available. Can not start user interaction span.`);\n return undefined;\n }\n\n const options = client.getOptions() as ReactNativeClientOptions;\n const { elementId, op } = userInteractionId;\n if (!options.enableUserInteractionTracing) {\n logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing is disabled.`);\n return undefined;\n }\n if (!elementId) {\n logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing can not create transaction with undefined elementId.`);\n return undefined;\n }\n if (!tracing.state.currentRoute) {\n logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing can not create transaction without a current route.`);\n return undefined;\n }\n\n const activeTransaction = getActiveSpan();\n const activeTransactionIsNotInteraction = activeTransaction && !isSentryInteractionSpan(activeTransaction);\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[${INTEGRATION_NAME}] Did not create ${op} transaction because active transaction ${\n spanToJSON(activeTransaction).description\n } exists on the scope.`,\n );\n return undefined;\n }\n\n const name = `${tracing.state.currentRoute}.${elementId}`;\n if (\n activeTransaction &&\n spanToJSON(activeTransaction).description === name &&\n spanToJSON(activeTransaction).op === op\n ) {\n logger.warn(\n `[${INTEGRATION_NAME}] Did not create ${op} transaction because it the same transaction ${\n spanToJSON(activeTransaction).description\n } already exists on the scope.`,\n );\n return undefined;\n }\n\n const scope = getCurrentScope();\n const context: StartSpanOptions = {\n name,\n op,\n scope,\n };\n clearActiveSpanFromScope(scope);\n const newSpan = startIdleSpan(context, {\n idleTimeout: tracing.options.idleTimeoutMs,\n finalTimeout: tracing.options.finalTimeoutMs,\n });\n newSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_INTERACTION);\n onlySampleIfChildSpans(client, newSpan);\n logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing Created ${op} transaction ${name}.`);\n return newSpan;\n};\n"]}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export declare const SPAN_ORIGIN_AUTO_INTERACTION = "auto.interaction";
|
|
2
|
+
export declare const SPAN_ORIGIN_MANUAL_INTERACTION = "manual.interaction";
|
|
3
|
+
export declare const SPAN_ORIGIN_MANUAL_APP_START = "manual.app.start";
|
|
4
|
+
export declare const SPAN_ORIGIN_AUTO_APP_START = "auto.app.start";
|
|
5
|
+
export declare const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION = "auto.navigation.react_native_navigation";
|
|
6
|
+
export declare const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = "auto.navigation.react_navigation";
|
|
7
|
+
export declare const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = "auto.navigation.custom";
|
|
8
|
+
export declare const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = "auto.ui.time_to_display";
|
|
9
|
+
export declare const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = "manual.ui.time_to_display";
|
|
2
10
|
//# sourceMappingURL=origin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AAEnE,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D,eAAO,MAAM,mDAAmD,4CAA4C,CAAC;AAC7G,eAAO,MAAM,4CAA4C,qCAAqC,CAAC;AAC/F,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAE3E,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AAC7E,eAAO,MAAM,qCAAqC,8BAA8B,CAAC"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export const SPAN_ORIGIN_AUTO_INTERACTION = 'auto.interaction';
|
|
2
|
+
export const SPAN_ORIGIN_MANUAL_INTERACTION = 'manual.interaction';
|
|
3
|
+
export const SPAN_ORIGIN_MANUAL_APP_START = 'manual.app.start';
|
|
4
|
+
export const SPAN_ORIGIN_AUTO_APP_START = 'auto.app.start';
|
|
5
|
+
export const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION = 'auto.navigation.react_native_navigation';
|
|
6
|
+
export const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = 'auto.navigation.react_navigation';
|
|
7
|
+
export const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = 'auto.navigation.custom';
|
|
8
|
+
export const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = 'auto.ui.time_to_display';
|
|
9
|
+
export const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = 'manual.ui.time_to_display';
|
|
2
10
|
//# sourceMappingURL=origin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC","sourcesContent":["export const SPAN_ORIGIN_AUTO_INTERACTION = 'auto.interaction';\n"]}
|
|
1
|
+
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAAoB,CAAC;AAEnE,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,mDAAmD,GAAG,yCAAyC,CAAC;AAC7G,MAAM,CAAC,MAAM,4CAA4C,GAAG,kCAAkC,CAAC;AAC/F,MAAM,CAAC,MAAM,kCAAkC,GAAG,wBAAwB,CAAC;AAE3E,MAAM,CAAC,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;AAC7E,MAAM,CAAC,MAAM,qCAAqC,GAAG,2BAA2B,CAAC","sourcesContent":["export const SPAN_ORIGIN_AUTO_INTERACTION = 'auto.interaction';\nexport const SPAN_ORIGIN_MANUAL_INTERACTION = 'manual.interaction';\n\nexport const SPAN_ORIGIN_MANUAL_APP_START = 'manual.app.start';\nexport const SPAN_ORIGIN_AUTO_APP_START = 'auto.app.start';\n\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION = 'auto.navigation.react_native_navigation';\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = 'auto.navigation.react_navigation';\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = 'auto.navigation.custom';\n\nexport const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = 'auto.ui.time_to_display';\nexport const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = 'manual.ui.time_to_display';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativenavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactnativenavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAU,WAAW,EAAQ,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAazE,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAIxD,UAAU,4BAA4B;IACpC;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;;OAKG;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAEhD;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAEvF,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,mCAAmC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,GAAG,mBAAmB,CAAC;IAC9G,uBAAuB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GAAG,iBAAiB,CAAC;IAC9F,gCAAgC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,GAAG,mBAAmB,CAAC;CACzG;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,cAAc,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,+HAK1C,4BAA4B,KAAG,WAkIjC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { addBreadcrumb, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core';
|
|
1
|
+
import { addBreadcrumb, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core';
|
|
2
2
|
import { isSentrySpan } from '../utils/span';
|
|
3
3
|
import { ignoreEmptyBackNavigation } from './onSpanEndUtils';
|
|
4
|
+
import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION } from './origin';
|
|
4
5
|
import { getReactNativeTracingIntegration } from './reactnativetracing';
|
|
5
6
|
import { DEFAULT_NAVIGATION_SPAN_NAME, defaultIdleOptions, getDefaultIdleNavigationSpanOptions, startIdleNavigationSpan as startGenericIdleNavigationSpan, } from './span';
|
|
6
7
|
export const INTEGRATION_NAME = 'ReactNativeNavigation';
|
|
@@ -37,6 +38,7 @@ export const reactNativeNavigationIntegration = ({ navigation: optionsNavigation
|
|
|
37
38
|
latestNavigationSpan = startGenericIdleNavigationSpan(tracing && tracing.options.beforeStartSpan
|
|
38
39
|
? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())
|
|
39
40
|
: getDefaultIdleNavigationSpanOptions(), idleSpanOptions);
|
|
41
|
+
latestNavigationSpan === null || latestNavigationSpan === void 0 ? void 0 : latestNavigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION);
|
|
40
42
|
if (ignoreEmptyBackNavigationTransactions) {
|
|
41
43
|
ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);
|
|
42
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativenavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,4BAA4B,EAC5B,gCAAgC,EAChC,UAAU,GACX,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,mCAAmC,EACnC,uBAAuB,IAAI,8BAA8B,GAC1D,MAAM,QAAQ,CAAC;AAEhB,MAAM,CAAC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AAO,kBAAkB,KAAK,WAAW,EAAE;YAC7C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;SAChC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;KACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n addBreadcrumb,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport type { Client, Integration, Span } from '@sentry/types';\n\nimport type { EmitterSubscription } from '../utils/rnlibrariesinterface';\nimport { isSentrySpan } from '../utils/span';\nimport { ignoreEmptyBackNavigation } from './onSpanEndUtils';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\n\nexport const INTEGRATION_NAME = 'ReactNativeNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\ninterface ReactNativeNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs?: number;\n\n /**\n * Instrumentation will create a transaction on tab change.\n * By default only navigation commands create transactions.\n *\n * @default false\n */\n enableTabsInstrumentation?: boolean;\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 /** The React Native Navigation `NavigationDelegate`.\n *\n * ```js\n * import { Navigation } from 'react-native-navigation';\n * ```\n */\n navigation: unknown;\n}\n\ninterface ComponentEvent {\n componentId: string;\n}\n\ntype ComponentType = 'Component' | 'TopBarTitle' | 'TopBarBackground' | 'TopBarButton';\n\nexport interface ComponentWillAppearEvent extends ComponentEvent {\n componentName: string;\n passProps?: Record<string | number | symbol, unknown>;\n componentType: ComponentType;\n}\n\nexport interface EventSubscription {\n remove(): void;\n}\n\nexport interface BottomTabPressedEvent {\n tabIndex: number;\n}\n\nexport interface EventsRegistry {\n registerComponentWillAppearListener(callback: (event: ComponentWillAppearEvent) => void): EmitterSubscription;\n registerCommandListener(callback: (name: string, params: unknown) => void): EventSubscription;\n registerBottomTabPressedListener(callback: (event: BottomTabPressedEvent) => void): EmitterSubscription;\n}\n\nexport interface NavigationDelegate {\n events: () => EventsRegistry;\n}\n\n/**\n * Instrumentation for React Native Navigation. See docs or sample app for usage.\n *\n * How this works:\n * - `_onCommand` is called every time a commands happens and sets an IdleTransaction on the scope without any route context.\n * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNativeNavigationIntegration = ({\n navigation: optionsNavigation,\n routeChangeTimeoutMs = 1_000,\n enableTabsInstrumentation = false,\n ignoreEmptyBackNavigationTransactions = true,\n}: ReactNativeNavigationOptions): Integration => {\n const navigation = optionsNavigation as NavigationDelegate;\n let recentComponentIds: string[] = [];\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let prevComponentEvent: ComponentWillAppearEvent | null = null;\n let latestNavigationSpan: Span | undefined;\n\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n };\n\n const startIdleNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n discardLatestNavigationSpan();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing && tracing.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n idleSpanOptions,\n );\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n\n stateChangeTimeout = setTimeout(discardLatestNavigationSpan.bind(this), routeChangeTimeoutMs);\n };\n\n const updateLatestNavigationSpanWithCurrentComponent = (event: ComponentWillAppearEvent): void => {\n if (!latestNavigationSpan) {\n return;\n }\n\n // We ignore actions that pertain to the same screen.\n const isSameComponent = prevComponentEvent && event.componentId === prevComponentEvent.componentId;\n if (isSameComponent) {\n discardLatestNavigationSpan();\n return;\n }\n\n clearStateChangeTimeout();\n\n const routeHasBeenSeen = recentComponentIds.includes(event.componentId);\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(event.componentName);\n }\n latestNavigationSpan.setAttributes({\n // TODO: Should we include pass props? I don't know exactly what it contains, cant find it in the RNavigation docs\n 'route.name': event.componentName,\n 'route.component_id': event.componentId,\n 'route.component_type': event.componentType,\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': prevComponentEvent?.componentName,\n 'previous_route.component_id': prevComponentEvent?.componentId,\n 'previous_route.component_type': prevComponentEvent?.componentType,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n tracing?.setCurrentRoute(event.componentName);\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${event.componentName}`,\n data: {\n from: prevComponentEvent?.componentName,\n to: event.componentName,\n },\n });\n\n pushRecentComponentId(event.componentId);\n prevComponentEvent = event;\n latestNavigationSpan = undefined;\n };\n\n navigation.events().registerCommandListener(startIdleNavigationSpan);\n if (enableTabsInstrumentation) {\n navigation.events().registerBottomTabPressedListener(startIdleNavigationSpan);\n }\n navigation.events().registerComponentWillAppearListener(updateLatestNavigationSpanWithCurrentComponent);\n\n const pushRecentComponentId = (id: string): void => {\n recentComponentIds.push(id);\n\n if (recentComponentIds.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentComponentIds = recentComponentIds.slice(recentComponentIds.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n const discardLatestNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n\n clearStateChangeTimeout();\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"reactnativenavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,UAAU,GACX,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,mDAAmD,EAAE,MAAM,UAAU,CAAC;AAE/E,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,mCAAmC,EACnC,uBAAuB,IAAI,8BAA8B,GAC1D,MAAM,QAAQ,CAAC;AAEhB,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD,MAAM,2BAA2B,GAAG,GAAG,CAAC;A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,EAAE;QACzC,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;YAC7C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;SAChC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;KACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n addBreadcrumb,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport type { Client, Integration, Span } from '@sentry/types';\n\nimport type { EmitterSubscription } from '../utils/rnlibrariesinterface';\nimport { isSentrySpan } from '../utils/span';\nimport { ignoreEmptyBackNavigation } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION } from './origin';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\n\nexport const INTEGRATION_NAME = 'ReactNativeNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\ninterface ReactNativeNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs?: number;\n\n /**\n * Instrumentation will create a transaction on tab change.\n * By default only navigation commands create transactions.\n *\n * @default false\n */\n enableTabsInstrumentation?: boolean;\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 /** The React Native Navigation `NavigationDelegate`.\n *\n * ```js\n * import { Navigation } from 'react-native-navigation';\n * ```\n */\n navigation: unknown;\n}\n\ninterface ComponentEvent {\n componentId: string;\n}\n\ntype ComponentType = 'Component' | 'TopBarTitle' | 'TopBarBackground' | 'TopBarButton';\n\nexport interface ComponentWillAppearEvent extends ComponentEvent {\n componentName: string;\n passProps?: Record<string | number | symbol, unknown>;\n componentType: ComponentType;\n}\n\nexport interface EventSubscription {\n remove(): void;\n}\n\nexport interface BottomTabPressedEvent {\n tabIndex: number;\n}\n\nexport interface EventsRegistry {\n registerComponentWillAppearListener(callback: (event: ComponentWillAppearEvent) => void): EmitterSubscription;\n registerCommandListener(callback: (name: string, params: unknown) => void): EventSubscription;\n registerBottomTabPressedListener(callback: (event: BottomTabPressedEvent) => void): EmitterSubscription;\n}\n\nexport interface NavigationDelegate {\n events: () => EventsRegistry;\n}\n\n/**\n * Instrumentation for React Native Navigation. See docs or sample app for usage.\n *\n * How this works:\n * - `_onCommand` is called every time a commands happens and sets an IdleTransaction on the scope without any route context.\n * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNativeNavigationIntegration = ({\n navigation: optionsNavigation,\n routeChangeTimeoutMs = 1_000,\n enableTabsInstrumentation = false,\n ignoreEmptyBackNavigationTransactions = true,\n}: ReactNativeNavigationOptions): Integration => {\n const navigation = optionsNavigation as NavigationDelegate;\n let recentComponentIds: string[] = [];\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let prevComponentEvent: ComponentWillAppearEvent | null = null;\n let latestNavigationSpan: Span | undefined;\n\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n };\n\n const startIdleNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n discardLatestNavigationSpan();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing && tracing.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n idleSpanOptions,\n );\n latestNavigationSpan?.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION,\n );\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n\n stateChangeTimeout = setTimeout(discardLatestNavigationSpan.bind(this), routeChangeTimeoutMs);\n };\n\n const updateLatestNavigationSpanWithCurrentComponent = (event: ComponentWillAppearEvent): void => {\n if (!latestNavigationSpan) {\n return;\n }\n\n // We ignore actions that pertain to the same screen.\n const isSameComponent = prevComponentEvent && event.componentId === prevComponentEvent.componentId;\n if (isSameComponent) {\n discardLatestNavigationSpan();\n return;\n }\n\n clearStateChangeTimeout();\n\n const routeHasBeenSeen = recentComponentIds.includes(event.componentId);\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(event.componentName);\n }\n latestNavigationSpan.setAttributes({\n // TODO: Should we include pass props? I don't know exactly what it contains, cant find it in the RNavigation docs\n 'route.name': event.componentName,\n 'route.component_id': event.componentId,\n 'route.component_type': event.componentType,\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': prevComponentEvent?.componentName,\n 'previous_route.component_id': prevComponentEvent?.componentId,\n 'previous_route.component_type': prevComponentEvent?.componentType,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n tracing?.setCurrentRoute(event.componentName);\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${event.componentName}`,\n data: {\n from: prevComponentEvent?.componentName,\n to: event.componentName,\n },\n });\n\n pushRecentComponentId(event.componentId);\n prevComponentEvent = event;\n latestNavigationSpan = undefined;\n };\n\n navigation.events().registerCommandListener(startIdleNavigationSpan);\n if (enableTabsInstrumentation) {\n navigation.events().registerBottomTabPressedListener(startIdleNavigationSpan);\n }\n navigation.events().registerComponentWillAppearListener(updateLatestNavigationSpanWithCurrentComponent);\n\n const pushRecentComponentId = (id: string): void => {\n recentComponentIds.push(id);\n\n if (recentComponentIds.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentComponentIds = recentComponentIds.slice(recentComponentIds.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n const discardLatestNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n\n clearStateChangeTimeout();\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n };\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getClient, Profiler } from '@sentry/react';
|
|
2
2
|
import { timestampInSeconds } from '@sentry/utils';
|
|
3
3
|
import { createIntegration } from '../integrations/factory';
|
|
4
|
-
import {
|
|
4
|
+
import { _captureAppStart, _setRootComponentCreationTimestampMs } from '../tracing/integrations/appStart';
|
|
5
5
|
const ReactNativeProfilerGlobalState = {
|
|
6
6
|
appStartReported: false,
|
|
7
7
|
};
|
|
@@ -10,7 +10,7 @@ const ReactNativeProfilerGlobalState = {
|
|
|
10
10
|
*/
|
|
11
11
|
export class ReactNativeProfiler extends Profiler {
|
|
12
12
|
constructor(props) {
|
|
13
|
-
|
|
13
|
+
_setRootComponentCreationTimestampMs(timestampInSeconds() * 1000);
|
|
14
14
|
super(props);
|
|
15
15
|
this.name = 'ReactNativeProfiler';
|
|
16
16
|
}
|
|
@@ -37,7 +37,7 @@ export class ReactNativeProfiler extends Profiler {
|
|
|
37
37
|
}
|
|
38
38
|
client.addIntegration && client.addIntegration(createIntegration(this.name));
|
|
39
39
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
40
|
-
|
|
40
|
+
_captureAppStart({ isManual: false });
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
//# sourceMappingURL=reactnativeprofiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeprofiler.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativeprofiler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reactnativeprofiler.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativeprofiler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,oCAAoC,EAAE,MAAM,kCAAkC,CAAC;AAE1G,MAAM,8BAA8B,GAAG;IACrC,gBAAgB,EAAE,KAAK;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAG/C,YAAmB,KAAgD;QACjE,oCAAoC,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,CAAC;QAClE,KAAK,CAAC,KAAK,CAAC,CAAC;QAJC,SAAI,GAAW,qBAAqB,CAAC;IAKrD,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,8BAA8B,CAAC,gBAAgB,EAAE;YACpD,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,8BAA8B,CAAC,gBAAgB,GAAG,IAAI,CAAC;SACxD;IACH,CAAC;IAED;;OAEG;IACK,eAAe;QACrB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAE3B,IAAI,CAAC,MAAM,EAAE;YACX,iFAAiF;YACjF,sCAAsC;YACtC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;YAChH,OAAO;SACR;QAED,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7E,mEAAmE;QACnE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import { getClient, Profiler } from '@sentry/react';\nimport { timestampInSeconds } from '@sentry/utils';\n\nimport { createIntegration } from '../integrations/factory';\nimport { _captureAppStart, _setRootComponentCreationTimestampMs } from '../tracing/integrations/appStart';\n\nconst ReactNativeProfilerGlobalState = {\n appStartReported: false,\n};\n\n/**\n * Custom profiler for the React Native app root.\n */\nexport class ReactNativeProfiler extends Profiler {\n public readonly name: string = 'ReactNativeProfiler';\n\n public constructor(props: ConstructorParameters<typeof Profiler>[0]) {\n _setRootComponentCreationTimestampMs(timestampInSeconds() * 1000);\n super(props);\n }\n\n /**\n * Get the app root mount time.\n */\n public componentDidMount(): void {\n super.componentDidMount();\n if (!ReactNativeProfilerGlobalState.appStartReported) {\n this._reportAppStart();\n ReactNativeProfilerGlobalState.appStartReported = true;\n }\n }\n\n /**\n * Notifies the Tracing integration that the app start has finished.\n */\n private _reportAppStart(): void {\n const client = getClient();\n\n if (!client) {\n // We can't use logger here because this will be logged before the `Sentry.init`.\n // eslint-disable-next-line no-console\n __DEV__ && console.warn('App Start Span could not be finished. `Sentry.wrap` was called before `Sentry.init`.');\n return;\n }\n\n client.addIntegration && client.addIntegration(createIntegration(this.name));\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n _captureAppStart({ isManual: false });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAS,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAS,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKlF,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;IAElE;;;;;OAKG;IACH,0BAA0B,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/D;AASD,eAAO,MAAM,gCAAgC,EAAE,yBAI9C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAC/B,QAAQ,yBAAyB,CAAC;aAElC,yBAAyB;WAC3B,uBAAuB;6BACL,MAAM,KAAK,IAAI;CA0CzC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAE7F;;GAEG;AACH,wBAAgB,uCAAuC,IAAI,6BAA6B,GAAG,SAAS,CAOnG;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,6BAA6B,GAAG,SAAS,CAE1G"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
import { instrumentOutgoingRequests } from '@sentry/browser';
|
|
3
3
|
import { getClient } from '@sentry/core';
|
|
4
|
+
import { isWeb } from '../utils/environment';
|
|
4
5
|
import { addDefaultOpForSpanFrom, defaultIdleOptions } from './span';
|
|
5
6
|
export const INTEGRATION_NAME = 'ReactNativeTracing';
|
|
6
|
-
|
|
7
|
+
function getDefaultTracePropagationTargets() {
|
|
8
|
+
if (isWeb()) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return [/.*/];
|
|
12
|
+
}
|
|
7
13
|
export const defaultReactNativeTracingOptions = {
|
|
8
14
|
traceFetch: true,
|
|
9
15
|
traceXHR: true,
|
|
@@ -21,7 +27,7 @@ export const reactNativeTracingIntegration = (options = {}) => {
|
|
|
21
27
|
traceFetch: finalOptions.traceFetch,
|
|
22
28
|
traceXHR: finalOptions.traceXHR,
|
|
23
29
|
shouldCreateSpanForRequest: finalOptions.shouldCreateSpanForRequest,
|
|
24
|
-
tracePropagationTargets: client.getOptions().tracePropagationTargets ||
|
|
30
|
+
tracePropagationTargets: client.getOptions().tracePropagationTargets || getDefaultTracePropagationTargets(),
|
|
25
31
|
});
|
|
26
32
|
};
|
|
27
33
|
const processEvent = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAErE,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAuDrD,
|
|
1
|
+
{"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAErE,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAuDrD,SAAS,iCAAiC;IACxC,IAAI,KAAK,EAAE,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAA8B;IACzE,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAMF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,UAA8C,EAAE,EAKhD,EAAE;;IACF,MAAM,KAAK,GAA4B;QACrC,YAAY,EAAE,SAAS;KACxB,CAAC;IAEF,MAAM,YAAY,iDACb,gCAAgC,GAChC,OAAO,KACV,eAAe,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S,CAAC;KAClB;IAED,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAc;IAC7D,OAAO,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,CAA8C,CAAC;AACpG,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { instrumentOutgoingRequests } from '@sentry/browser';\nimport { getClient } from '@sentry/core';\nimport type { Client, Event, Integration, StartSpanOptions } from '@sentry/types';\n\nimport { isWeb } from '../utils/environment';\nimport { addDefaultOpForSpanFrom, defaultIdleOptions } from './span';\n\nexport const INTEGRATION_NAME = 'ReactNativeTracing';\n\nexport interface ReactNativeTracingOptions {\n /**\n * The time that has to pass without any span being created.\n * If this time is exceeded, the idle span will finish.\n *\n * @default 1_000 (ms)\n */\n idleTimeoutMs?: number;\n\n /**\n * The max. time an idle span may run.\n * If this time is exceeded, the idle span will finish no matter what.\n *\n * @default 60_0000 (ms)\n */\n finalTimeoutMs?: number;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * @default true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * @default true\n */\n traceXHR: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * @default true\n */\n enableHTTPTimings: boolean;\n\n /**\n * A callback which is called before a span for a navigation is started.\n * It receives the options passed to `startSpan`, and expects to return an updated options object.\n */\n beforeStartSpan?: (options: StartSpanOptions) => StartSpanOptions;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * @default (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n}\n\nfunction getDefaultTracePropagationTargets(): RegExp[] | undefined {\n if (isWeb()) {\n return undefined;\n }\n return [/.*/];\n}\n\nexport const defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n};\n\nexport type ReactNativeTracingState = {\n currentRoute: string | undefined;\n};\n\nexport const reactNativeTracingIntegration = (\n options: Partial<ReactNativeTracingOptions> = {},\n): Integration & {\n options: ReactNativeTracingOptions;\n state: ReactNativeTracingState;\n setCurrentRoute: (route: string) => void;\n} => {\n const state: ReactNativeTracingState = {\n currentRoute: undefined,\n };\n\n const finalOptions = {\n ...defaultReactNativeTracingOptions,\n ...options,\n beforeStartSpan: options.beforeStartSpan ?? ((options: StartSpanOptions) => options),\n finalTimeoutMs: options.finalTimeoutMs ?? defaultIdleOptions.finalTimeout,\n idleTimeoutMs: options.idleTimeoutMs ?? defaultIdleOptions.idleTimeout,\n };\n\n const setup = (client: Client): void => {\n addDefaultOpForSpanFrom(client);\n\n instrumentOutgoingRequests(client, {\n traceFetch: finalOptions.traceFetch,\n traceXHR: finalOptions.traceXHR,\n shouldCreateSpanForRequest: finalOptions.shouldCreateSpanForRequest,\n tracePropagationTargets: client.getOptions().tracePropagationTargets || getDefaultTracePropagationTargets(),\n });\n };\n\n const processEvent = (event: Event): Event => {\n if (event.contexts && state.currentRoute) {\n event.contexts.app = { view_names: [state.currentRoute], ...event.contexts.app };\n }\n return event;\n };\n\n return {\n name: INTEGRATION_NAME,\n setup,\n processEvent,\n options: finalOptions,\n state,\n setCurrentRoute: (route: string) => {\n state.currentRoute = route;\n },\n };\n};\n\nexport type ReactNativeTracingIntegration = ReturnType<typeof reactNativeTracingIntegration>;\n\n/**\n * Returns the current React Native Tracing integration.\n */\nexport function getCurrentReactNativeTracingIntegration(): ReactNativeTracingIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n }\n\n return getReactNativeTracingIntegration(client);\n}\n\n/**\n * Returns React Native Tracing integration of given client.\n */\nexport function getReactNativeTracingIntegration(client: Client): ReactNativeTracingIntegration | undefined {\n return client.getIntegrationByName(INTEGRATION_NAME) as ReactNativeTracingIntegration | undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactnavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAU,WAAW,EAAQ,MAAM,eAAe,CAAC;AAsB/D,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAIlD,UAAU,iCAAiC;IACzC;;;;;OAKG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,0BAA0B,EAAE,OAAO,CAAC;IAEpC;;;;;OAKG;IACH,qCAAqC,EAAE,OAAO,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,kGAIpC,QAAQ,iCAAiC,CAAC;IAC3C;;;OAGG;0DACmD,OAAO,KAAK,IAAI;CAiRvE,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
|
-
import { addBreadcrumb, getActiveSpan, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SPAN_STATUS_OK, spanToJSON, startInactiveSpan, } from '@sentry/core';
|
|
2
|
+
import { addBreadcrumb, getActiveSpan, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_OK, spanToJSON, startInactiveSpan, } from '@sentry/core';
|
|
3
3
|
import { isPlainObject, logger, timestampInSeconds } from '@sentry/utils';
|
|
4
4
|
import { createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';
|
|
5
5
|
import { isSentrySpan } from '../utils/span';
|
|
6
6
|
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
7
7
|
import { NATIVE } from '../wrapper';
|
|
8
8
|
import { ignoreEmptyBackNavigation } from './onSpanEndUtils';
|
|
9
|
+
import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';
|
|
9
10
|
import { getReactNativeTracingIntegration } from './reactnativetracing';
|
|
10
11
|
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';
|
|
11
12
|
import { DEFAULT_NAVIGATION_SPAN_NAME, defaultIdleOptions, getDefaultIdleNavigationSpanOptions, startIdleNavigationSpan as startGenericIdleNavigationSpan, } from './span';
|
|
@@ -114,6 +115,7 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
|
|
|
114
115
|
latestNavigationSpan = startGenericIdleNavigationSpan(tracing && tracing.options.beforeStartSpan
|
|
115
116
|
? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())
|
|
116
117
|
: getDefaultIdleNavigationSpanOptions(), idleSpanOptions);
|
|
118
|
+
latestNavigationSpan === null || latestNavigationSpan === void 0 ? void 0 : latestNavigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);
|
|
117
119
|
if (ignoreEmptyBackNavigationTransactions) {
|
|
118
120
|
ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);
|
|
119
121
|
}
|
|
@@ -123,6 +125,7 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
|
|
|
123
125
|
name: 'Navigation processing',
|
|
124
126
|
startTime: latestNavigationSpan && spanToJSON(latestNavigationSpan).start_timestamp,
|
|
125
127
|
});
|
|
128
|
+
navigationProcessingSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);
|
|
126
129
|
}
|
|
127
130
|
stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);
|
|
128
131
|
};
|