@nativescript-community/sentry 4.6.22 → 4.6.24
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/breadcrumb.d.ts +1 -1
- package/breadcrumb.js.map +1 -1
- package/client.d.ts +23 -23
- package/client.js +36 -40
- package/client.js.map +1 -1
- package/index.d.ts +7 -7
- package/index.js +6 -6
- package/index.js.map +1 -1
- package/integrations/debugsymbolicator.d.ts +4 -4
- package/integrations/debugsymbolicator.js +13 -11
- package/integrations/debugsymbolicator.js.map +1 -1
- package/integrations/default.js +1 -2
- package/integrations/default.js.map +1 -1
- package/integrations/devicecontext.js +11 -11
- package/integrations/devicecontext.js.map +1 -1
- package/integrations/eventorigin.js +1 -2
- package/integrations/eventorigin.js.map +1 -1
- package/integrations/factory.js.map +1 -1
- package/integrations/index.js.map +1 -1
- package/integrations/nativescripterrorhandlers.d.ts +8 -8
- package/integrations/nativescripterrorhandlers.js +7 -3
- package/integrations/nativescripterrorhandlers.js.map +1 -1
- package/integrations/release.js +5 -6
- package/integrations/release.js.map +1 -1
- package/integrations/rewriteframe.js.map +1 -1
- package/integrations/screenshot.d.ts +8 -8
- package/integrations/screenshot.js +10 -13
- package/integrations/screenshot.js.map +1 -1
- package/integrations/sdkinfo.d.ts +7 -7
- package/integrations/sdkinfo.js +15 -16
- package/integrations/sdkinfo.js.map +1 -1
- package/measurements.js.map +1 -1
- package/misc.d.ts +4 -4
- package/misc.js +5 -8
- package/misc.js.map +1 -1
- package/options.d.ts +66 -62
- package/options.js.map +1 -1
- package/package.json +2 -2
- package/platforms/android/buildscript.gradle +1 -1
- package/platforms/android/include.gradle +1 -1
- package/platforms/android/native-api-usage.json +6 -0
- package/process.js.map +1 -1
- package/references.d.ts +6 -0
- package/scope.js.map +1 -1
- package/sdk.d.ts +3 -3
- package/sdk.js +25 -18
- package/sdk.js.map +1 -1
- package/tracing/addTracingExtensions.d.ts +1 -1
- package/tracing/addTracingExtensions.js +6 -4
- package/tracing/addTracingExtensions.js.map +1 -1
- package/tracing/index.js.map +1 -1
- package/tracing/nativeframes.d.ts +22 -22
- package/tracing/nativeframes.js +30 -34
- package/tracing/nativeframes.js.map +1 -1
- package/tracing/nstracing.d.ts +1 -1
- package/tracing/nstracing.js +42 -26
- package/tracing/nstracing.js.map +1 -1
- package/tracing/ops.js.map +1 -1
- package/tracing/routingInstrumentation.d.ts +2 -2
- package/tracing/routingInstrumentation.js +3 -5
- package/tracing/routingInstrumentation.js.map +1 -1
- package/tracing/stalltracking.js +16 -9
- package/tracing/stalltracking.js.map +1 -1
- package/tracing/transaction.js.map +1 -1
- package/tracing/types.d.ts +1 -1
- package/tracing/types.js.map +1 -1
- package/tracing/utils.js.map +1 -1
- package/transports/TextEncoder.js.map +1 -1
- package/transports/native.d.ts +1 -1
- package/transports/native.js.map +1 -1
- package/typings/android.d.ts +10738 -0
- package/typings/ios.d.ts +2255 -0
- package/typings/ns.ios.d.ts +25 -0
- package/utils/envelope.js +9 -4
- package/utils/envelope.js.map +1 -1
- package/utils/environment.js.map +1 -1
- package/utils/outcome.js.map +1 -1
- package/utils/safe.d.ts +1 -1
- package/utils/safe.js.map +1 -1
- package/vendor/buffer/index.js.map +1 -1
- package/vendor/buffer/utf8ToBytes.js.map +1 -1
- package/vendor/index.js.map +1 -1
- package/version.js.map +1 -1
- package/wrapper.android.d.ts +5 -2
- package/wrapper.android.js +121 -78
- package/wrapper.android.js.map +1 -1
- package/wrapper.d.ts +2 -4
- package/wrapper.ios.d.ts +3 -3
- package/wrapper.ios.js +48 -44
- package/wrapper.ios.js.map +1 -1
package/scope.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/sentry/scope.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,MAAM,OAAO,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;;AAEnD,uBAAu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eedback(feedback: UserFeedback): void;
|
|
47
47
|
*/
|
48
48
|
export declare function withScope(callback: (scope: Scope) => void): ReturnType<Hub['withScope']>;
|
49
49
|
/**
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
* Callback to set context information onto the scope.
|
51
|
+
* @param callback Callback function that receives Scope.
|
52
|
+
*/
|
53
53
|
export declare function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']>;
|
package/sdk.js
CHANGED
@@ -56,7 +56,7 @@ const DEFAULT_OPTIONS = {
|
|
56
56
|
enableOutOfMemoryTracking: true,
|
57
57
|
patchGlobalPromise: true,
|
58
58
|
transportOptions: {
|
59
|
-
textEncoder: makeUtf8TextEncoder()
|
59
|
+
textEncoder: makeUtf8TextEncoder()
|
60
60
|
},
|
61
61
|
sendClientReports: true,
|
62
62
|
maxQueueSize: DEFAULT_BUFFER_SIZE,
|
@@ -66,16 +66,27 @@ const DEFAULT_OPTIONS = {
|
|
66
66
|
* Inits the SDK
|
67
67
|
*/
|
68
68
|
export function init(passedOptions) {
|
69
|
-
var _a, _b, _c, _d;
|
70
69
|
const NativescriptHub = new Hub(undefined, new Scope());
|
71
70
|
// const NativescriptHub = new Hub(undefined, new NativescriptScope());
|
72
71
|
makeMain(NativescriptHub);
|
73
|
-
const maxQueueSize =
|
74
|
-
const options =
|
72
|
+
const maxQueueSize = passedOptions.maxQueueSize ?? passedOptions.transportOptions?.bufferSize ?? DEFAULT_OPTIONS.maxQueueSize;
|
73
|
+
const options = {
|
74
|
+
...DEFAULT_OPTIONS,
|
75
|
+
...passedOptions,
|
75
76
|
// If custom transport factory fails the SDK won't initialize
|
76
|
-
transport: passedOptions.transport || makeNativescriptTransport,
|
77
|
+
transport: passedOptions.transport || makeNativescriptTransport,
|
78
|
+
transportOptions: {
|
79
|
+
...DEFAULT_OPTIONS.transportOptions,
|
80
|
+
...(passedOptions.transportOptions ?? {}),
|
81
|
+
bufferSize: maxQueueSize
|
82
|
+
},
|
83
|
+
maxQueueSize,
|
84
|
+
integrations: [],
|
77
85
|
// integrations: getIntegrationsToSetup(passedOptions),
|
78
|
-
stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),
|
86
|
+
stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),
|
87
|
+
beforeBreadcrumb: safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' }),
|
88
|
+
initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' })
|
89
|
+
};
|
79
90
|
if ('tracesSampler' in options) {
|
80
91
|
options.tracesSampler = safeTracesSampler(options.tracesSampler);
|
81
92
|
}
|
@@ -83,12 +94,9 @@ export function init(passedOptions) {
|
|
83
94
|
options.environment = getDefaultEnvironment();
|
84
95
|
}
|
85
96
|
// As long as tracing is opt in with either one of these options, then this is how we determine tracing is enabled.
|
86
|
-
const tracingEnabled = typeof options.tracesSampler !== 'undefined' ||
|
87
|
-
typeof options.tracesSampleRate !== 'undefined';
|
97
|
+
const tracingEnabled = typeof options.tracesSampler !== 'undefined' || typeof options.tracesSampleRate !== 'undefined';
|
88
98
|
const DEFAULT_INTEGRATIONS = getDefaultIntegrations(options);
|
89
|
-
const defaultIntegrations = passedOptions.defaultIntegrations === undefined
|
90
|
-
? DEFAULT_INTEGRATIONS
|
91
|
-
: passedOptions.defaultIntegrations;
|
99
|
+
const defaultIntegrations = passedOptions.defaultIntegrations === undefined ? DEFAULT_INTEGRATIONS : passedOptions.defaultIntegrations;
|
92
100
|
// if (passedOptions.defaultIntegrations === undefined) {
|
93
101
|
// rewriteFrameIntegration = new RewriteFrames({
|
94
102
|
// iteratee: (frame: StackFrame) => {
|
@@ -143,7 +151,7 @@ export function init(passedOptions) {
|
|
143
151
|
// }
|
144
152
|
options.integrations = getIntegrationsToSetup({
|
145
153
|
integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),
|
146
|
-
defaultIntegrations
|
154
|
+
defaultIntegrations
|
147
155
|
});
|
148
156
|
initAndBind(NativescriptClient, options);
|
149
157
|
}
|
@@ -205,8 +213,7 @@ export async function close() {
|
|
205
213
|
* Captures user feedback and sends it to Sentry.
|
206
214
|
*/
|
207
215
|
export function captureUserFeedback(feedback) {
|
208
|
-
|
209
|
-
(_a = getCurrentHub().getClient()) === null || _a === void 0 ? void 0 : _a.captureUserFeedback(feedback);
|
216
|
+
getCurrentHub().getClient()?.captureUserFeedback(feedback);
|
210
217
|
}
|
211
218
|
/**
|
212
219
|
* Creates a new scope with and executes the given operation within.
|
@@ -224,7 +231,7 @@ export function captureUserFeedback(feedback) {
|
|
224
231
|
export function withScope(callback) {
|
225
232
|
const safeCallback = (scope) => {
|
226
233
|
try {
|
227
|
-
NATIVE.withScope(nscope => {
|
234
|
+
NATIVE.withScope((nscope) => {
|
228
235
|
callback(scope);
|
229
236
|
});
|
230
237
|
}
|
@@ -235,9 +242,9 @@ export function withScope(callback) {
|
|
235
242
|
return getCurrentHub().withScope(safeCallback);
|
236
243
|
}
|
237
244
|
/**
|
238
|
-
|
239
|
-
|
240
|
-
|
245
|
+
* Callback to set context information onto the scope.
|
246
|
+
* @param callback Callback function that receives Scope.
|
247
|
+
*/
|
241
248
|
export function configureScope(callback) {
|
242
249
|
const safeCallback = (scope) => {
|
243
250
|
try {
|
package/sdk.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sentry/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAoD,MAAM,iBAAiB,CAAC;AAChH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGnG,OAAO,EAAE,MAAM,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAI1E,OAAO,EAAE,kBAAkB,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B;KACJ;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;AACL,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAsB;IACtD,aAAa,EAAE,CAAC,SAAS,EAAsB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgC;IACtD,MAAM,YAAY,GAAG,CAAC,KAAY,EAAQ,EAAE;QACxC,IAAI;YACA,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;gBACxB,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC,CAAC,CAAC;SACN;QAAC,OAAO,CAAC,EAAE;YACR,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;SAC7D;IACL,CAAC,CAAC;IACF,OAAO,aAAa,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgC;IAC3D,MAAM,YAAY,GAAG,CAAC,KAAY,EAAQ,EAAE;QACxC,IAAI;YACA,QAAQ,CAAC,KAAK,CAAC,CAAC;SACnB;QAAC,OAAO,CAAC,EAAE;YACR,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;SAClE;IACL,CAAC,CAAC;IACF,aAAa,EAAE,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AACjD,CAAC"}
|
@@ -4,4 +4,4 @@ import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
|
|
4
4
|
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
5
5
|
*/
|
6
6
|
export declare function _addTracingExtensions(): void;
|
7
|
-
export
|
7
|
+
export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// eslint-disable-next-line no-duplicate-imports
|
2
2
|
import { addTracingExtensions, getCurrentHub, getMainCarrier } from '@sentry/core';
|
3
|
-
import { NativescriptTracing } from '
|
4
|
-
import { DEFAULT } from '
|
3
|
+
import { NativescriptTracing } from './nstracing';
|
4
|
+
import { DEFAULT } from './ops';
|
5
5
|
/**
|
6
6
|
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
7
7
|
*/
|
@@ -35,9 +35,11 @@ const _patchStartTransaction = (originalStartTransaction) => {
|
|
35
35
|
}
|
36
36
|
const transaction = originalStartTransaction.apply(this, [transactionContext, customSamplingContext]);
|
37
37
|
const originalStartChild = transaction.startChild.bind(transaction);
|
38
|
-
transaction.startChild = (spanContext) => originalStartChild(
|
38
|
+
transaction.startChild = (spanContext) => originalStartChild({
|
39
|
+
...spanContext,
|
39
40
|
// Native SDKs require op to be set
|
40
|
-
op:
|
41
|
+
op: spanContext?.op || DEFAULT,
|
42
|
+
});
|
41
43
|
const reactNativeTracing = getCurrentHub().getIntegration(NativescriptTracing);
|
42
44
|
if (reactNativeTracing) {
|
43
45
|
reactNativeTracing.onTransactionStart(transaction);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addTracingExtensions.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"addTracingExtensions.js","sourceRoot":"","sources":["../../../src/sentry/tracing/addTracingExtensions.ts"],"names":[],"mappings":"AACA,gDAAgD;AAChD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACjC,oBAAoB,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,UAAU,EAAE;Q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;YAE1C,WAAW,CAAC,MAAM,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACtD,IAAI,kBAAkB,EAAE;oBACpB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;iBACvD;gBAED,OAAO,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC;SACL;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC7B,CAAC,CAAC"}
|
package/tracing/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sentry/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACH,sBAAsB,GAEzB,MAAM,0BAA0B,CAAC;AAElC,WAAW;AACX,sCAAsC;AACtC,0DAA0D;AAC1D,wCAAwC;AACxC,8BAA8B;AAC9B,0EAA0E;AAC1E,mFAAmF;AAEnF,WAAW;AACX,mCAAmC;AACnC,4BAA4B;AAC5B,yCAAyC;AACzC,oBAAoB;AAEpB,gEAAgE"}
|
@@ -6,15 +6,15 @@ export interface NativeFramesResponse {
|
|
6
6
|
frozenFrames: number;
|
7
7
|
}
|
8
8
|
export interface FramesMeasurements extends Measurements {
|
9
|
-
|
9
|
+
frames_total: {
|
10
10
|
value: number;
|
11
11
|
unit: MeasurementUnit;
|
12
12
|
};
|
13
|
-
|
13
|
+
frames_slow: {
|
14
14
|
value: number;
|
15
15
|
unit: MeasurementUnit;
|
16
16
|
};
|
17
|
-
|
17
|
+
frames_frozen: {
|
18
18
|
value: number;
|
19
19
|
unit: MeasurementUnit;
|
20
20
|
};
|
@@ -31,38 +31,38 @@ export declare class NativeFramesInstrumentation {
|
|
31
31
|
private _lastSpanFinishFrames?;
|
32
32
|
constructor(addGlobalEventProcessor: (e: EventProcessor) => void, doesExist: () => boolean);
|
33
33
|
/**
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
* To be called when a transaction is started.
|
35
|
+
* Logs the native frames at this start point and instruments child span finishes.
|
36
|
+
*/
|
37
37
|
onTransactionStart(transaction: Transaction): void;
|
38
38
|
/**
|
39
|
-
|
40
|
-
|
39
|
+
* To be called when a transaction is finished
|
40
|
+
*/
|
41
41
|
onTransactionFinish(transaction: Transaction): void;
|
42
42
|
/**
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
* Called on a span finish to fetch native frames to support transactions with trimEnd.
|
44
|
+
* Only to be called when a span does not have an end timestamp.
|
45
|
+
*/
|
46
46
|
private _onSpanFinish;
|
47
47
|
/**
|
48
|
-
|
49
|
-
|
48
|
+
* Returns the computed frames measurements and awaits for them if they are not ready yet.
|
49
|
+
*/
|
50
50
|
private _getFramesMeasurements;
|
51
51
|
/**
|
52
|
-
|
53
|
-
|
52
|
+
* Returns the computed frames measurements given ready data
|
53
|
+
*/
|
54
54
|
private _prepareMeasurements;
|
55
55
|
/**
|
56
|
-
|
57
|
-
|
56
|
+
* Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.
|
57
|
+
*/
|
58
58
|
private _fetchFramesForTransaction;
|
59
59
|
/**
|
60
|
-
|
61
|
-
|
60
|
+
* On a finish frames failure, we cancel the await.
|
61
|
+
*/
|
62
62
|
private _cancelFinishFrames;
|
63
63
|
/**
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
* Adds frames measurements to an event. Called from a valid event processor.
|
65
|
+
* Awaits for finish frames if needed.
|
66
|
+
*/
|
67
67
|
private _processEvent;
|
68
68
|
}
|
package/tracing/nativeframes.js
CHANGED
@@ -19,9 +19,9 @@ export class NativeFramesInstrumentation {
|
|
19
19
|
addGlobalEventProcessor((event) => this._processEvent(event, doesExist));
|
20
20
|
}
|
21
21
|
/**
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
* To be called when a transaction is started.
|
23
|
+
* Logs the native frames at this start point and instruments child span finishes.
|
24
|
+
*/
|
25
25
|
onTransactionStart(transaction) {
|
26
26
|
void NATIVE.fetchNativeFrames().then((framesMetrics) => {
|
27
27
|
if (framesMetrics) {
|
@@ -35,29 +35,29 @@ export class NativeFramesInstrumentation {
|
|
35
35
|
});
|
36
36
|
}
|
37
37
|
/**
|
38
|
-
|
39
|
-
|
38
|
+
* To be called when a transaction is finished
|
39
|
+
*/
|
40
40
|
onTransactionFinish(transaction) {
|
41
41
|
void this._fetchFramesForTransaction(transaction);
|
42
42
|
}
|
43
43
|
/**
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
* Called on a span finish to fetch native frames to support transactions with trimEnd.
|
45
|
+
* Only to be called when a span does not have an end timestamp.
|
46
|
+
*/
|
47
47
|
_onSpanFinish() {
|
48
48
|
const timestamp = timestampInSeconds();
|
49
49
|
void NATIVE.fetchNativeFrames().then((nativeFrames) => {
|
50
50
|
if (nativeFrames) {
|
51
51
|
this._lastSpanFinishFrames = {
|
52
52
|
timestamp,
|
53
|
-
nativeFrames
|
53
|
+
nativeFrames
|
54
54
|
};
|
55
55
|
}
|
56
56
|
});
|
57
57
|
}
|
58
58
|
/**
|
59
|
-
|
60
|
-
|
59
|
+
* Returns the computed frames measurements and awaits for them if they are not ready yet.
|
60
|
+
*/
|
61
61
|
async _getFramesMeasurements(traceId, finalEndTimestamp, startFrames) {
|
62
62
|
if (this._finishFrames.has(traceId)) {
|
63
63
|
return this._prepareMeasurements(traceId, finalEndTimestamp, startFrames);
|
@@ -75,8 +75,8 @@ export class NativeFramesInstrumentation {
|
|
75
75
|
});
|
76
76
|
}
|
77
77
|
/**
|
78
|
-
|
79
|
-
|
78
|
+
* Returns the computed frames measurements given ready data
|
79
|
+
*/
|
80
80
|
_prepareMeasurements(traceId, finalEndTimestamp, // The actual transaction finish time.
|
81
81
|
startFrames) {
|
82
82
|
let finalFinishFrames;
|
@@ -87,9 +87,7 @@ export class NativeFramesInstrumentation {
|
|
87
87
|
Math.abs(finish.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS) {
|
88
88
|
finalFinishFrames = finish.nativeFrames;
|
89
89
|
}
|
90
|
-
else if (this._lastSpanFinishFrames &&
|
91
|
-
Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) <
|
92
|
-
MARGIN_OF_ERROR_SECONDS) {
|
90
|
+
else if (this._lastSpanFinishFrames && Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS) {
|
93
91
|
// Fallback to the last span finish if it is within the margin of error of the actual finish timestamp.
|
94
92
|
// This should be the case for trimEnd.
|
95
93
|
finalFinishFrames = this._lastSpanFinishFrames.nativeFrames;
|
@@ -109,15 +107,14 @@ export class NativeFramesInstrumentation {
|
|
109
107
|
frames_slow: {
|
110
108
|
value: finalFinishFrames.slowFrames - startFrames.slowFrames,
|
111
109
|
unit: 'none'
|
112
|
-
}
|
110
|
+
}
|
113
111
|
};
|
114
112
|
return measurements;
|
115
113
|
}
|
116
114
|
/**
|
117
|
-
|
118
|
-
|
115
|
+
* Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.
|
116
|
+
*/
|
119
117
|
async _fetchFramesForTransaction(transaction) {
|
120
|
-
var _a;
|
121
118
|
const startFrames = transaction.data.__startFrames;
|
122
119
|
// This timestamp marks when the finish frames were retrieved. It should be pretty close to the transaction finish.
|
123
120
|
const timestamp = timestampInSeconds();
|
@@ -127,14 +124,14 @@ export class NativeFramesInstrumentation {
|
|
127
124
|
}
|
128
125
|
this._finishFrames.set(transaction.traceId, {
|
129
126
|
nativeFrames: finishFrames,
|
130
|
-
timestamp
|
127
|
+
timestamp
|
131
128
|
});
|
132
|
-
|
129
|
+
this._framesListeners.get(transaction.traceId)?.();
|
133
130
|
setTimeout(() => this._cancelFinishFrames(transaction), 2000);
|
134
131
|
}
|
135
132
|
/**
|
136
|
-
|
137
|
-
|
133
|
+
* On a finish frames failure, we cancel the await.
|
134
|
+
*/
|
138
135
|
_cancelFinishFrames(transaction) {
|
139
136
|
if (this._finishFrames.has(transaction.traceId)) {
|
140
137
|
this._finishFrames.delete(transaction.traceId);
|
@@ -142,28 +139,27 @@ export class NativeFramesInstrumentation {
|
|
142
139
|
}
|
143
140
|
}
|
144
141
|
/**
|
145
|
-
|
146
|
-
|
147
|
-
|
142
|
+
* Adds frames measurements to an event. Called from a valid event processor.
|
143
|
+
* Awaits for finish frames if needed.
|
144
|
+
*/
|
148
145
|
async _processEvent(event, doesExist) {
|
149
|
-
var _a, _b;
|
150
146
|
if (!doesExist()) {
|
151
147
|
return event;
|
152
148
|
}
|
153
|
-
if (event.type === 'transaction' &&
|
154
|
-
event.transaction &&
|
155
|
-
event.contexts &&
|
156
|
-
event.contexts.trace) {
|
149
|
+
if (event.type === 'transaction' && event.transaction && event.contexts && event.contexts.trace) {
|
157
150
|
const traceContext = event.contexts.trace;
|
158
151
|
const traceId = traceContext.trace_id;
|
159
|
-
if (traceId &&
|
152
|
+
if (traceId && traceContext.data?.__startFrames && event.timestamp) {
|
160
153
|
const measurements = await this._getFramesMeasurements(traceId, event.timestamp, traceContext.data.__startFrames);
|
161
154
|
if (!measurements) {
|
162
155
|
logger.log(`[NativeFrames] Could not fetch native frames for ${traceContext.op} transaction ${event.transaction}. Not adding native frames measurements.`);
|
163
156
|
}
|
164
157
|
else {
|
165
158
|
logger.log(`[Measurements] Adding measurements to ${traceContext.op} transaction ${event.transaction}: ${JSON.stringify(measurements, undefined, 2)}`);
|
166
|
-
event.measurements =
|
159
|
+
event.measurements = {
|
160
|
+
...(event.measurements ?? {}),
|
161
|
+
...measurements
|
162
|
+
};
|
167
163
|
this._finishFrames.delete(traceId);
|
168
164
|
}
|
169
165
|
delete traceContext.data.__startFrames;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nativeframes.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"nativeframes.js","sourceRoot":"","sources":["../../../src/sentry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C;iBAC9J;qBAAM;oBACH,MAAM,CAAC,GAAG,CAAC,yCAAyC,YAAY,CAAC,EAAE,gBAAgB,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;oBAEvJ,KAAK,CAAC,YAAY,GAAG;wBACjB,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;wBAC7B,GAAG,YAAY;qBAClB,CAAC;oBAEF,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;iBACtC;gBAED,OAAO,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;aAC1C;SACJ;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
package/tracing/nstracing.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Hub } from '@sentry/hub';
|
2
2
|
import { RequestInstrumentationOptions, Transaction } from '@sentry/tracing';
|
3
3
|
import { EventProcessor, Integration, Transaction as TransactionType } from '@sentry/types';
|
4
|
-
import { RoutingInstrumentationInstance } from '
|
4
|
+
import { RoutingInstrumentationInstance } from './routingInstrumentation';
|
5
5
|
import { NativeFramesInstrumentation } from './nativeframes';
|
6
6
|
import { StallTrackingInstrumentation } from './stalltracking';
|
7
7
|
import { BeforeNavigate } from './types';
|
package/tracing/nstracing.js
CHANGED
@@ -8,13 +8,24 @@ import { StallTrackingInstrumentation } from './stalltracking';
|
|
8
8
|
import { adjustTransactionDuration, getTimeOriginMilliseconds, isNearToNow } from './utils';
|
9
9
|
import { getActiveTransaction, getCurrentHub } from '@sentry/core';
|
10
10
|
const DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\/(?!\/)/];
|
11
|
-
const defaultNativescriptTracingOptions =
|
11
|
+
const defaultNativescriptTracingOptions = {
|
12
|
+
...defaultRequestInstrumentationOptions,
|
13
|
+
idleTimeout: 1000,
|
14
|
+
maxTransactionDuration: 600,
|
15
|
+
idleTimeoutMs: 1000,
|
16
|
+
finalTimeoutMs: 600000,
|
17
|
+
ignoreEmptyBackNavigationTransactions: true,
|
18
|
+
beforeNavigate: context => context,
|
19
|
+
enableAppStartTracking: true,
|
20
|
+
enableNativeFramesTracking: true,
|
21
|
+
enableStallTracking: true,
|
22
|
+
enableUserInteractionTracing: false,
|
23
|
+
};
|
12
24
|
/**
|
13
25
|
* Tracing integration for React Native.
|
14
26
|
*/
|
15
27
|
export class NativescriptTracing {
|
16
28
|
constructor(options = {}) {
|
17
|
-
var _a, _b, _c, _d;
|
18
29
|
/**
|
19
30
|
* @inheritDoc
|
20
31
|
*/
|
@@ -24,10 +35,19 @@ export class NativescriptTracing {
|
|
24
35
|
options.tracePropagationTargets);
|
25
36
|
this._hasSetTracingOrigins = !!(options &&
|
26
37
|
options.tracingOrigins);
|
27
|
-
this.options =
|
28
|
-
|
29
|
-
|
30
|
-
|
38
|
+
this.options = {
|
39
|
+
...defaultNativescriptTracingOptions,
|
40
|
+
...options,
|
41
|
+
finalTimeoutMs: options.finalTimeoutMs ??
|
42
|
+
(typeof options.maxTransactionDuration === 'number'
|
43
|
+
?
|
44
|
+
options.maxTransactionDuration * 1000
|
45
|
+
: undefined) ??
|
46
|
+
defaultNativescriptTracingOptions.finalTimeoutMs,
|
47
|
+
idleTimeoutMs: options.idleTimeoutMs ??
|
48
|
+
options.idleTimeout ??
|
49
|
+
defaultNativescriptTracingOptions.idleTimeoutMs,
|
50
|
+
};
|
31
51
|
}
|
32
52
|
/**
|
33
53
|
* Registers routing and request instrumentation.
|
@@ -99,20 +119,18 @@ export class NativescriptTracing {
|
|
99
119
|
* To be called on a transaction start. Can have async methods
|
100
120
|
*/
|
101
121
|
onTransactionStart(transaction) {
|
102
|
-
var _a, _b;
|
103
122
|
if (isNearToNow(transaction.startTimestamp)) {
|
104
123
|
// Only if this method is called at or within margin of error to the start timestamp.
|
105
|
-
|
106
|
-
|
124
|
+
this.nativeFramesInstrumentation?.onTransactionStart(transaction);
|
125
|
+
this.stallTrackingInstrumentation?.onTransactionStart(transaction);
|
107
126
|
}
|
108
127
|
}
|
109
128
|
/**
|
110
129
|
* To be called on a transaction finish. Cannot have async methods.
|
111
130
|
*/
|
112
131
|
onTransactionFinish(transaction, endTimestamp) {
|
113
|
-
|
114
|
-
|
115
|
-
(_b = this.stallTrackingInstrumentation) === null || _b === void 0 ? void 0 : _b.onTransactionFinish(transaction, endTimestamp);
|
132
|
+
this.nativeFramesInstrumentation?.onTransactionFinish(transaction);
|
133
|
+
this.stallTrackingInstrumentation?.onTransactionFinish(transaction, endTimestamp);
|
116
134
|
}
|
117
135
|
/**
|
118
136
|
* Called by the NativescriptProfiler component on first component mount.
|
@@ -125,7 +143,6 @@ export class NativescriptTracing {
|
|
125
143
|
* @param userInteractionId Consists of `op` representation UI Event and `elementId` unique element identifier on current screen.
|
126
144
|
*/
|
127
145
|
startUserInteractionTransaction(userInteractionId) {
|
128
|
-
var _a, _b;
|
129
146
|
const { elementId, op } = userInteractionId;
|
130
147
|
if (!this.options.enableUserInteractionTracing) {
|
131
148
|
logger.log('[ReactNativeTracing] User Interaction Tracing is disabled.');
|
@@ -143,9 +160,9 @@ export class NativescriptTracing {
|
|
143
160
|
logger.log('[ReactNativeTracing] User Interaction Tracing can not create transaction without a current route.');
|
144
161
|
return undefined;
|
145
162
|
}
|
146
|
-
const hub =
|
163
|
+
const hub = this._getCurrentHub?.() || getCurrentHub();
|
147
164
|
const activeTransaction = getActiveTransaction(hub);
|
148
|
-
const activeTransactionIsNotInteraction =
|
165
|
+
const activeTransactionIsNotInteraction = activeTransaction?.spanId !== this._inflightInteractionTransaction?.spanId;
|
149
166
|
if (activeTransaction && activeTransactionIsNotInteraction) {
|
150
167
|
logger.warn(`[ReactNativeTracing] Did not create ${op} transaction because active transaction ${activeTransaction.name} exists on the scope.`);
|
151
168
|
return undefined;
|
@@ -176,7 +193,7 @@ export class NativescriptTracing {
|
|
176
193
|
*/
|
177
194
|
_getCurrentViewEventProcessor(event) {
|
178
195
|
if (event.contexts && this._currentViewName) {
|
179
|
-
event.contexts.app =
|
196
|
+
event.contexts.app = { view_names: [this._currentViewName], ...event.contexts.app };
|
180
197
|
}
|
181
198
|
return event;
|
182
199
|
}
|
@@ -247,11 +264,9 @@ export class NativescriptTracing {
|
|
247
264
|
* Creates a breadcrumb and sets the current route as a tag.
|
248
265
|
*/
|
249
266
|
_onConfirmRoute(context) {
|
250
|
-
var _a, _b, _c;
|
251
267
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
252
|
-
this._currentRoute =
|
253
|
-
|
254
|
-
var _a;
|
268
|
+
this._currentRoute = context.data?.route?.name;
|
269
|
+
this._getCurrentHub?.().configureScope(scope => {
|
255
270
|
if (context.data) {
|
256
271
|
const contextData = context.data;
|
257
272
|
scope.addBreadcrumb({
|
@@ -260,7 +275,7 @@ export class NativescriptTracing {
|
|
260
275
|
// We assume that context.name is the name of the route.
|
261
276
|
message: `Navigation to ${context.name}`,
|
262
277
|
data: {
|
263
|
-
from:
|
278
|
+
from: contextData.previousRoute?.name,
|
264
279
|
to: contextData.route.name,
|
265
280
|
},
|
266
281
|
});
|
@@ -284,7 +299,10 @@ export class NativescriptTracing {
|
|
284
299
|
this._inflightInteractionTransaction.finish();
|
285
300
|
}
|
286
301
|
const { finalTimeoutMs } = this.options;
|
287
|
-
const expandedContext =
|
302
|
+
const expandedContext = {
|
303
|
+
...context,
|
304
|
+
trimEnd: true,
|
305
|
+
};
|
288
306
|
const idleTransaction = this._startIdleTransaction(expandedContext);
|
289
307
|
this.onTransactionStart(idleTransaction);
|
290
308
|
logger.log(`[ReactNativeTracing] Starting ${context.op} transaction "${context.name}" on scope`);
|
@@ -303,10 +321,9 @@ export class NativescriptTracing {
|
|
303
321
|
});
|
304
322
|
if (this.options.ignoreEmptyBackNavigationTransactions) {
|
305
323
|
idleTransaction.registerBeforeFinishCallback(transaction => {
|
306
|
-
var _a, _b;
|
307
324
|
if (
|
308
325
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
309
|
-
|
326
|
+
transaction.data?.route?.hasBeenSeen &&
|
310
327
|
(!transaction.spanRecorder ||
|
311
328
|
transaction.spanRecorder.spans.filter(span => span.spanId !== transaction.spanId).length === 0)) {
|
312
329
|
logger.log('[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.');
|
@@ -321,9 +338,8 @@ export class NativescriptTracing {
|
|
321
338
|
* Start app state aware idle transaction on the scope.
|
322
339
|
*/
|
323
340
|
_startIdleTransaction(context) {
|
324
|
-
var _a;
|
325
341
|
const { idleTimeoutMs, finalTimeoutMs } = this.options;
|
326
|
-
const hub =
|
342
|
+
const hub = this._getCurrentHub?.() || getCurrentHub();
|
327
343
|
const tx = startIdleTransaction(hub, context, idleTimeoutMs, finalTimeoutMs, true);
|
328
344
|
cancelInBackground(tx);
|
329
345
|
return tx;
|