@sentry/react-native 5.23.1 → 5.24.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 +30 -1
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +7 -18
- package/dist/js/NativeRNSentry.d.ts +8 -3
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +2 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/tracing/nativeframes.d.ts +2 -2
- package/dist/js/tracing/nativeframes.d.ts.map +1 -1
- package/dist/js/tracing/nativeframes.js +30 -14
- package/dist/js/tracing/nativeframes.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.d.ts +1 -0
- package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +7 -3
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +18 -0
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +93 -10
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/utils.d.ts +6 -0
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js +21 -1
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +2 -0
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/ios/RNSentry.mm +10 -14
- package/package.json +11 -11
- package/scripts/sentry-xcode-debug-files.sh +10 -1
- package/scripts/sentry-xcode.sh +10 -1
- package/src/js/NativeRNSentry.ts +8 -3
- package/ts3.8/dist/js/NativeRNSentry.d.ts +8 -3
- package/ts3.8/dist/js/client.d.ts +1 -1
- package/ts3.8/dist/js/tracing/nativeframes.d.ts +2 -2
- package/ts3.8/dist/js/tracing/reactnativeprofiler.d.ts +1 -0
- package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +18 -0
- package/ts3.8/dist/js/tracing/utils.d.ts +6 -0
- package/ts3.8/dist/js/utils/worldwide.d.ts +2 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,GAAG,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAEV,cAAc,EACd,WAAW,
|
|
1
|
+
{"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,GAAG,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAEV,cAAc,EACd,WAAW,EAEX,WAAW,IAAI,eAAe,EAE/B,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAExF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAA0B,MAAM,SAAS,CAAC;AAStE,MAAM,WAAW,yBAA0B,SAAQ,6BAA6B;IAC9E;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAE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nE;;OAEG;IACU,SAAS,CACpB,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC3D,aAAa,EAAE,MAAM,GAAG,GACvB,OAAO,CAAC,IAAI,CAAC;IA8EhB;;OAEG;IACI,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAczD;;OAEG;IACI,mBAAmB,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IAKjF;;OAEG;IACI,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAInD;;OAEG;IACI,+CAA+C,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI/E;;;OAGG;IACI,+BAA+B,CAAC,iBAAiB,EAAE;QACxD,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,EAAE,EAAE,MAAM,CAAC;KACZ,GAAG,eAAe,GAAG,SAAS;IAsD/B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA+BnC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAOrC;;;OAGG;IACH,OAAO,CAAC,gCAAgC;IAOxC;;;OAGG;YACW,mBAAmB;IAoCjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmDxB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAyBjC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAuBxB,6FAA6F;IAC7F,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB,uCAAuC;IACvC,OAAO,CAAC,uBAAuB;IAqE/B;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAO9B"}
|
|
@@ -8,7 +8,7 @@ import { NativeFramesInstrumentation } from './nativeframes';
|
|
|
8
8
|
import { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';
|
|
9
9
|
import { StallTrackingInstrumentation } from './stalltracking';
|
|
10
10
|
import { cancelInBackground, onlySampleIfChildSpans } from './transaction';
|
|
11
|
-
import { adjustTransactionDuration, getTimeOriginMilliseconds, isNearToNow, setSpanDurationAsMeasurement, } from './utils';
|
|
11
|
+
import { adjustTransactionDuration, getBundleStartTimestampMs, getTimeOriginMilliseconds, isNearToNow, setSpanDurationAsMeasurement, } from './utils';
|
|
12
12
|
const DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\/(?!\/)/];
|
|
13
13
|
const defaultReactNativeTracingOptions = Object.assign(Object.assign({}, defaultRequestInstrumentationOptions), { idleTimeout: 1000, maxTransactionDuration: 600, idleTimeoutMs: 1000, finalTimeoutMs: 600000, ignoreEmptyBackNavigationTransactions: true, beforeNavigate: context => context, enableAppStartTracking: true, enableNativeFramesTracking: true, enableStallTracking: true, enableUserInteractionTracing: false });
|
|
14
14
|
/**
|
|
@@ -105,6 +105,9 @@ export class ReactNativeTracing {
|
|
|
105
105
|
(_a = this.nativeFramesInstrumentation) === null || _a === void 0 ? void 0 : _a.onTransactionStart(transaction);
|
|
106
106
|
(_b = this.stallTrackingInstrumentation) === null || _b === void 0 ? void 0 : _b.onTransactionStart(transaction);
|
|
107
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
|
+
}
|
|
108
111
|
}
|
|
109
112
|
/**
|
|
110
113
|
* To be called on a transaction finish. Cannot have async methods.
|
|
@@ -120,6 +123,12 @@ export class ReactNativeTracing {
|
|
|
120
123
|
onAppStartFinish(endTimestamp) {
|
|
121
124
|
this._appStartFinishTimestamp = endTimestamp;
|
|
122
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Sets the root component first constructor call timestamp.
|
|
128
|
+
*/
|
|
129
|
+
setRootComponentFirstConstructorCallTimestampMs(timestamp) {
|
|
130
|
+
this._firstConstructorCallTimestampMs = timestamp;
|
|
131
|
+
}
|
|
123
132
|
/**
|
|
124
133
|
* Starts a new transaction for a user interaction.
|
|
125
134
|
* @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.
|
|
@@ -210,11 +219,11 @@ export class ReactNativeTracing {
|
|
|
210
219
|
* Returns the App Start Duration in Milliseconds. Also returns undefined if not able do
|
|
211
220
|
* define the duration.
|
|
212
221
|
*/
|
|
213
|
-
_getAppStartDurationMilliseconds(
|
|
222
|
+
_getAppStartDurationMilliseconds(appStartTimestampMs) {
|
|
214
223
|
if (!this._appStartFinishTimestamp) {
|
|
215
224
|
return undefined;
|
|
216
225
|
}
|
|
217
|
-
return this._appStartFinishTimestamp * 1000 -
|
|
226
|
+
return this._appStartFinishTimestamp * 1000 - appStartTimestampMs;
|
|
218
227
|
}
|
|
219
228
|
/**
|
|
220
229
|
* Instruments the app start measurements on the first route transaction.
|
|
@@ -230,7 +239,7 @@ export class ReactNativeTracing {
|
|
|
230
239
|
logger.warn('[ReactNativeTracing] Not instrumenting App Start because native returned null.');
|
|
231
240
|
return;
|
|
232
241
|
}
|
|
233
|
-
if (appStart.
|
|
242
|
+
if (appStart.has_fetched) {
|
|
234
243
|
logger.warn('[ReactNativeTracing] Not instrumenting App Start because this start was already reported.');
|
|
235
244
|
return;
|
|
236
245
|
}
|
|
@@ -257,7 +266,12 @@ export class ReactNativeTracing {
|
|
|
257
266
|
*/
|
|
258
267
|
_addAppStartData(transaction, appStart) {
|
|
259
268
|
var _a, _b;
|
|
260
|
-
const
|
|
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 appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStartTimestampMs);
|
|
261
275
|
if (!appStartDurationMilliseconds) {
|
|
262
276
|
logger.warn('[ReactNativeTracing] App start end has not been recorded, not adding app start span.');
|
|
263
277
|
return;
|
|
@@ -269,7 +283,7 @@ export class ReactNativeTracing {
|
|
|
269
283
|
logger.warn('[ReactNativeTracing] App start duration is over a minute long, not adding app start span.');
|
|
270
284
|
return;
|
|
271
285
|
}
|
|
272
|
-
const appStartTimeSeconds =
|
|
286
|
+
const appStartTimeSeconds = appStartTimestampMs / 1000;
|
|
273
287
|
transaction.startTimestamp = appStartTimeSeconds;
|
|
274
288
|
const maybeTtidSpan = (_a = transaction.spanRecorder) === null || _a === void 0 ? void 0 : _a.spans.find(span => span.op === 'ui.load.initial_display');
|
|
275
289
|
if (maybeTtidSpan) {
|
|
@@ -281,16 +295,85 @@ export class ReactNativeTracing {
|
|
|
281
295
|
maybeTtfdSpan.startTimestamp = appStartTimeSeconds;
|
|
282
296
|
setSpanDurationAsMeasurement('time_to_full_display', maybeTtfdSpan);
|
|
283
297
|
}
|
|
284
|
-
const op = appStart.
|
|
285
|
-
transaction.startChild({
|
|
286
|
-
description: appStart.
|
|
298
|
+
const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;
|
|
299
|
+
const appStartSpan = transaction.startChild({
|
|
300
|
+
description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',
|
|
287
301
|
op,
|
|
288
302
|
startTimestamp: appStartTimeSeconds,
|
|
289
303
|
endTimestamp: this._appStartFinishTimestamp,
|
|
290
304
|
});
|
|
291
|
-
|
|
305
|
+
this._addJSExecutionBeforeRoot(appStartSpan);
|
|
306
|
+
this._addNativeSpansTo(appStartSpan, appStart.spans);
|
|
307
|
+
const measurement = appStart.type === 'cold' ? APP_START_COLD : APP_START_WARM;
|
|
292
308
|
transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');
|
|
293
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.
|
|
312
|
+
*/
|
|
313
|
+
_addJSExecutionBeforeRoot(appStartSpan) {
|
|
314
|
+
const bundleStartTimestampMs = getBundleStartTimestampMs();
|
|
315
|
+
if (!bundleStartTimestampMs) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (!this._firstConstructorCallTimestampMs) {
|
|
319
|
+
logger.warn('Missing the root component first constructor call timestamp.');
|
|
320
|
+
appStartSpan.startChild({
|
|
321
|
+
description: 'JS Bundle Execution Start',
|
|
322
|
+
op: appStartSpan.op,
|
|
323
|
+
startTimestamp: bundleStartTimestampMs / 1000,
|
|
324
|
+
endTimestamp: bundleStartTimestampMs / 1000,
|
|
325
|
+
});
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
appStartSpan.startChild({
|
|
329
|
+
description: 'JS Bundle Execution Before React Root',
|
|
330
|
+
op: appStartSpan.op,
|
|
331
|
+
startTimestamp: bundleStartTimestampMs / 1000,
|
|
332
|
+
endTimestamp: this._firstConstructorCallTimestampMs / 1000,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Adds native spans to the app start span.
|
|
337
|
+
*/
|
|
338
|
+
_addNativeSpansTo(appStartSpan, nativeSpans) {
|
|
339
|
+
nativeSpans.forEach(span => {
|
|
340
|
+
if (span.description === 'UIKit init') {
|
|
341
|
+
return this._createUIKitSpan(appStartSpan, span);
|
|
342
|
+
}
|
|
343
|
+
appStartSpan.startChild({
|
|
344
|
+
op: appStartSpan.op,
|
|
345
|
+
description: span.description,
|
|
346
|
+
startTimestamp: span.start_timestamp_ms / 1000,
|
|
347
|
+
endTimestamp: span.end_timestamp_ms / 1000,
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* UIKit init is measured by the native layers till the native SDK start
|
|
353
|
+
* RN initializes the native SDK later, the end timestamp would be wrong
|
|
354
|
+
*/
|
|
355
|
+
_createUIKitSpan(parentSpan, nativeUIKitSpan) {
|
|
356
|
+
const bundleStart = getBundleStartTimestampMs();
|
|
357
|
+
// If UIKit init ends after the bundle start, the native SDK was auto-initialized
|
|
358
|
+
// and so the end timestamp is incorrect.
|
|
359
|
+
// The timestamps can't equal, as RN initializes after UIKit.
|
|
360
|
+
if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {
|
|
361
|
+
parentSpan.startChild({
|
|
362
|
+
op: parentSpan.op,
|
|
363
|
+
description: 'UIKit Init to JS Exec Start',
|
|
364
|
+
startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,
|
|
365
|
+
endTimestamp: bundleStart / 1000,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
parentSpan.startChild({
|
|
370
|
+
op: parentSpan.op,
|
|
371
|
+
description: 'UIKit Init',
|
|
372
|
+
startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,
|
|
373
|
+
endTimestamp: nativeUIKitSpan.end_timestamp_ms / 1000,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
294
377
|
/** To be called when the route changes, but BEFORE the components of the new route mount. */
|
|
295
378
|
_onRouteWillChange(context) {
|
|
296
379
|
return this._createRouteTransaction(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAQzF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,cAAc,IAAI,i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AC,GAAG,CACR,0JAA0J,CAC3J,CAAC;oBACF,qDAAqD;oBACrD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC7B;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,OAA2B;;QACvD,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACvD,MAAM,GAAG,GAAG,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,aAAa,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QACnF,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;;AAteD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { RequestInstrumentationOptions } from '@sentry/browser';\nimport { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry/browser';\nimport type { Hub, IdleTransaction, Transaction } from '@sentry/core';\nimport { getActiveTransaction, getCurrentHub, startIdleTransaction } from '@sentry/core';\nimport type {\n Event,\n EventProcessor,\n Integration,\n Transaction as TransactionType,\n TransactionContext,\n} from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { APP_START_COLD, APP_START_WARM } from '../measurements';\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport { cancelInBackground, onlySampleIfChildSpans } from './transaction';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport {\n adjustTransactionDuration,\n getTimeOriginMilliseconds,\n isNearToNow,\n setSpanDurationAsMeasurement,\n} from './utils';\n\nexport interface ReactNativeTracingOptions extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * Default: true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n */\n enableUserInteractionTracing: boolean;\n}\n\nconst DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\\/(?!\\/)/];\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: context => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _inflightInteractionTransaction?: IdleTransaction;\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n private _currentRoute?: string;\n private _hasSetTracePropagationTargets: boolean;\n private _hasSetTracingOrigins: boolean;\n private _currentViewName: string | undefined;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this._hasSetTracePropagationTargets = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracePropagationTargets\n );\n this._hasSetTracingOrigins = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracingOrigins\n );\n\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs:\n options.finalTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n (typeof options.maxTransactionDuration === 'number'\n ? // eslint-disable-next-line deprecation/deprecation\n options.maxTransactionDuration * 1000\n : undefined) ??\n defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs:\n options.idleTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n options.idleTimeout ??\n defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public async setupOnce(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub,\n ): Promise<void> {\n const hub = getCurrentHub();\n const client = hub.getClient();\n const clientOptions = client && client.getOptions();\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n shouldCreateSpanForRequest,\n // eslint-disable-next-line deprecation/deprecation\n tracePropagationTargets: thisOptionsTracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;\n // There are three ways to configure tracePropagationTargets:\n // 1. via top level client option `tracePropagationTargets`\n // 2. via ReactNativeTracing option `tracePropagationTargets`\n // 3. via ReactNativeTracing option `tracingOrigins` (deprecated)\n //\n // To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to\n // ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).\n //\n // If both 1 and either one of 2 or 3 are set (from above), we log out a warning.\n const tracePropagationTargets =\n clientOptionsTracePropagationTargets ||\n (this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||\n (this._hasSetTracingOrigins && tracingOrigins) ||\n DEFAULT_TRACE_PROPAGATION_TARGETS;\n if (\n __DEV__ &&\n (this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&\n clientOptionsTracePropagationTargets\n ) {\n logger.warn(\n '[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',\n );\n }\n\n if (enableAppStartTracking) {\n this._instrumentAppStart().then(undefined, (reason: unknown) => {\n logger.error(`[ReactNativeTracing] Error while instrumenting app start:`, reason);\n });\n }\n\n this._enableNativeFramesTracking(addGlobalEventProcessor);\n\n if (enableStallTracking) {\n this.stallTrackingInstrumentation = new StallTrackingInstrumentation();\n }\n\n if (routingInstrumentation) {\n routingInstrumentation.registerRoutingInstrumentation(\n this._onRouteWillChange.bind(this),\n this.options.beforeNavigate,\n this._onConfirmRoute.bind(this),\n );\n } else {\n logger.log('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');\n }\n\n addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(transaction: Transaction, endTimestamp?: number): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Starts a new transaction for a user interaction.\n * @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.\n */\n public startUserInteractionTransaction(userInteractionId: {\n elementId: string | undefined;\n op: string;\n }): TransactionType | undefined {\n const { elementId, op } = userInteractionId;\n if (!this.options.enableUserInteractionTracing) {\n logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');\n return;\n }\n if (!this.options.routingInstrumentation) {\n logger.error(\n '[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.',\n );\n return;\n }\n if (!elementId) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');\n return;\n }\n if (!this._currentRoute) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');\n return;\n }\n\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const activeTransaction = getActiveTransaction(hub);\n const activeTransactionIsNotInteraction =\n activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`,\n );\n return;\n }\n\n if (this._inflightInteractionTransaction) {\n this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });\n this._inflightInteractionTransaction = undefined;\n }\n\n const name = `${this._currentRoute}.${elementId}`;\n const context: TransactionContext = {\n name,\n op,\n trimEnd: true,\n };\n this._inflightInteractionTransaction = this._startIdleTransaction(context);\n this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction: IdleTransaction) => {\n this._inflightInteractionTransaction = undefined;\n this.onTransactionFinish(transaction);\n });\n this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);\n this.onTransactionStart(this._inflightInteractionTransaction);\n logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);\n return this._inflightInteractionTransaction;\n }\n\n /**\n * Enables or disables native frames tracking based on the `enableNativeFramesTracking` option.\n */\n private _enableNativeFramesTracking(addGlobalEventProcessor: (callback: EventProcessor) => void): void {\n if (this.options.enableNativeFramesTracking && !NATIVE.enableNative) {\n // Do not enable native frames tracking if native is not available.\n logger.warn(\n '[ReactNativeTracing] NativeFramesTracking is not available on the Web, Expo Go and other platforms without native modules.',\n );\n return;\n }\n\n if (!this.options.enableNativeFramesTracking && NATIVE.enableNative) {\n // Disable native frames tracking when native available and option is false.\n NATIVE.disableNativeFramesTracking();\n return;\n }\n\n if (!this.options.enableNativeFramesTracking) {\n return;\n }\n\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n });\n }\n\n /**\n * Sets the current view name into the app context.\n * @param event Le event.\n */\n private _getCurrentViewEventProcessor(event: Event): Event {\n if (event.contexts && this._currentViewName) {\n event.contexts.app = { view_names: [this._currentViewName], ...event.contexts.app };\n }\n return event;\n }\n\n /**\n * Returns the App Start Duration in Milliseconds. Also returns undefined if not able do\n * define the duration.\n */\n private _getAppStartDurationMilliseconds(appStart: NativeAppStartResponse): number | undefined {\n if (!this._appStartFinishTimestamp) {\n return undefined;\n }\n return this._appStartFinishTimestamp * 1000 - appStart.appStartTime;\n }\n\n /**\n * Instruments the app start measurements on the first route transaction.\n * Starts a route transaction if there isn't routing instrumentation.\n */\n private async _instrumentAppStart(): Promise<void> {\n if (!this.options.enableAppStartTracking || !NATIVE.enableNative) {\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n\n if (!appStart) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because native returned null.');\n return;\n }\n\n if (appStart.didFetchAppStart) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because this start was already reported.');\n return;\n }\n\n if (!this.useAppStartWithProfiler) {\n logger.warn('[ReactNativeTracing] `Sentry.wrap` not detected, using JS context init as app start end.');\n this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;\n }\n\n if (this.options.routingInstrumentation) {\n this._awaitingAppStartData = appStart;\n } else {\n const idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(transaction: IdleTransaction, appStart: NativeAppStartResponse): void {\n const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStart);\n if (!appStartDurationMilliseconds) {\n logger.warn('[ReactNativeTracing] App start end has not been recorded, not adding app start span.');\n return;\n }\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n logger.warn('[ReactNativeTracing] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n const appStartTimeSeconds = appStart.appStartTime / 1000;\n\n transaction.startTimestamp = appStartTimeSeconds;\n\n const maybeTtidSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_full_display', maybeTtfdSpan);\n }\n\n const op = appStart.isColdStart ? APP_START_COLD_OP : APP_START_WARM_OP;\n transaction.startChild({\n description: appStart.isColdStart ? 'Cold App Start' : 'Warm App Start',\n op,\n startTimestamp: appStartTimeSeconds,\n endTimestamp: this._appStartFinishTimestamp,\n });\n\n const measurement = appStart.isColdStart ? APP_START_COLD : APP_START_WARM;\n transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');\n }\n\n /** To be called when the route changes, but BEFORE the components of the new route mount. */\n private _onRouteWillChange(context: TransactionContext): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._currentRoute = context.data?.route?.name;\n\n this._getCurrentHub?.().configureScope(scope => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n this._currentViewName = context.name;\n /**\n * @deprecated tag routing.route.name will be removed in the future.\n */\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n if (this._inflightInteractionTransaction) {\n logger.log(\n `[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`,\n );\n this._inflightInteractionTransaction.setStatus('cancelled');\n this._inflightInteractionTransaction.finish();\n }\n\n const { finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const idleTransaction = this._startIdleTransaction(expandedContext);\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(`[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`);\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n });\n\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.op = UI_LOAD;\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);\n });\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(\n span =>\n span.spanId !== transaction.spanId &&\n span.op !== 'ui.load.initial_display' &&\n span.op !== 'navigation.processing',\n ).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.',\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n\n /**\n * Start app state aware idle transaction on the scope.\n */\n private _startIdleTransaction(context: TransactionContext): IdleTransaction {\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);\n cancelInBackground(tx);\n return tx;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASzF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,cAAc,IAAI,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,4BAA4B,GAC7B,MAAM,SAAS,CAAC;AAgFjB,MAAM,iCAAiC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cAAc,EAAE,IAAI,CAAC,CAAC;QACnF,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;;AArkBD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC;AAChD,6CAA6C;AAC9B,+BAAY,GAAW,KAAK,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { RequestInstrumentationOptions } from '@sentry/browser';\nimport { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry/browser';\nimport type { Hub, IdleTransaction, Transaction } from '@sentry/core';\nimport { getActiveTransaction, getCurrentHub, startIdleTransaction } from '@sentry/core';\nimport type {\n Event,\n EventProcessor,\n Integration,\n Span,\n Transaction as TransactionType,\n TransactionContext,\n} from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { APP_START_COLD, APP_START_WARM } from '../measurements';\nimport type { NativeAppStartResponse } from '../NativeRNSentry';\nimport type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';\nimport { NATIVE } from '../wrapper';\nimport { NativeFramesInstrumentation } from './nativeframes';\nimport { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, UI_LOAD } from './ops';\nimport { StallTrackingInstrumentation } from './stalltracking';\nimport { cancelInBackground, onlySampleIfChildSpans } from './transaction';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport {\n adjustTransactionDuration,\n getBundleStartTimestampMs,\n getTimeOriginMilliseconds,\n isNearToNow,\n setSpanDurationAsMeasurement,\n} from './utils';\n\nexport interface ReactNativeTracingOptions extends RequestInstrumentationOptions {\n /**\n * @deprecated Replaced by idleTimeoutMs\n */\n idleTimeout: number;\n\n /**\n * @deprecated Replaced by maxTransactionDurationMs\n */\n maxTransactionDuration: number;\n\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeoutMs: number;\n\n /**\n * The maximum duration (transaction duration + idle timeout) of a transaction\n * before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in ms.\n *\n * Default: 600000\n */\n finalTimeoutMs: number;\n\n /**\n * The routing instrumentation to be used with the tracing integration.\n * There is no routing instrumentation if nothing is passed.\n */\n routingInstrumentation?: RoutingInstrumentationInstance;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * Default: true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate: BeforeNavigate;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Default: true\n */\n enableAppStartTracking: boolean;\n\n /**\n * Track slow/frozen frames from the native layer and adds them as measurements to all transactions.\n */\n enableNativeFramesTracking: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n */\n enableStallTracking: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n */\n enableUserInteractionTracing: boolean;\n}\n\nconst DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\\/(?!\\/)/];\n\nconst defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n ...defaultRequestInstrumentationOptions,\n idleTimeout: 1000,\n maxTransactionDuration: 600,\n idleTimeoutMs: 1000,\n finalTimeoutMs: 600000,\n ignoreEmptyBackNavigationTransactions: true,\n beforeNavigate: context => context,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Tracing integration for React Native.\n */\nexport class ReactNativeTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeTracing';\n /** We filter out App starts more than 60s */\n private static _maxAppStart: number = 60000;\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeTracing.id;\n\n /** ReactNativeTracing options */\n public options: ReactNativeTracingOptions;\n\n public nativeFramesInstrumentation?: NativeFramesInstrumentation;\n public stallTrackingInstrumentation?: StallTrackingInstrumentation;\n public useAppStartWithProfiler: boolean = false;\n\n private _inflightInteractionTransaction?: IdleTransaction;\n private _getCurrentHub?: () => Hub;\n private _awaitingAppStartData?: NativeAppStartResponse;\n private _appStartFinishTimestamp?: number;\n private _currentRoute?: string;\n private _hasSetTracePropagationTargets: boolean;\n private _hasSetTracingOrigins: boolean;\n private _currentViewName: string | undefined;\n private _firstConstructorCallTimestampMs: number | undefined;\n\n public constructor(options: Partial<ReactNativeTracingOptions> = {}) {\n this._hasSetTracePropagationTargets = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracePropagationTargets\n );\n this._hasSetTracingOrigins = !!(\n options &&\n // eslint-disable-next-line deprecation/deprecation\n options.tracingOrigins\n );\n\n this.options = {\n ...defaultReactNativeTracingOptions,\n ...options,\n finalTimeoutMs:\n options.finalTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n (typeof options.maxTransactionDuration === 'number'\n ? // eslint-disable-next-line deprecation/deprecation\n options.maxTransactionDuration * 1000\n : undefined) ??\n defaultReactNativeTracingOptions.finalTimeoutMs,\n idleTimeoutMs:\n options.idleTimeoutMs ??\n // eslint-disable-next-line deprecation/deprecation\n options.idleTimeout ??\n defaultReactNativeTracingOptions.idleTimeoutMs,\n };\n }\n\n /**\n * Registers routing and request instrumentation.\n */\n public async setupOnce(\n addGlobalEventProcessor: (callback: EventProcessor) => void,\n getCurrentHub: () => Hub,\n ): Promise<void> {\n const hub = getCurrentHub();\n const client = hub.getClient();\n const clientOptions = client && client.getOptions();\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n traceFetch,\n traceXHR,\n // eslint-disable-next-line deprecation/deprecation\n tracingOrigins,\n shouldCreateSpanForRequest,\n // eslint-disable-next-line deprecation/deprecation\n tracePropagationTargets: thisOptionsTracePropagationTargets,\n routingInstrumentation,\n enableAppStartTracking,\n enableStallTracking,\n } = this.options;\n\n this._getCurrentHub = getCurrentHub;\n\n const clientOptionsTracePropagationTargets = clientOptions && clientOptions.tracePropagationTargets;\n // There are three ways to configure tracePropagationTargets:\n // 1. via top level client option `tracePropagationTargets`\n // 2. via ReactNativeTracing option `tracePropagationTargets`\n // 3. via ReactNativeTracing option `tracingOrigins` (deprecated)\n //\n // To avoid confusion, favour top level client option `tracePropagationTargets`, and fallback to\n // ReactNativeTracing option `tracePropagationTargets` and then `tracingOrigins` (deprecated).\n //\n // If both 1 and either one of 2 or 3 are set (from above), we log out a warning.\n const tracePropagationTargets =\n clientOptionsTracePropagationTargets ||\n (this._hasSetTracePropagationTargets && thisOptionsTracePropagationTargets) ||\n (this._hasSetTracingOrigins && tracingOrigins) ||\n DEFAULT_TRACE_PROPAGATION_TARGETS;\n if (\n __DEV__ &&\n (this._hasSetTracePropagationTargets || this._hasSetTracingOrigins) &&\n clientOptionsTracePropagationTargets\n ) {\n logger.warn(\n '[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',\n );\n }\n\n if (enableAppStartTracking) {\n this._instrumentAppStart().then(undefined, (reason: unknown) => {\n logger.error(`[ReactNativeTracing] Error while instrumenting app start:`, reason);\n });\n }\n\n this._enableNativeFramesTracking(addGlobalEventProcessor);\n\n if (enableStallTracking) {\n this.stallTrackingInstrumentation = new StallTrackingInstrumentation();\n }\n\n if (routingInstrumentation) {\n routingInstrumentation.registerRoutingInstrumentation(\n this._onRouteWillChange.bind(this),\n this.options.beforeNavigate,\n this._onConfirmRoute.bind(this),\n );\n } else {\n logger.log('[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.');\n }\n\n addGlobalEventProcessor(this._getCurrentViewEventProcessor.bind(this));\n\n instrumentOutgoingRequests({\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n tracePropagationTargets,\n });\n }\n\n /**\n * To be called on a transaction start. Can have async methods\n */\n public onTransactionStart(transaction: Transaction): void {\n if (isNearToNow(transaction.startTimestamp)) {\n // Only if this method is called at or within margin of error to the start timestamp.\n this.nativeFramesInstrumentation?.onTransactionStart(transaction);\n this.stallTrackingInstrumentation?.onTransactionStart(transaction);\n } else {\n logger.warn(\n `[ReactNativeTracing] onTransactionStart called with delay (larger than margin of error) for transaction ${\n transaction.description\n } (${transaction.spanContext().spanId}). Not fetching native frames or tracking stalls.`,\n );\n }\n }\n\n /**\n * To be called on a transaction finish. Cannot have async methods.\n */\n public onTransactionFinish(transaction: Transaction, endTimestamp?: number): void {\n this.nativeFramesInstrumentation?.onTransactionFinish(transaction);\n this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);\n }\n\n /**\n * Called by the ReactNativeProfiler component on first component mount.\n */\n public onAppStartFinish(endTimestamp: number): void {\n this._appStartFinishTimestamp = endTimestamp;\n }\n\n /**\n * Sets the root component first constructor call timestamp.\n */\n public setRootComponentFirstConstructorCallTimestampMs(timestamp: number): void {\n this._firstConstructorCallTimestampMs = timestamp;\n }\n\n /**\n * Starts a new transaction for a user interaction.\n * @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.\n */\n public startUserInteractionTransaction(userInteractionId: {\n elementId: string | undefined;\n op: string;\n }): TransactionType | undefined {\n const { elementId, op } = userInteractionId;\n if (!this.options.enableUserInteractionTracing) {\n logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');\n return;\n }\n if (!this.options.routingInstrumentation) {\n logger.error(\n '[ReactNativeTracing] User Interaction Tracing is not working because no routing instrumentation is set.',\n );\n return;\n }\n if (!elementId) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction with undefined elementId.');\n return;\n }\n if (!this._currentRoute) {\n logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');\n return;\n }\n\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const activeTransaction = getActiveTransaction(hub);\n const activeTransactionIsNotInteraction =\n activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;\n if (activeTransaction && activeTransactionIsNotInteraction) {\n logger.warn(\n `[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`,\n );\n return;\n }\n\n if (this._inflightInteractionTransaction) {\n this._inflightInteractionTransaction.cancelIdleTimeout(undefined, { restartOnChildSpanChange: false });\n this._inflightInteractionTransaction = undefined;\n }\n\n const name = `${this._currentRoute}.${elementId}`;\n const context: TransactionContext = {\n name,\n op,\n trimEnd: true,\n };\n this._inflightInteractionTransaction = this._startIdleTransaction(context);\n this._inflightInteractionTransaction.registerBeforeFinishCallback((transaction: IdleTransaction) => {\n this._inflightInteractionTransaction = undefined;\n this.onTransactionFinish(transaction);\n });\n this._inflightInteractionTransaction.registerBeforeFinishCallback(onlySampleIfChildSpans);\n this.onTransactionStart(this._inflightInteractionTransaction);\n logger.log(`[ReactNativeTracing] User Interaction Tracing Created ${op} transaction ${name}.`);\n return this._inflightInteractionTransaction;\n }\n\n /**\n * Enables or disables native frames tracking based on the `enableNativeFramesTracking` option.\n */\n private _enableNativeFramesTracking(addGlobalEventProcessor: (callback: EventProcessor) => void): void {\n if (this.options.enableNativeFramesTracking && !NATIVE.enableNative) {\n // Do not enable native frames tracking if native is not available.\n logger.warn(\n '[ReactNativeTracing] NativeFramesTracking is not available on the Web, Expo Go and other platforms without native modules.',\n );\n return;\n }\n\n if (!this.options.enableNativeFramesTracking && NATIVE.enableNative) {\n // Disable native frames tracking when native available and option is false.\n NATIVE.disableNativeFramesTracking();\n return;\n }\n\n if (!this.options.enableNativeFramesTracking) {\n return;\n }\n\n NATIVE.enableNativeFramesTracking();\n this.nativeFramesInstrumentation = new NativeFramesInstrumentation(addGlobalEventProcessor, () => {\n const self = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (self) {\n return !!self.nativeFramesInstrumentation;\n }\n\n return false;\n });\n }\n\n /**\n * Sets the current view name into the app context.\n * @param event Le event.\n */\n private _getCurrentViewEventProcessor(event: Event): Event {\n if (event.contexts && this._currentViewName) {\n event.contexts.app = { view_names: [this._currentViewName], ...event.contexts.app };\n }\n return event;\n }\n\n /**\n * Returns the App Start Duration in Milliseconds. Also returns undefined if not able do\n * define the duration.\n */\n private _getAppStartDurationMilliseconds(appStartTimestampMs: number): number | undefined {\n if (!this._appStartFinishTimestamp) {\n return undefined;\n }\n return this._appStartFinishTimestamp * 1000 - appStartTimestampMs;\n }\n\n /**\n * Instruments the app start measurements on the first route transaction.\n * Starts a route transaction if there isn't routing instrumentation.\n */\n private async _instrumentAppStart(): Promise<void> {\n if (!this.options.enableAppStartTracking || !NATIVE.enableNative) {\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n\n if (!appStart) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because native returned null.');\n return;\n }\n\n if (appStart.has_fetched) {\n logger.warn('[ReactNativeTracing] Not instrumenting App Start because this start was already reported.');\n return;\n }\n\n if (!this.useAppStartWithProfiler) {\n logger.warn('[ReactNativeTracing] `Sentry.wrap` not detected, using JS context init as app start end.');\n this._appStartFinishTimestamp = getTimeOriginMilliseconds() / 1000;\n }\n\n if (this.options.routingInstrumentation) {\n this._awaitingAppStartData = appStart;\n } else {\n const idleTransaction = this._createRouteTransaction({\n name: 'App Start',\n op: UI_LOAD,\n });\n\n if (idleTransaction) {\n this._addAppStartData(idleTransaction, appStart);\n }\n }\n }\n\n /**\n * Adds app start measurements and starts a child span on a transaction.\n */\n private _addAppStartData(transaction: IdleTransaction, appStart: NativeAppStartResponse): void {\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartDurationMilliseconds = this._getAppStartDurationMilliseconds(appStartTimestampMs);\n if (!appStartDurationMilliseconds) {\n logger.warn('[ReactNativeTracing] App start end has not been recorded, not adding app start span.');\n return;\n }\n\n // we filter out app start more than 60s.\n // this could be due to many different reasons.\n // we've seen app starts with hours, days and even months.\n if (appStartDurationMilliseconds >= ReactNativeTracing._maxAppStart) {\n logger.warn('[ReactNativeTracing] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n const appStartTimeSeconds = appStartTimestampMs / 1000;\n\n transaction.startTimestamp = appStartTimeSeconds;\n\n const maybeTtidSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = transaction.spanRecorder?.spans.find(span => span.op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.startTimestamp = appStartTimeSeconds;\n setSpanDurationAsMeasurement('time_to_full_display', maybeTtfdSpan);\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpan = transaction.startChild({\n description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',\n op,\n startTimestamp: appStartTimeSeconds,\n endTimestamp: this._appStartFinishTimestamp,\n });\n this._addJSExecutionBeforeRoot(appStartSpan);\n this._addNativeSpansTo(appStartSpan, appStart.spans);\n\n const measurement = appStart.type === 'cold' ? APP_START_COLD : APP_START_WARM;\n transaction.setMeasurement(measurement, appStartDurationMilliseconds, 'millisecond');\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 */\n private _addJSExecutionBeforeRoot(appStartSpan: Span): void {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return;\n }\n\n if (!this._firstConstructorCallTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n appStartSpan.startChild({\n description: 'JS Bundle Execution Start',\n op: appStartSpan.op,\n startTimestamp: bundleStartTimestampMs / 1000,\n endTimestamp: bundleStartTimestampMs / 1000,\n });\n return;\n }\n\n appStartSpan.startChild({\n description: 'JS Bundle Execution Before React Root',\n op: appStartSpan.op,\n startTimestamp: bundleStartTimestampMs / 1000,\n endTimestamp: this._firstConstructorCallTimestampMs / 1000,\n });\n }\n\n /**\n * Adds native spans to the app start span.\n */\n private _addNativeSpansTo(appStartSpan: Span, nativeSpans: NativeAppStartResponse['spans']): void {\n nativeSpans.forEach(span => {\n if (span.description === 'UIKit init') {\n return this._createUIKitSpan(appStartSpan, span);\n }\n\n appStartSpan.startChild({\n op: appStartSpan.op,\n description: span.description,\n startTimestamp: span.start_timestamp_ms / 1000,\n endTimestamp: 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 */\n private _createUIKitSpan(parentSpan: Span, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): void {\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 parentSpan.startChild({\n op: parentSpan.op,\n description: 'UIKit Init to JS Exec Start',\n startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n endTimestamp: bundleStart / 1000,\n });\n } else {\n parentSpan.startChild({\n op: parentSpan.op,\n description: 'UIKit Init',\n startTimestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n endTimestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n });\n }\n }\n\n /** To be called when the route changes, but BEFORE the components of the new route mount. */\n private _onRouteWillChange(context: TransactionContext): TransactionType | undefined {\n return this._createRouteTransaction(context);\n }\n\n /**\n * Creates a breadcrumb and sets the current route as a tag.\n */\n private _onConfirmRoute(context: TransactionContext): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._currentRoute = context.data?.route?.name;\n\n this._getCurrentHub?.().configureScope(scope => {\n if (context.data) {\n const contextData = context.data as RouteChangeContextData;\n\n scope.addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n // We assume that context.name is the name of the route.\n message: `Navigation to ${context.name}`,\n data: {\n from: contextData.previousRoute?.name,\n to: contextData.route.name,\n },\n });\n }\n\n this._currentViewName = context.name;\n /**\n * @deprecated tag routing.route.name will be removed in the future.\n */\n scope.setTag('routing.route.name', context.name);\n });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): IdleTransaction | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[ReactNativeTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n if (this._inflightInteractionTransaction) {\n logger.log(\n `[ReactNativeTracing] Canceling ${this._inflightInteractionTransaction.op} transaction because navigation ${context.op}.`,\n );\n this._inflightInteractionTransaction.setStatus('cancelled');\n this._inflightInteractionTransaction.finish();\n }\n\n const { finalTimeoutMs } = this.options;\n\n const expandedContext = {\n ...context,\n trimEnd: true,\n };\n\n const idleTransaction = this._startIdleTransaction(expandedContext);\n\n this.onTransactionStart(idleTransaction);\n\n logger.log(`[ReactNativeTracing] Starting ${context.op} transaction \"${context.name}\" on scope`);\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this.onTransactionFinish(transaction, endTimestamp);\n });\n\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (this.options.enableAppStartTracking && this._awaitingAppStartData) {\n transaction.op = UI_LOAD;\n this._addAppStartData(transaction, this._awaitingAppStartData);\n\n this._awaitingAppStartData = undefined;\n }\n });\n\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n adjustTransactionDuration(finalTimeoutMs, transaction, endTimestamp);\n });\n\n if (this.options.ignoreEmptyBackNavigationTransactions) {\n idleTransaction.registerBeforeFinishCallback(transaction => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n transaction.data?.route?.hasBeenSeen &&\n (!transaction.spanRecorder ||\n transaction.spanRecorder.spans.filter(\n span =>\n span.spanId !== transaction.spanId &&\n span.op !== 'ui.load.initial_display' &&\n span.op !== 'navigation.processing',\n ).length === 0)\n ) {\n logger.log(\n '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.',\n );\n // Route has been seen before and has no child spans.\n transaction.sampled = false;\n }\n });\n }\n\n return idleTransaction;\n }\n\n /**\n * Start app state aware idle transaction on the scope.\n */\n private _startIdleTransaction(context: TransactionContext): IdleTransaction {\n const { idleTimeoutMs, finalTimeoutMs } = this.options;\n const hub = this._getCurrentHub?.() || getCurrentHub();\n const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);\n cancelInBackground(tx);\n return tx;\n }\n}\n"]}
|
|
@@ -29,4 +29,10 @@ export declare function isNearToNow(timestamp: number): boolean;
|
|
|
29
29
|
* Uses `setMeasurement` function from @sentry/core.
|
|
30
30
|
*/
|
|
31
31
|
export declare function setSpanDurationAsMeasurement(name: string, span: Span): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns unix timestamp in ms of the bundle start time.
|
|
34
|
+
*
|
|
35
|
+
* If not available, returns undefined.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getBundleStartTimestampMs(): number | undefined;
|
|
32
38
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,IAAI,IAAI,SAAS,EACtB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,IAAI,IAAI,SAAS,EACtB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKjF,eAAO,MAAM,wBAAwB,EAAE,iBAA+B,CAAC;AACvE,eAAO,MAAM,uBAAuB,EAAE,iBAA4B,CAAC;AAEnE,eAAO,MAAM,0BAA0B,SAAU,MAAM,KAAG,kBAYzD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAI5C;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,MAAM,GACnB,IAAI,CAON;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,GACzD,IAAI,CA2BN;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAQ3E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,SAAS,CAe9D"}
|
package/dist/js/tracing/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { setMeasurement, spanToJSON, } from '@sentry/core';
|
|
2
|
-
import { timestampInSeconds } from '@sentry/utils';
|
|
2
|
+
import { logger, timestampInSeconds } from '@sentry/utils';
|
|
3
|
+
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
3
4
|
export const defaultTransactionSource = 'component';
|
|
4
5
|
export const customTransactionSource = 'custom';
|
|
5
6
|
export const getBlankTransactionContext = (name) => {
|
|
@@ -80,4 +81,23 @@ export function setSpanDurationAsMeasurement(name, span) {
|
|
|
80
81
|
}
|
|
81
82
|
setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');
|
|
82
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns unix timestamp in ms of the bundle start time.
|
|
86
|
+
*
|
|
87
|
+
* If not available, returns undefined.
|
|
88
|
+
*/
|
|
89
|
+
export function getBundleStartTimestampMs() {
|
|
90
|
+
const bundleStartTime = RN_GLOBAL_OBJ.__BUNDLE_START_TIME__;
|
|
91
|
+
if (!bundleStartTime) {
|
|
92
|
+
logger.warn('Missing the bundle start time on the global object.');
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
if (!RN_GLOBAL_OBJ.nativePerformanceNow) {
|
|
96
|
+
// bundleStartTime is Date.now() in milliseconds
|
|
97
|
+
return bundleStartTime;
|
|
98
|
+
}
|
|
99
|
+
// nativePerformanceNow() is monotonic clock like performance.now()
|
|
100
|
+
const approxStartingTimeOrigin = Date.now() - RN_GLOBAL_OBJ.nativePerformanceNow();
|
|
101
|
+
return approxStartingTimeOrigin + bundleStartTime;
|
|
102
|
+
}
|
|
83
103
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,cAAc,EACd,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAsB,WAAW,CAAC;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAsB,QAAQ,CAAC;AAEnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAY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I,CAAC,MAAM,GAAG,CAAC,YAAqB,EAAE,EAAE;gBACtC,kBAAkB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;gBAE/C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC/B,CAAC,CAAC;YAEF,6DAA6D;YAC7D,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC;YAEjC,IAAI,CAAC,GAAG,GAAG,CAAC,YAAqB,EAAE,EAAE;gBACnC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;gBAE5C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC/B,CAAC,CAAC;QACJ,CAAC,CAAC;KACH;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,SAAS,CAAC,IAAI,uBAAuB,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAY,EAAE,IAAU;IACnE,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;IAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC;IACnD,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE;QAC1B,OAAO;KACR;IAED,cAAc,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import {\n type IdleTransaction,\n type Span as SpanClass,\n type Transaction,\n setMeasurement,\n spanToJSON,\n} from '@sentry/core';\nimport type { Span, TransactionContext, TransactionSource } from '@sentry/types';\nimport { timestampInSeconds } from '@sentry/utils';\n\nexport const defaultTransactionSource: TransactionSource = 'component';\nexport const customTransactionSource: TransactionSource = 'custom';\n\nexport const getBlankTransactionContext = (name: string): TransactionContext => {\n return {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': name,\n },\n data: {},\n metadata: {\n source: defaultTransactionSource,\n },\n };\n};\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nexport const MARGIN_OF_ERROR_SECONDS = 0.05;\n\nconst timeOriginMilliseconds = Date.now();\n\n/**\n *\n */\nexport function adjustTransactionDuration(\n maxDurationMs: number,\n transaction: IdleTransaction,\n endTimestamp: number,\n): void {\n const diff = endTimestamp - transaction.startTimestamp;\n const isOutdatedTransaction = endTimestamp && (diff > maxDurationMs || diff < 0);\n if (isOutdatedTransaction) {\n transaction.setStatus('deadline_exceeded');\n transaction.setTag('maxTransactionDurationExceeded', 'true');\n }\n}\n\n/**\n * Returns the timestamp where the JS global scope was initialized.\n */\nexport function getTimeOriginMilliseconds(): number {\n return timeOriginMilliseconds;\n}\n\n/**\n * Calls the callback every time a child span of the transaction is finished.\n */\nexport function instrumentChildSpanFinish(\n transaction: Transaction,\n callback: (span: SpanClass, endTimestamp?: number) => void,\n): void {\n if (transaction.spanRecorder) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalAdd = transaction.spanRecorder.add;\n\n transaction.spanRecorder.add = (span: SpanClass): void => {\n originalAdd.apply(transaction.spanRecorder, [span]);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanFinish = span.finish;\n\n span.finish = (endTimestamp?: number) => {\n originalSpanFinish.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanEnd = span.end;\n\n span.end = (endTimestamp?: number) => {\n originalSpanEnd.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n };\n }\n}\n\n/**\n * Determines if the timestamp is now or within the specified margin of error from now.\n */\nexport function isNearToNow(timestamp: number): boolean {\n return Math.abs(timestampInSeconds() - timestamp) <= MARGIN_OF_ERROR_SECONDS;\n}\n\n/**\n * Sets the duration of the span as a measurement.\n * Uses `setMeasurement` function from @sentry/core.\n */\nexport function setSpanDurationAsMeasurement(name: string, span: Span): void {\n const spanEnd = spanToJSON(span).timestamp;\n const spanStart = spanToJSON(span).start_timestamp;\n if (!spanEnd || !spanStart) {\n return;\n }\n\n setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,cAAc,EACd,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAsB,WAAW,CAAC;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAsB,QAAQ,CAAC;AAEnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAsB,EAAE;IAC7E,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE;YACJ,yBAAyB,EAAE,IAAI;SAChC;QACD,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE;YACR,MAAM,EAAE,wBAAwB;SACjC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,sBAAsB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAE1C;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,aAAqB,EACrB,WAA4B,EAC5B,YAAoB;IAEpB,MAAM,IAAI,GAAG,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC;IACvD,MAAM,qBAAqB,GAAG,YAAY,IAAI,CAAC,IAAI,GAAG,aA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AO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,SAAS,CAAC,IAAI,uBAAuB,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAY,EAAE,IAAU;IACnE,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;IAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC;IACnD,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE;QAC1B,OAAO;KACR;IAED,cAAc,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,eAAe,GAAG,aAAa,CAAC,qBAAqB,CAAC;IAC5D,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QACnE,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;QACvC,gDAAgD;QAChD,OAAO,eAAe,CAAC;KACxB;IAED,mEAAmE;IACnE,MAAM,wBAAwB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,oBAAoB,EAAE,CAAC;IACnF,OAAO,wBAAwB,GAAG,eAAe,CAAC;AACpD,CAAC","sourcesContent":["import {\n type IdleTransaction,\n type Span as SpanClass,\n type Transaction,\n setMeasurement,\n spanToJSON,\n} from '@sentry/core';\nimport type { Span, TransactionContext, TransactionSource } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\n\nexport const defaultTransactionSource: TransactionSource = 'component';\nexport const customTransactionSource: TransactionSource = 'custom';\n\nexport const getBlankTransactionContext = (name: string): TransactionContext => {\n return {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': name,\n },\n data: {},\n metadata: {\n source: defaultTransactionSource,\n },\n };\n};\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nexport const MARGIN_OF_ERROR_SECONDS = 0.05;\n\nconst timeOriginMilliseconds = Date.now();\n\n/**\n *\n */\nexport function adjustTransactionDuration(\n maxDurationMs: number,\n transaction: IdleTransaction,\n endTimestamp: number,\n): void {\n const diff = endTimestamp - transaction.startTimestamp;\n const isOutdatedTransaction = endTimestamp && (diff > maxDurationMs || diff < 0);\n if (isOutdatedTransaction) {\n transaction.setStatus('deadline_exceeded');\n transaction.setTag('maxTransactionDurationExceeded', 'true');\n }\n}\n\n/**\n * Returns the timestamp where the JS global scope was initialized.\n */\nexport function getTimeOriginMilliseconds(): number {\n return timeOriginMilliseconds;\n}\n\n/**\n * Calls the callback every time a child span of the transaction is finished.\n */\nexport function instrumentChildSpanFinish(\n transaction: Transaction,\n callback: (span: SpanClass, endTimestamp?: number) => void,\n): void {\n if (transaction.spanRecorder) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalAdd = transaction.spanRecorder.add;\n\n transaction.spanRecorder.add = (span: SpanClass): void => {\n originalAdd.apply(transaction.spanRecorder, [span]);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanFinish = span.finish;\n\n span.finish = (endTimestamp?: number) => {\n originalSpanFinish.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanEnd = span.end;\n\n span.end = (endTimestamp?: number) => {\n originalSpanEnd.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n };\n }\n}\n\n/**\n * Determines if the timestamp is now or within the specified margin of error from now.\n */\nexport function isNearToNow(timestamp: number): boolean {\n return Math.abs(timestampInSeconds() - timestamp) <= MARGIN_OF_ERROR_SECONDS;\n}\n\n/**\n * Sets the duration of the span as a measurement.\n * Uses `setMeasurement` function from @sentry/core.\n */\nexport function setSpanDurationAsMeasurement(name: string, span: Span): void {\n const spanEnd = spanToJSON(span).timestamp;\n const spanStart = spanToJSON(span).start_timestamp;\n if (!spanEnd || !spanStart) {\n return;\n }\n\n setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');\n}\n\n/**\n * Returns unix timestamp in ms of the bundle start time.\n *\n * If not available, returns undefined.\n */\nexport function getBundleStartTimestampMs(): number | undefined {\n const bundleStartTime = RN_GLOBAL_OBJ.__BUNDLE_START_TIME__;\n if (!bundleStartTime) {\n logger.warn('Missing the bundle start time on the global object.');\n return undefined;\n }\n\n if (!RN_GLOBAL_OBJ.nativePerformanceNow) {\n // bundleStartTime is Date.now() in milliseconds\n return bundleStartTime;\n }\n\n // nativePerformanceNow() is monotonic clock like performance.now()\n const approxStartingTimeOrigin = Date.now() - RN_GLOBAL_OBJ.nativePerformanceNow();\n return approxStartingTimeOrigin + bundleStartTime;\n}\n"]}
|
|
@@ -20,6 +20,8 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
|
20
20
|
___SENTRY_METRO_DEV_SERVER___?: string;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
__BUNDLE_START_TIME__?: number;
|
|
24
|
+
nativePerformanceNow?: () => number;
|
|
23
25
|
}
|
|
24
26
|
/** Get's the global object for the current JavaScript runtime */
|
|
25
27
|
export declare const RN_GLOBAL_OBJ: ReactNativeInternalGlobal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worldwide.d.ts","sourceRoot":"","sources":["../../../src/js/utils/worldwide.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,kFAAkF;AAClF,MAAM,WAAW,yBAA0B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,CAAC,EAAE,OAAO,cAAc,CAAC;IACvC,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE;YACJ,6BAA6B,CAAC,EAAE,MAAM,CAAC;SACxC,CAAC;KACH,CAAC;IACF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,MAAM,CAAC;CACrC;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,2BAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worldwide.js","sourceRoot":"","sources":["../../../src/js/utils/worldwide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"worldwide.js","sourceRoot":"","sources":["../../../src/js/utils/worldwide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2B3C,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,UAAuC,CAAC","sourcesContent":["import type { InternalGlobal } from '@sentry/utils';\nimport { GLOBAL_OBJ } from '@sentry/utils';\nimport type { ErrorUtils } from 'react-native/types';\n\nimport type { ExpoGlobalObject } from './expoglobalobject';\n\n/** Internal Global object interface with common and Sentry specific properties */\nexport interface ReactNativeInternalGlobal extends InternalGlobal {\n __sentry_rn_v4_registered?: boolean;\n __sentry_rn_v5_registered?: boolean;\n HermesInternal?: {\n getRuntimeProperties?: () => Record<string, string | undefined>;\n };\n Promise: unknown;\n __turboModuleProxy: unknown;\n nativeFabricUIManager: unknown;\n ErrorUtils?: ErrorUtils;\n expo?: ExpoGlobalObject;\n XMLHttpRequest?: typeof XMLHttpRequest;\n process?: {\n env?: {\n ___SENTRY_METRO_DEV_SERVER___?: string;\n };\n };\n __BUNDLE_START_TIME__?: number;\n nativePerformanceNow?: () => number;\n}\n\n/** Get's the global object for the current JavaScript runtime */\nexport const RN_GLOBAL_OBJ = GLOBAL_OBJ as ReactNativeInternalGlobal;\n"]}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.24.0';\n"]}
|
package/ios/RNSentry.mm
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
@end
|
|
57
57
|
|
|
58
|
-
static bool
|
|
58
|
+
static bool hasFetchedAppStart;
|
|
59
59
|
|
|
60
60
|
static NSString* const nativeSdkName = @"sentry.cocoa.react-native";
|
|
61
61
|
|
|
@@ -380,24 +380,20 @@ RCT_EXPORT_METHOD(fetchNativeAppStart:(RCTPromiseResolveBlock)resolve
|
|
|
380
380
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
381
381
|
{
|
|
382
382
|
#if SENTRY_HAS_UIKIT
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
if (appStartMeasurement == nil) {
|
|
383
|
+
NSDictionary<NSString *, id> *measurements = [PrivateSentrySDKOnly appStartMeasurementWithSpans];
|
|
384
|
+
if (measurements == nil) {
|
|
386
385
|
resolve(nil);
|
|
387
|
-
|
|
388
|
-
BOOL isColdStart = appStartMeasurement.type == SentryAppStartTypeCold;
|
|
389
|
-
|
|
390
|
-
resolve(@{
|
|
391
|
-
@"isColdStart": [NSNumber numberWithBool:isColdStart],
|
|
392
|
-
@"appStartTime": [NSNumber numberWithDouble:(appStartMeasurement.appStartTimestamp.timeIntervalSince1970 * 1000)],
|
|
393
|
-
@"didFetchAppStart": [NSNumber numberWithBool:didFetchAppStart],
|
|
394
|
-
});
|
|
395
|
-
|
|
386
|
+
return;
|
|
396
387
|
}
|
|
397
388
|
|
|
389
|
+
NSMutableDictionary<NSString *, id> *mutableMeasurements = [[NSMutableDictionary alloc] initWithDictionary:measurements];
|
|
390
|
+
[mutableMeasurements setValue:[NSNumber numberWithBool:hasFetchedAppStart] forKey:@"has_fetched"];
|
|
391
|
+
|
|
398
392
|
// This is always set to true, as we would only allow an app start fetch to only happen once
|
|
399
393
|
// in the case of a JS bundle reload, we do not want it to be instrumented again.
|
|
400
|
-
|
|
394
|
+
hasFetchedAppStart = true;
|
|
395
|
+
|
|
396
|
+
resolve(mutableMeasurements);
|
|
401
397
|
#else
|
|
402
398
|
resolve(nil);
|
|
403
399
|
#endif
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.24.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
"react-native": ">=0.65.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@sentry/browser": "7.
|
|
70
|
+
"@sentry/browser": "7.117.0",
|
|
71
71
|
"@sentry/cli": "2.31.2",
|
|
72
|
-
"@sentry/core": "7.
|
|
73
|
-
"@sentry/hub": "7.
|
|
74
|
-
"@sentry/integrations": "7.
|
|
75
|
-
"@sentry/react": "7.
|
|
76
|
-
"@sentry/types": "7.
|
|
77
|
-
"@sentry/utils": "7.
|
|
72
|
+
"@sentry/core": "7.117.0",
|
|
73
|
+
"@sentry/hub": "7.117.0",
|
|
74
|
+
"@sentry/integrations": "7.117.0",
|
|
75
|
+
"@sentry/react": "7.117.0",
|
|
76
|
+
"@sentry/types": "7.117.0",
|
|
77
|
+
"@sentry/utils": "7.117.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/core": "^7.23.5",
|
|
81
81
|
"@expo/metro-config": "0.17.5",
|
|
82
82
|
"@mswjs/interceptors": "^0.25.15",
|
|
83
|
-
"@sentry-internal/eslint-config-sdk": "7.
|
|
84
|
-
"@sentry-internal/eslint-plugin-sdk": "7.
|
|
85
|
-
"@sentry-internal/typescript": "7.
|
|
83
|
+
"@sentry-internal/eslint-config-sdk": "7.117.0",
|
|
84
|
+
"@sentry-internal/eslint-plugin-sdk": "7.117.0",
|
|
85
|
+
"@sentry-internal/typescript": "7.117.0",
|
|
86
86
|
"@sentry/wizard": "3.16.3",
|
|
87
87
|
"@types/jest": "^29.5.3",
|
|
88
88
|
"@types/node": "^20.9.3",
|
|
@@ -35,5 +35,14 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then
|
|
|
35
35
|
elif echo "$XCODE_BUILD_CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug"
|
|
36
36
|
echo "Skipping debug files upload for *Debug* configuration"
|
|
37
37
|
else
|
|
38
|
-
|
|
38
|
+
# 'warning:' triggers a warning in Xcode, 'error:' triggers an error
|
|
39
|
+
set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
|
|
40
|
+
SENTRY_UPLOAD_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES" 2>&1)
|
|
41
|
+
if [ $? -eq 0 ]; then
|
|
42
|
+
echo "$SENTRY_UPLOAD_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
|
|
43
|
+
else
|
|
44
|
+
echo "error: sentry-cli - To disable native debug files auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
|
|
45
|
+
echo "error: sentry-cli - $SENTRY_UPLOAD_COMMAND_OUTPUT"
|
|
46
|
+
fi
|
|
47
|
+
set -x -e # re-enable
|
|
39
48
|
fi
|
package/scripts/sentry-xcode.sh
CHANGED
|
@@ -23,7 +23,16 @@ ARGS="$NO_AUTO_RELEASE $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS"
|
|
|
23
23
|
REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $ARGS \"$REACT_NATIVE_XCODE\""
|
|
24
24
|
|
|
25
25
|
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
|
|
26
|
-
|
|
26
|
+
# 'warning:' triggers a warning in Xcode, 'error:' triggers an error
|
|
27
|
+
set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
|
|
28
|
+
SENTRY_XCODE_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY" 2>&1)
|
|
29
|
+
if [ $? -eq 0 ]; then
|
|
30
|
+
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
|
|
31
|
+
else
|
|
32
|
+
echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
|
|
33
|
+
echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
|
|
34
|
+
fi
|
|
35
|
+
set -x -e # re-enable
|
|
27
36
|
else
|
|
28
37
|
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload"
|
|
29
38
|
/bin/sh -c "$REACT_NATIVE_XCODE"
|