@nativescript-community/sentry 3.1.5 → 4.6.1
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 -0
- package/README.md +2 -6
- package/client.d.ts +38 -3
- package/client.js +143 -5
- package/client.js.map +1 -1
- package/index.d.ts +7 -11
- package/index.js +28 -12
- package/index.js.map +1 -1
- package/integrations/debugsymbolicator.d.ts +4 -4
- package/integrations/debugsymbolicator.js +11 -22
- package/integrations/debugsymbolicator.js.map +1 -1
- package/integrations/devicecontext.js +22 -5
- package/integrations/devicecontext.js.map +1 -1
- package/integrations/eventorigin.d.ts +7 -7
- package/integrations/eventorigin.js +9 -9
- package/integrations/eventorigin.js.map +1 -1
- package/integrations/nativescripterrorhandlers.d.ts +15 -5
- package/integrations/nativescripterrorhandlers.js +55 -44
- package/integrations/nativescripterrorhandlers.js.map +1 -1
- package/integrations/release.js +10 -8
- package/integrations/release.js.map +1 -1
- package/integrations/sdkinfo.d.ts +4 -1
- package/integrations/sdkinfo.js +17 -10
- package/integrations/sdkinfo.js.map +1 -1
- package/measurement.d.ts +4 -0
- package/measurement.js +50 -0
- package/measurement.js.map +1 -0
- package/measurements.d.ts +4 -0
- package/measurements.js +50 -0
- package/measurements.js.map +1 -0
- package/misc.d.ts +8 -0
- package/misc.js +17 -0
- package/misc.js.map +1 -0
- package/options.d.ts +125 -0
- package/options.js +2 -0
- package/options.js.map +1 -0
- package/package.json +9 -12
- package/platforms/android/buildscript.gradle +6 -2
- package/platforms/android/include.gradle +1 -1
- package/platforms/android/native-api-usage.json +4 -1
- package/platforms/android/sentry.aar +0 -0
- package/platforms/ios/Podfile +1 -1
- package/platforms/ios/src/NSSentry.h +8 -3
- package/platforms/ios/src/NSSentry.m +41 -0
- package/scope.d.ts +1 -45
- package/scope.js +90 -68
- package/scope.js.map +1 -1
- package/sdk.d.ts +27 -3
- package/sdk.js +105 -30
- package/sdk.js.map +1 -1
- package/tracing/index.d.ts +2 -1
- package/tracing/index.js +14 -6
- package/tracing/index.js.map +1 -1
- package/tracing/nativeframes.d.ts +68 -0
- package/tracing/nativeframes.js +175 -0
- package/tracing/nativeframes.js.map +1 -0
- package/tracing/nstracing.d.ts +98 -47
- package/tracing/nstracing.js +164 -44
- package/tracing/nstracing.js.map +1 -1
- package/tracing/routingInstrumentation.d.ts +46 -0
- package/tracing/routingInstrumentation.js +33 -0
- package/tracing/routingInstrumentation.js.map +1 -0
- package/tracing/stalltracking.d.ts +92 -0
- package/tracing/stalltracking.js +258 -0
- package/tracing/stalltracking.js.map +1 -0
- package/tracing/types.d.ts +13 -0
- package/tracing/types.js +2 -0
- package/tracing/types.js.map +1 -0
- package/tracing/utils.d.ts +22 -1
- package/tracing/utils.js +51 -2
- package/tracing/utils.js.map +1 -1
- package/transports/TextEncoder.d.ts +2 -0
- package/transports/TextEncoder.js +12 -0
- package/transports/TextEncoder.js.map +1 -0
- package/transports/native.d.ts +20 -8
- package/transports/native.js +21 -13
- package/transports/native.js.map +1 -1
- package/utils/envelope.d.ts +11 -0
- package/utils/envelope.js +21 -0
- package/utils/envelope.js.map +1 -0
- package/utils/outcome.d.ts +5 -0
- package/utils/outcome.js +19 -0
- package/utils/outcome.js.map +1 -0
- package/utils/safe.d.ts +17 -0
- package/utils/safe.js +46 -0
- package/utils/safe.js.map +1 -0
- package/vendor/buffer/index.d.ts +1 -0
- package/vendor/buffer/index.js +2 -0
- package/vendor/buffer/index.js.map +1 -0
- package/vendor/buffer/utf8ToBytes.d.ts +9 -0
- package/vendor/buffer/utf8ToBytes.js +81 -0
- package/vendor/buffer/utf8ToBytes.js.map +1 -0
- package/vendor/index.d.ts +1 -0
- package/vendor/index.js +2 -0
- package/vendor/index.js.map +1 -0
- package/version.d.ts +2 -1
- package/version.js +2 -1
- package/version.js.map +1 -1
- package/wrapper.android.d.ts +30 -0
- package/wrapper.android.js +952 -0
- package/wrapper.android.js.map +1 -0
- package/wrapper.d.ts +88 -0
- package/wrapper.ios.d.ts +34 -0
- package/wrapper.ios.js +497 -0
- package/wrapper.ios.js.map +1 -0
- package/pnpm-lock.yaml +0 -914
@@ -0,0 +1,68 @@
|
|
1
|
+
import { Transaction } from '@sentry/tracing';
|
2
|
+
import { EventProcessor, MeasurementUnit, Measurements } from '@sentry/types';
|
3
|
+
export interface NativeFramesResponse {
|
4
|
+
totalFrames: number;
|
5
|
+
slowFrames: number;
|
6
|
+
frozenFrames: number;
|
7
|
+
}
|
8
|
+
export interface FramesMeasurements extends Measurements {
|
9
|
+
'frames_total': {
|
10
|
+
value: number;
|
11
|
+
unit: MeasurementUnit;
|
12
|
+
};
|
13
|
+
'frames_slow': {
|
14
|
+
value: number;
|
15
|
+
unit: MeasurementUnit;
|
16
|
+
};
|
17
|
+
'frames_frozen': {
|
18
|
+
value: number;
|
19
|
+
unit: MeasurementUnit;
|
20
|
+
};
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Instrumentation to add native slow/frozen frames measurements onto transactions.
|
24
|
+
*/
|
25
|
+
export declare class NativeFramesInstrumentation {
|
26
|
+
/** The native frames at the transaction finish time, keyed by traceId. */
|
27
|
+
private _finishFrames;
|
28
|
+
/** The listeners for each native frames response, keyed by traceId */
|
29
|
+
private _framesListeners;
|
30
|
+
/** The native frames at the finish time of the most recent span. */
|
31
|
+
private _lastSpanFinishFrames?;
|
32
|
+
constructor(addGlobalEventProcessor: (e: EventProcessor) => void, doesExist: () => boolean);
|
33
|
+
/**
|
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
|
+
onTransactionStart(transaction: Transaction): void;
|
38
|
+
/**
|
39
|
+
* To be called when a transaction is finished
|
40
|
+
*/
|
41
|
+
onTransactionFinish(transaction: Transaction): void;
|
42
|
+
/**
|
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
|
+
private _onSpanFinish;
|
47
|
+
/**
|
48
|
+
* Returns the computed frames measurements and awaits for them if they are not ready yet.
|
49
|
+
*/
|
50
|
+
private _getFramesMeasurements;
|
51
|
+
/**
|
52
|
+
* Returns the computed frames measurements given ready data
|
53
|
+
*/
|
54
|
+
private _prepareMeasurements;
|
55
|
+
/**
|
56
|
+
* Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.
|
57
|
+
*/
|
58
|
+
private _fetchFramesForTransaction;
|
59
|
+
/**
|
60
|
+
* On a finish frames failure, we cancel the await.
|
61
|
+
*/
|
62
|
+
private _cancelFinishFrames;
|
63
|
+
/**
|
64
|
+
* Adds frames measurements to an event. Called from a valid event processor.
|
65
|
+
* Awaits for finish frames if needed.
|
66
|
+
*/
|
67
|
+
private _processEvent;
|
68
|
+
}
|
@@ -0,0 +1,175 @@
|
|
1
|
+
import { logger, timestampInSeconds } from '@sentry/utils';
|
2
|
+
import { NATIVE } from '../wrapper';
|
3
|
+
import { instrumentChildSpanFinish } from './utils';
|
4
|
+
/**
|
5
|
+
* A margin of error of 50ms is allowed for the async native bridge call.
|
6
|
+
* Anything larger would reduce the accuracy of our frames measurements.
|
7
|
+
*/
|
8
|
+
const MARGIN_OF_ERROR_SECONDS = 0.05;
|
9
|
+
/**
|
10
|
+
* Instrumentation to add native slow/frozen frames measurements onto transactions.
|
11
|
+
*/
|
12
|
+
export class NativeFramesInstrumentation {
|
13
|
+
constructor(addGlobalEventProcessor, doesExist) {
|
14
|
+
/** The native frames at the transaction finish time, keyed by traceId. */
|
15
|
+
this._finishFrames = new Map();
|
16
|
+
/** The listeners for each native frames response, keyed by traceId */
|
17
|
+
this._framesListeners = new Map();
|
18
|
+
logger.log('[ReactNativeTracing] Native frames instrumentation initialized.');
|
19
|
+
addGlobalEventProcessor((event) => this._processEvent(event, doesExist));
|
20
|
+
}
|
21
|
+
/**
|
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
|
+
onTransactionStart(transaction) {
|
26
|
+
void NATIVE.fetchNativeFrames().then((framesMetrics) => {
|
27
|
+
if (framesMetrics) {
|
28
|
+
transaction.setData('__startFrames', framesMetrics);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
instrumentChildSpanFinish(transaction, (_, endTimestamp) => {
|
32
|
+
if (!endTimestamp) {
|
33
|
+
this._onSpanFinish();
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* To be called when a transaction is finished
|
39
|
+
*/
|
40
|
+
onTransactionFinish(transaction) {
|
41
|
+
void this._fetchFramesForTransaction(transaction);
|
42
|
+
}
|
43
|
+
/**
|
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
|
+
_onSpanFinish() {
|
48
|
+
const timestamp = timestampInSeconds();
|
49
|
+
void NATIVE.fetchNativeFrames().then((nativeFrames) => {
|
50
|
+
if (nativeFrames) {
|
51
|
+
this._lastSpanFinishFrames = {
|
52
|
+
timestamp,
|
53
|
+
nativeFrames,
|
54
|
+
};
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Returns the computed frames measurements and awaits for them if they are not ready yet.
|
60
|
+
*/
|
61
|
+
async _getFramesMeasurements(traceId, finalEndTimestamp, startFrames) {
|
62
|
+
if (this._finishFrames.has(traceId)) {
|
63
|
+
return this._prepareMeasurements(traceId, finalEndTimestamp, startFrames);
|
64
|
+
}
|
65
|
+
return new Promise((resolve) => {
|
66
|
+
const timeout = setTimeout(() => {
|
67
|
+
this._framesListeners.delete(traceId);
|
68
|
+
resolve(null);
|
69
|
+
}, 2000);
|
70
|
+
this._framesListeners.set(traceId, () => {
|
71
|
+
resolve(this._prepareMeasurements(traceId, finalEndTimestamp, startFrames));
|
72
|
+
clearTimeout(timeout);
|
73
|
+
this._framesListeners.delete(traceId);
|
74
|
+
});
|
75
|
+
});
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Returns the computed frames measurements given ready data
|
79
|
+
*/
|
80
|
+
_prepareMeasurements(traceId, finalEndTimestamp, // The actual transaction finish time.
|
81
|
+
startFrames) {
|
82
|
+
let finalFinishFrames;
|
83
|
+
const finish = this._finishFrames.get(traceId);
|
84
|
+
if (finish &&
|
85
|
+
finish.nativeFrames &&
|
86
|
+
// Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)
|
87
|
+
Math.abs(finish.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS) {
|
88
|
+
finalFinishFrames = finish.nativeFrames;
|
89
|
+
}
|
90
|
+
else if (this._lastSpanFinishFrames &&
|
91
|
+
Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) <
|
92
|
+
MARGIN_OF_ERROR_SECONDS) {
|
93
|
+
// Fallback to the last span finish if it is within the margin of error of the actual finish timestamp.
|
94
|
+
// This should be the case for trimEnd.
|
95
|
+
finalFinishFrames = this._lastSpanFinishFrames.nativeFrames;
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
return null;
|
99
|
+
}
|
100
|
+
const measurements = {
|
101
|
+
frames_total: {
|
102
|
+
value: finalFinishFrames.totalFrames - startFrames.totalFrames,
|
103
|
+
unit: 'none'
|
104
|
+
},
|
105
|
+
frames_frozen: {
|
106
|
+
value: finalFinishFrames.frozenFrames - startFrames.frozenFrames,
|
107
|
+
unit: 'none'
|
108
|
+
},
|
109
|
+
frames_slow: {
|
110
|
+
value: finalFinishFrames.slowFrames - startFrames.slowFrames,
|
111
|
+
unit: 'none'
|
112
|
+
},
|
113
|
+
};
|
114
|
+
return measurements;
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.
|
118
|
+
*/
|
119
|
+
async _fetchFramesForTransaction(transaction) {
|
120
|
+
var _a;
|
121
|
+
const startFrames = transaction.data.__startFrames;
|
122
|
+
// This timestamp marks when the finish frames were retrieved. It should be pretty close to the transaction finish.
|
123
|
+
const timestamp = timestampInSeconds();
|
124
|
+
let finishFrames = null;
|
125
|
+
if (startFrames) {
|
126
|
+
finishFrames = await NATIVE.fetchNativeFrames();
|
127
|
+
}
|
128
|
+
this._finishFrames.set(transaction.traceId, {
|
129
|
+
nativeFrames: finishFrames,
|
130
|
+
timestamp,
|
131
|
+
});
|
132
|
+
(_a = this._framesListeners.get(transaction.traceId)) === null || _a === void 0 ? void 0 : _a();
|
133
|
+
setTimeout(() => this._cancelFinishFrames(transaction), 2000);
|
134
|
+
}
|
135
|
+
/**
|
136
|
+
* On a finish frames failure, we cancel the await.
|
137
|
+
*/
|
138
|
+
_cancelFinishFrames(transaction) {
|
139
|
+
if (this._finishFrames.has(transaction.traceId)) {
|
140
|
+
this._finishFrames.delete(transaction.traceId);
|
141
|
+
logger.log(`[NativeFrames] Native frames timed out for ${transaction.op} transaction ${transaction.name}. Not adding native frames measurements.`);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
/**
|
145
|
+
* Adds frames measurements to an event. Called from a valid event processor.
|
146
|
+
* Awaits for finish frames if needed.
|
147
|
+
*/
|
148
|
+
async _processEvent(event, doesExist) {
|
149
|
+
var _a, _b;
|
150
|
+
if (!doesExist()) {
|
151
|
+
return event;
|
152
|
+
}
|
153
|
+
if (event.type === 'transaction' &&
|
154
|
+
event.transaction &&
|
155
|
+
event.contexts &&
|
156
|
+
event.contexts.trace) {
|
157
|
+
const traceContext = event.contexts.trace;
|
158
|
+
const traceId = traceContext.trace_id;
|
159
|
+
if (traceId && ((_a = traceContext.data) === null || _a === void 0 ? void 0 : _a.__startFrames) && event.timestamp) {
|
160
|
+
const measurements = await this._getFramesMeasurements(traceId, event.timestamp, traceContext.data.__startFrames);
|
161
|
+
if (!measurements) {
|
162
|
+
logger.log(`[NativeFrames] Could not fetch native frames for ${traceContext.op} transaction ${event.transaction}. Not adding native frames measurements.`);
|
163
|
+
}
|
164
|
+
else {
|
165
|
+
logger.log(`[Measurements] Adding measurements to ${traceContext.op} transaction ${event.transaction}: ${JSON.stringify(measurements, undefined, 2)}`);
|
166
|
+
event.measurements = Object.assign(Object.assign({}, ((_b = event.measurements) !== null && _b !== void 0 ? _b : {})), measurements);
|
167
|
+
this._finishFrames.delete(traceId);
|
168
|
+
}
|
169
|
+
delete traceContext.data.__startFrames;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
return event;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
//# sourceMappingURL=nativeframes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nativeframes.js","sourceRoot":"","sources":["../../src/tracing/nativeframes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAcpD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,2BAA2B;IAcpC,YACI,uBAAoD,EACpD,SAAwB;QAf5B,0EAA0E;QAClE,kBAAa,GAGjB,IAAI,GAAG,EAAE,CAAC;QACd,sEAAsE;QAC9D,qBAAgB,GAA4B,IAAI,GAAG,EAAE,CAAC;QAW1D,MAAM,CAAC,GAAG,CACN,iEAAiE,CACpE,CAAC;QAEF,uBAAuB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;KAGC;IACM,kBAAkB,CAAC,WAAwB;QAC9C,KAAK,MAAM,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE;YACnD,IAAI,aAAa,EAAE;gBACf,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;aACvD;QACL,CAAC,CAAC,CAAC;QAEH,yBAAyB,CAAC,WAAW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AO,KAAI,MAAA,YAAY,CAAC,IAAI,0CAAE,aAAa,CAAA,IAAI,KAAK,CAAC,SAAS,EAAE;gBAChE,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAClD,OAAO,EACP,KAAK,CAAC,SAAS,EACf,YAAY,CAAC,IAAI,CAAC,aAAqC,CAC1D,CAAC;gBAEF,IAAI,CAAC,YAAY,EAAE;oBACf,MAAM,CAAC,GAAG,CACN,oDAAoD,YAAY,CAAC,EAAE,gBAAgB,KAAK,CAAC,WAAW,0CAA0C,CACjJ,CAAC;iBACL;qBAAM;oBACH,MAAM,CAAC,GAAG,CACN,yCAAyC,YAAY,CAAC,EACtD,gBAAgB,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,SAAS,CAChD,YAAY,EACZ,SAAS,EACT,CAAC,CACJ,EAAE,CACN,CAAC;oBAEF,KAAK,CAAC,YAAY,mCACX,CAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,EAAE,CAAC,GAC1B,YAAY,CAClB,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,65 +1,116 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
import { Hub } from '@sentry/hub';
|
2
|
+
import { RequestInstrumentationOptions, Transaction } from '@sentry/tracing';
|
3
|
+
import { EventProcessor, Integration } from '@sentry/types';
|
4
|
+
import { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';
|
5
|
+
import { NativeFramesInstrumentation } from './nativeframes';
|
6
|
+
import { StallTrackingInstrumentation } from './stalltracking';
|
7
|
+
import { BeforeNavigate } from './types';
|
8
|
+
export interface NativescriptTracingOptions extends RequestInstrumentationOptions {
|
9
|
+
/**
|
10
|
+
* The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of
|
11
|
+
* the last finished span as the endtime for the transaction.
|
12
|
+
* Time is in ms.
|
13
|
+
*
|
14
|
+
* Default: 1000
|
15
|
+
*/
|
11
16
|
idleTimeout: number;
|
12
17
|
/**
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
18
|
+
* The maximum duration of a transaction before it will be marked as "deadline_exceeded".
|
19
|
+
* If you never want to mark a transaction set it to 0.
|
20
|
+
* Time is in seconds.
|
21
|
+
*
|
22
|
+
* Default: 600
|
23
|
+
*/
|
19
24
|
maxTransactionDuration: number;
|
20
25
|
/**
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
26
|
+
* The routing instrumentation to be used with the tracing integration.
|
27
|
+
* There is no routing instrumentation if nothing is passed.
|
28
|
+
*/
|
29
|
+
routingInstrumentation?: RoutingInstrumentationInstance;
|
30
|
+
/**
|
31
|
+
* Does not sample transactions that are from routes that have been seen any more and don't have any spans.
|
32
|
+
* This removes a lot of the clutter as most back navigation transactions are now ignored.
|
33
|
+
*
|
34
|
+
* Default: true
|
35
|
+
*/
|
36
|
+
ignoreEmptyBackNavigationTransactions: boolean;
|
37
|
+
/**
|
38
|
+
* beforeNavigate is called before a navigation transaction is created and allows users to modify transaction
|
39
|
+
* context data, or drop the transaction entirely (by setting `sampled = false` in the context).
|
40
|
+
*
|
41
|
+
* @param context: The context data which will be passed to `startTransaction` by default
|
42
|
+
*
|
43
|
+
* @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.
|
44
|
+
*/
|
45
|
+
beforeNavigate: BeforeNavigate;
|
46
|
+
/**
|
47
|
+
* Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation
|
48
|
+
* an app start transaction will be started.
|
49
|
+
*
|
50
|
+
* Default: true
|
51
|
+
*/
|
52
|
+
enableAppStartTracking: boolean;
|
53
|
+
/**
|
54
|
+
* Track slow/frozen frames from the native layer and adds them as measurements to all transactions.
|
55
|
+
*/
|
56
|
+
enableNativeFramesTracking: boolean;
|
57
|
+
/**
|
58
|
+
* Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.
|
59
|
+
*/
|
60
|
+
enableStallTracking: boolean;
|
40
61
|
}
|
41
62
|
/**
|
42
|
-
|
43
|
-
|
44
|
-
export declare class
|
63
|
+
* Tracing integration for React Native.
|
64
|
+
*/
|
65
|
+
export declare class NativescriptTracing implements Integration {
|
45
66
|
/**
|
46
|
-
|
47
|
-
|
67
|
+
* @inheritDoc
|
68
|
+
*/
|
48
69
|
static id: string;
|
49
70
|
/**
|
50
|
-
|
51
|
-
|
71
|
+
* @inheritDoc
|
72
|
+
*/
|
52
73
|
name: string;
|
53
|
-
/**
|
54
|
-
options:
|
74
|
+
/** NativescriptTracing options */
|
75
|
+
options: NativescriptTracingOptions;
|
76
|
+
nativeFramesInstrumentation?: NativeFramesInstrumentation;
|
77
|
+
stallTrackingInstrumentation?: StallTrackingInstrumentation;
|
78
|
+
useAppStartWithProfiler: boolean;
|
55
79
|
private _getCurrentHub?;
|
56
|
-
|
80
|
+
private _awaitingAppStartData?;
|
81
|
+
private _appStartFinishTimestamp?;
|
82
|
+
constructor(options?: Partial<NativescriptTracingOptions>);
|
57
83
|
/**
|
58
|
-
|
59
|
-
|
84
|
+
* Registers routing and request instrumentation.
|
85
|
+
*/
|
60
86
|
setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
|
87
|
+
/**
|
88
|
+
* To be called on a transaction start. Can have async methods
|
89
|
+
*/
|
90
|
+
onTransactionStart(transaction: Transaction): void;
|
91
|
+
/**
|
92
|
+
* To be called on a transaction finish. Cannot have async methods.
|
93
|
+
*/
|
94
|
+
onTransactionFinish(transaction: Transaction, endTimestamp?: number): void;
|
95
|
+
/**
|
96
|
+
* Called by the NativescriptProfiler component on first component mount.
|
97
|
+
*/
|
98
|
+
onAppStartFinish(endTimestamp: number): void;
|
99
|
+
/**
|
100
|
+
* Instruments the app start measurements on the first route transaction.
|
101
|
+
* Starts a route transaction if there isn't routing instrumentation.
|
102
|
+
*/
|
103
|
+
private _instrumentAppStart;
|
104
|
+
/**
|
105
|
+
* Adds app start measurements and starts a child span on a transaction.
|
106
|
+
*/
|
107
|
+
private _addAppStartData;
|
61
108
|
/** To be called when the route changes, but BEFORE the components of the new route mount. */
|
62
109
|
private _onRouteWillChange;
|
110
|
+
/**
|
111
|
+
* Creates a breadcrumb and sets the current route as a tag.
|
112
|
+
*/
|
113
|
+
private _onConfirmRoute;
|
63
114
|
/** Create routing idle transaction. */
|
64
115
|
private _createRouteTransaction;
|
65
116
|
}
|