@datadog/mobile-react-native 1.0.0-beta4 → 1.0.0-rc4
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/DatadogSDKReactNative.podspec +1 -1
- package/README.md +73 -1
- package/android/build.gradle +2 -3
- package/android/src/main/java/com/datadog/reactnative/DdRum.kt +25 -24
- package/android/src/main/java/com/datadog/reactnative/DdTrace.kt +6 -6
- package/ios/Sources/DdRum.m +10 -9
- package/ios/Sources/DdRum.swift +24 -24
- package/ios/Sources/DdTrace.m +2 -2
- package/ios/Sources/DdTrace.swift +6 -6
- package/ios/Sources/QueueHolder.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +57 -0
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +8 -0
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/NativeSdkVerbosity.js +26 -0
- package/lib/commonjs/NativeSdkVerbosity.js.map +1 -0
- package/lib/commonjs/ProxyConfiguration.js +53 -0
- package/lib/commonjs/ProxyConfiguration.js.map +1 -0
- package/lib/commonjs/Timer.js +99 -0
- package/lib/commonjs/Timer.js.map +1 -0
- package/lib/commonjs/TrackingConsent.js +6 -0
- package/lib/commonjs/TrackingConsent.js.map +1 -1
- package/lib/commonjs/foundation.js +88 -8
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js +51 -11
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +38 -6
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +103 -18
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +10 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/DdSdkReactNative.js +56 -1
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +9 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/NativeSdkVerbosity.js +18 -0
- package/lib/module/NativeSdkVerbosity.js.map +1 -0
- package/lib/module/ProxyConfiguration.js +46 -0
- package/lib/module/ProxyConfiguration.js.map +1 -0
- package/lib/module/Timer.js +90 -0
- package/lib/module/Timer.js.map +1 -0
- package/lib/module/TrackingConsent.js +6 -0
- package/lib/module/TrackingConsent.js.map +1 -1
- package/lib/module/foundation.js +89 -3
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js +51 -11
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +37 -6
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js +96 -18
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +3 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/DdSdkReactNative.d.ts +11 -0
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +6 -0
- package/lib/typescript/NativeSdkVerbosity.d.ts +9 -0
- package/lib/typescript/ProxyConfiguration.d.ts +56 -0
- package/lib/typescript/Timer.d.ts +20 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/DdEventsInterceptor.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +4 -0
- package/lib/typescript/rum/instrumentation/DdRumXhr.d.ts +2 -2
- package/lib/typescript/types.d.ts +25 -24
- package/lib/typescript/version.d.ts +1 -0
- package/package.json +12 -13
- package/src/DdSdkReactNative.tsx +47 -0
- package/src/DdSdkReactNativeConfiguration.tsx +7 -1
- package/src/NativeSdkVerbosity.tsx +15 -0
- package/src/ProxyConfiguration.tsx +37 -0
- package/src/Timer.ts +96 -0
- package/src/TrackingConsent.tsx +6 -0
- package/src/__tests__/DdRumWrapper.test.tsx +91 -0
- package/src/__tests__/DdSdkReactNative.test.tsx +541 -0
- package/src/__tests__/Timer.test.ts +145 -0
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +222 -0
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +314 -0
- package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +677 -0
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +188 -0
- package/src/__tests__/rum/instrumentation/TraceIdentifier.test.tsx +33 -0
- package/src/foundation.tsx +83 -3
- package/src/index.tsx +3 -2
- package/src/rum/instrumentation/DdEventsInterceptor.tsx +40 -10
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +56 -25
- package/src/rum/instrumentation/DdRumResourceTracking.tsx +92 -22
- package/src/rum/instrumentation/DdRumXhr.tsx +6 -5
- package/src/types.tsx +25 -24
- package/src/version.ts +2 -0
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -104
- package/ios/DdSdkReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/Tests/ModulesTest.swift +0 -43
|
@@ -6,15 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
import { Platform } from 'react-native';
|
|
8
8
|
import { DdRum } from '../../foundation'
|
|
9
|
+
import Timer from '../../Timer';
|
|
9
10
|
import type { DdRumXhr } from './DdRumXhr'
|
|
10
11
|
import { generateTraceId } from './TraceIdentifier';
|
|
11
12
|
|
|
12
13
|
export const TRACE_ID_HEADER_KEY = "x-datadog-trace-id"
|
|
13
14
|
export const PARENT_ID_HEADER_KEY = "x-datadog-parent-id"
|
|
14
15
|
export const ORIGIN_HEADER_KEY = "x-datadog-origin"
|
|
16
|
+
export const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority"
|
|
17
|
+
export const SAMPLED_HEADER_KEY = "x-datadog-sampled"
|
|
15
18
|
export const ORIGIN_RUM = "rum"
|
|
16
19
|
|
|
17
|
-
const
|
|
20
|
+
const RESPONSE_START_LABEL = "response_start"
|
|
21
|
+
const MISSING_RESOURCE_SIZE = -1
|
|
18
22
|
|
|
19
23
|
interface Timing {
|
|
20
24
|
/**
|
|
@@ -38,11 +42,7 @@ interface ResourceTimings {
|
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
function createTimings(startTime: number,
|
|
41
|
-
responseStartTime: number, responseEndTime: number): ResourceTimings
|
|
42
|
-
|
|
43
|
-
if (startTime === MISSING_TIME || responseStartTime === MISSING_TIME) {
|
|
44
|
-
return null
|
|
45
|
-
}
|
|
45
|
+
responseStartTime: number, responseEndTime: number): ResourceTimings {
|
|
46
46
|
|
|
47
47
|
const firstByte = formatTiming(startTime, startTime, responseStartTime)
|
|
48
48
|
const download = formatTiming(startTime, responseStartTime, responseEndTime)
|
|
@@ -74,6 +74,70 @@ function timeToNanos(durationMs: number): number {
|
|
|
74
74
|
return +(durationMs * 1e6).toFixed(0)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
function byteLength(str: string): number {
|
|
78
|
+
// This is a weird trick, but it works.
|
|
79
|
+
// Output is the same as TextEncoder.encode(...).length
|
|
80
|
+
return unescape(encodeURI(str)).length;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getResponseContentLengthFromHeader(xhr: XMLHttpRequest): number | null {
|
|
84
|
+
const contentLengthHeader = parseInt(xhr.getResponseHeader('Content-Length') ?? '', 10);
|
|
85
|
+
if (!isNaN(contentLengthHeader)) {
|
|
86
|
+
return contentLengthHeader;
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function calculateResponseSize(xhr: XMLHttpRequest): number {
|
|
92
|
+
|
|
93
|
+
const contentLengthHeader = getResponseContentLengthFromHeader(xhr);
|
|
94
|
+
if (contentLengthHeader != null) {
|
|
95
|
+
return contentLengthHeader as number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const response = xhr.response
|
|
99
|
+
if (!response) {
|
|
100
|
+
return MISSING_RESOURCE_SIZE;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let size;
|
|
104
|
+
try {
|
|
105
|
+
switch (xhr.responseType) {
|
|
106
|
+
case '':
|
|
107
|
+
case 'text':
|
|
108
|
+
// String
|
|
109
|
+
size = byteLength(response);
|
|
110
|
+
break;
|
|
111
|
+
case 'blob':
|
|
112
|
+
size = response.size;
|
|
113
|
+
break;
|
|
114
|
+
case 'arraybuffer':
|
|
115
|
+
size = response.byteLength;
|
|
116
|
+
break;
|
|
117
|
+
case 'document':
|
|
118
|
+
// currently not supported by RN as of 0.66
|
|
119
|
+
// HTML Document or XML Document
|
|
120
|
+
break;
|
|
121
|
+
case 'json':
|
|
122
|
+
// plain JS object
|
|
123
|
+
// original size was lost, because this is the object which was parsed.
|
|
124
|
+
// We can only convert back to the string and calculate the size,
|
|
125
|
+
// which will roughly match original.
|
|
126
|
+
size = byteLength(JSON.stringify(response))
|
|
127
|
+
break;
|
|
128
|
+
default:
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.error("Couldn't get resource size, because of the error", e);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (typeof size !== 'number') {
|
|
136
|
+
return MISSING_RESOURCE_SIZE;
|
|
137
|
+
}
|
|
138
|
+
return size;
|
|
139
|
+
}
|
|
140
|
+
|
|
77
141
|
/**
|
|
78
142
|
* Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
|
|
79
143
|
*/
|
|
@@ -131,10 +195,9 @@ export class DdRumResourceTracking {
|
|
|
131
195
|
const traceId = generateTraceId()
|
|
132
196
|
this._datadog_xhr = {
|
|
133
197
|
method,
|
|
134
|
-
startTime: MISSING_TIME,
|
|
135
|
-
responseStartTime: MISSING_TIME,
|
|
136
198
|
url: url,
|
|
137
199
|
reported: false,
|
|
200
|
+
timer: new Timer(),
|
|
138
201
|
spanId: spanId,
|
|
139
202
|
traceId: traceId
|
|
140
203
|
}
|
|
@@ -149,11 +212,12 @@ export class DdRumResourceTracking {
|
|
|
149
212
|
|
|
150
213
|
if (this._datadog_xhr) {
|
|
151
214
|
// keep track of start time
|
|
152
|
-
this._datadog_xhr.
|
|
215
|
+
this._datadog_xhr.timer.start()
|
|
153
216
|
this.setRequestHeader(TRACE_ID_HEADER_KEY, this._datadog_xhr.traceId)
|
|
154
217
|
this.setRequestHeader(PARENT_ID_HEADER_KEY, this._datadog_xhr.spanId)
|
|
155
218
|
this.setRequestHeader(ORIGIN_HEADER_KEY, ORIGIN_RUM)
|
|
156
|
-
|
|
219
|
+
this.setRequestHeader(SAMPLING_PRIORITY_HEADER_KEY, "1")
|
|
220
|
+
this.setRequestHeader(SAMPLED_HEADER_KEY, "1")
|
|
157
221
|
}
|
|
158
222
|
|
|
159
223
|
DdRumResourceTracking.proxyOnReadyStateChange(this, xhrType);
|
|
@@ -171,9 +235,8 @@ export class DdRumResourceTracking {
|
|
|
171
235
|
DdRumResourceTracking.reportXhr(xhrProxy);
|
|
172
236
|
xhrProxy._datadog_xhr.reported = true;
|
|
173
237
|
}
|
|
174
|
-
} else if (xhrProxy.readyState === xhrType.HEADERS_RECEIVED
|
|
175
|
-
|
|
176
|
-
xhrProxy._datadog_xhr.responseStartTime = Date.now()
|
|
238
|
+
} else if (xhrProxy.readyState === xhrType.HEADERS_RECEIVED) {
|
|
239
|
+
xhrProxy._datadog_xhr.timer.recordTick(RESPONSE_START_LABEL)
|
|
177
240
|
}
|
|
178
241
|
|
|
179
242
|
if (originalOnreadystatechange) {
|
|
@@ -185,32 +248,39 @@ export class DdRumResourceTracking {
|
|
|
185
248
|
|
|
186
249
|
private static reportXhr(xhrProxy: DdRumXhr): void {
|
|
187
250
|
|
|
251
|
+
const responseSize = calculateResponseSize(xhrProxy)
|
|
252
|
+
|
|
188
253
|
const context = xhrProxy._datadog_xhr
|
|
189
254
|
|
|
190
|
-
const key = context.startTime + "/"
|
|
191
|
-
+ context.method + "/"
|
|
192
|
-
+ context.startTime
|
|
255
|
+
const key = context.timer.startTime + "/" + context.method
|
|
193
256
|
|
|
194
|
-
|
|
257
|
+
context.timer.stop()
|
|
195
258
|
|
|
196
259
|
DdRum.startResource(
|
|
197
260
|
key,
|
|
198
261
|
context.method,
|
|
199
262
|
context.url,
|
|
200
|
-
context.startTime,
|
|
201
263
|
{
|
|
202
264
|
"_dd.span_id": context.spanId,
|
|
203
265
|
"_dd.trace_id": context.traceId
|
|
204
|
-
}
|
|
266
|
+
},
|
|
267
|
+
context.timer.startTime
|
|
205
268
|
).then(() => {
|
|
206
269
|
DdRum.stopResource(
|
|
207
270
|
key,
|
|
208
271
|
xhrProxy.status,
|
|
209
272
|
"xhr",
|
|
210
|
-
|
|
273
|
+
responseSize,
|
|
211
274
|
{
|
|
212
|
-
"_dd.resource_timings":
|
|
213
|
-
|
|
275
|
+
"_dd.resource_timings": context.timer.hasTickFor(RESPONSE_START_LABEL) ?
|
|
276
|
+
createTimings(
|
|
277
|
+
context.timer.startTime,
|
|
278
|
+
context.timer.timeAt(RESPONSE_START_LABEL),
|
|
279
|
+
context.timer.stopTime
|
|
280
|
+
) : null
|
|
281
|
+
},
|
|
282
|
+
context.timer.stopTime
|
|
283
|
+
);
|
|
214
284
|
})
|
|
215
285
|
}
|
|
216
286
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type Timer from "../../Timer";
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
export interface DdRumXhr extends XMLHttpRequest {
|
|
9
11
|
|
|
@@ -12,11 +14,10 @@ export interface DdRumXhr extends XMLHttpRequest {
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface DdRumXhrContext {
|
|
15
|
-
method: string
|
|
16
|
-
url: string
|
|
17
|
-
startTime: number,
|
|
18
|
-
responseStartTime: number,
|
|
17
|
+
method: string,
|
|
18
|
+
url: string,
|
|
19
19
|
reported: boolean,
|
|
20
|
+
timer: Timer,
|
|
20
21
|
spanId: string,
|
|
21
22
|
traceId: string
|
|
22
|
-
}
|
|
23
|
+
}
|
package/src/types.tsx
CHANGED
|
@@ -59,28 +59,28 @@ export type DdLogsType = {
|
|
|
59
59
|
* @param message: The message to send.
|
|
60
60
|
* @param context: The additional context to send.
|
|
61
61
|
*/
|
|
62
|
-
debug(message: string, context
|
|
62
|
+
debug(message: string, context?: object): Promise<void>;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Send a log with level info.
|
|
66
66
|
* @param message: The message to send.
|
|
67
67
|
* @param context: The additional context to send.
|
|
68
68
|
*/
|
|
69
|
-
info(message: string, context
|
|
69
|
+
info(message: string, context?: object): Promise<void>;
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Send a log with level warn.
|
|
73
73
|
* @param message: The message to send.
|
|
74
74
|
* @param context: The additional context to send.
|
|
75
75
|
*/
|
|
76
|
-
warn(message: string, context
|
|
76
|
+
warn(message: string, context?: object): Promise<void>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Send a log with level error.
|
|
80
80
|
* @param message: The message to send.
|
|
81
81
|
* @param context: The additional context to send.
|
|
82
82
|
*/
|
|
83
|
-
error(message: string, context
|
|
83
|
+
error(message: string, context?: object): Promise<void>;
|
|
84
84
|
|
|
85
85
|
};
|
|
86
86
|
|
|
@@ -91,18 +91,18 @@ export type DdTraceType = {
|
|
|
91
91
|
/**
|
|
92
92
|
* Start a span, and returns a unique identifier for the span.
|
|
93
93
|
* @param operation: The operation name of the span.
|
|
94
|
-
* @param timestampMs: The timestamp when the operation started (in milliseconds).
|
|
95
94
|
* @param context: The additional context to send.
|
|
95
|
+
* @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
|
|
96
96
|
*/
|
|
97
|
-
startSpan(operation: string,
|
|
97
|
+
startSpan(operation: string, context?: object, timestampMs?: number): Promise<string>;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* Finish a started span.
|
|
101
101
|
* @param spanId: The unique identifier of the span.
|
|
102
|
-
* @param timestampMs: The timestamp when the operation stopped (in milliseconds).
|
|
103
102
|
* @param context: The additional context to send.
|
|
103
|
+
* @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
104
104
|
*/
|
|
105
|
-
finishSpan(spanId: string,
|
|
105
|
+
finishSpan(spanId: string, context?: object, timestampMs?: number): Promise<void>;
|
|
106
106
|
|
|
107
107
|
};
|
|
108
108
|
|
|
@@ -114,73 +114,74 @@ export type DdRumType = {
|
|
|
114
114
|
* Start tracking a RUM View.
|
|
115
115
|
* @param key: The view unique key identifier.
|
|
116
116
|
* @param name: The view name.
|
|
117
|
-
* @param timestampMs: The timestamp when the view started (in milliseconds).
|
|
118
117
|
* @param context: The additional context to send.
|
|
118
|
+
* @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
|
|
119
119
|
*/
|
|
120
|
-
startView(key: string, name: string,
|
|
120
|
+
startView(key: string, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
123
|
* Stop tracking a RUM View.
|
|
124
124
|
* @param key: The view unique key identifier.
|
|
125
|
-
* @param timestampMs: The timestamp when the view stopped (in milliseconds).
|
|
126
125
|
* @param context: The additional context to send.
|
|
126
|
+
* @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
127
127
|
*/
|
|
128
|
-
stopView(key: string,
|
|
128
|
+
stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Start tracking a RUM Action.
|
|
132
132
|
* @param type: The action type (tap, scroll, swipe, click, custom).
|
|
133
133
|
* @param name: The action name.
|
|
134
|
-
* @param timestampMs: The timestamp when the action started (in milliseconds).
|
|
135
134
|
* @param context: The additional context to send.
|
|
135
|
+
* @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
|
|
136
136
|
*/
|
|
137
|
-
startAction(type: string, name: string,
|
|
137
|
+
startAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Stop tracking the ongoing RUM Action.
|
|
141
|
-
* @param timestampMs: The timestamp when the action stopped (in milliseconds).
|
|
142
141
|
* @param context: The additional context to send.
|
|
142
|
+
* @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
143
143
|
*/
|
|
144
|
-
stopAction(
|
|
144
|
+
stopAction(context?: object, timestampMs?: number): Promise<void>;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* Add a RUM Action.
|
|
148
148
|
* @param type: The action type (tap, scroll, swipe, click, custom).
|
|
149
149
|
* @param name: The action name.
|
|
150
|
-
* @param timestampMs: The timestamp when the action occurred (in milliseconds).
|
|
151
150
|
* @param context: The additional context to send.
|
|
151
|
+
* @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
152
152
|
*/
|
|
153
|
-
addAction(type: string, name: string,
|
|
153
|
+
addAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Start tracking a RUM Resource.
|
|
157
157
|
* @param key: The resource unique key identifier.
|
|
158
158
|
* @param method: The resource method (GET, POST, …).
|
|
159
159
|
* @param url: The resource url.
|
|
160
|
-
* @param timestampMs: The timestamp when the resource started (in milliseconds).
|
|
161
160
|
* @param context: The additional context to send.
|
|
161
|
+
* @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
|
|
162
162
|
*/
|
|
163
|
-
startResource(key: string, method: string, url: string,
|
|
163
|
+
startResource(key: string, method: string, url: string, context?: object, timestampMs?: number): Promise<void>;
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Stop tracking a RUM Resource.
|
|
167
167
|
* @param key: The resource unique key identifier.
|
|
168
168
|
* @param statusCode: The resource status code.
|
|
169
169
|
* @param kind: The resource's kind (xhr, document, image, css, font, …).
|
|
170
|
-
* @param
|
|
170
|
+
* @param size: The resource size in bytes. If size is unknown, use -1.
|
|
171
171
|
* @param context: The additional context to send.
|
|
172
|
+
* @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
172
173
|
*/
|
|
173
|
-
stopResource(key: string, statusCode: number, kind: string,
|
|
174
|
+
stopResource(key: string, statusCode: number, kind: string, size?: number, context?: object, timestampMs?: number): Promise<void>;
|
|
174
175
|
|
|
175
176
|
/**
|
|
176
177
|
* Add a RUM Error.
|
|
177
178
|
* @param message: The error message.
|
|
178
179
|
* @param source: The error source (network, source, console, logger, …).
|
|
179
180
|
* @param stacktrace: The error stacktrace.
|
|
180
|
-
* @param timestampMs: The timestamp when the error occurred (in milliseconds).
|
|
181
181
|
* @param context: The additional context to send.
|
|
182
|
+
* @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
182
183
|
*/
|
|
183
|
-
addError(message: string, source: string, stacktrace: string,
|
|
184
|
+
addError(message: string, source: string, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
|
|
184
185
|
|
|
185
186
|
/**
|
|
186
187
|
* Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.
|
package/src/version.ts
ADDED
package/android/.project
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<projectDescription>
|
|
3
|
-
<name>android_</name>
|
|
4
|
-
<comment>Project android_ created by Buildship.</comment>
|
|
5
|
-
<projects>
|
|
6
|
-
</projects>
|
|
7
|
-
<buildSpec>
|
|
8
|
-
<buildCommand>
|
|
9
|
-
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
10
|
-
<arguments>
|
|
11
|
-
</arguments>
|
|
12
|
-
</buildCommand>
|
|
13
|
-
</buildSpec>
|
|
14
|
-
<natures>
|
|
15
|
-
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
16
|
-
</natures>
|
|
17
|
-
</projectDescription>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
arguments=
|
|
2
|
-
auto.sync=false
|
|
3
|
-
build.scans.enabled=false
|
|
4
|
-
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0))
|
|
5
|
-
connection.project.dir=
|
|
6
|
-
eclipse.preferences.version=1
|
|
7
|
-
gradle.user.home=
|
|
8
|
-
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
|
|
9
|
-
jvm.arguments=
|
|
10
|
-
offline.mode=false
|
|
11
|
-
override.workspace.settings=true
|
|
12
|
-
show.console.view=true
|
|
13
|
-
show.executions.view=true
|
|
Binary file
|
package/android/gradlew
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2015 the original author or authors.
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
##############################################################################
|
|
20
|
-
##
|
|
21
|
-
## Gradle start up script for UN*X
|
|
22
|
-
##
|
|
23
|
-
##############################################################################
|
|
24
|
-
|
|
25
|
-
# Attempt to set APP_HOME
|
|
26
|
-
# Resolve links: $0 may be a link
|
|
27
|
-
PRG="$0"
|
|
28
|
-
# Need this for relative symlinks.
|
|
29
|
-
while [ -h "$PRG" ] ; do
|
|
30
|
-
ls=`ls -ld "$PRG"`
|
|
31
|
-
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
32
|
-
if expr "$link" : '/.*' > /dev/null; then
|
|
33
|
-
PRG="$link"
|
|
34
|
-
else
|
|
35
|
-
PRG=`dirname "$PRG"`"/$link"
|
|
36
|
-
fi
|
|
37
|
-
done
|
|
38
|
-
SAVED="`pwd`"
|
|
39
|
-
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
40
|
-
APP_HOME="`pwd -P`"
|
|
41
|
-
cd "$SAVED" >/dev/null
|
|
42
|
-
|
|
43
|
-
APP_NAME="Gradle"
|
|
44
|
-
APP_BASE_NAME=`basename "$0"`
|
|
45
|
-
|
|
46
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
47
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
48
|
-
|
|
49
|
-
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
50
|
-
MAX_FD="maximum"
|
|
51
|
-
|
|
52
|
-
warn () {
|
|
53
|
-
echo "$*"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
die () {
|
|
57
|
-
echo
|
|
58
|
-
echo "$*"
|
|
59
|
-
echo
|
|
60
|
-
exit 1
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
# OS specific support (must be 'true' or 'false').
|
|
64
|
-
cygwin=false
|
|
65
|
-
msys=false
|
|
66
|
-
darwin=false
|
|
67
|
-
nonstop=false
|
|
68
|
-
case "`uname`" in
|
|
69
|
-
CYGWIN* )
|
|
70
|
-
cygwin=true
|
|
71
|
-
;;
|
|
72
|
-
Darwin* )
|
|
73
|
-
darwin=true
|
|
74
|
-
;;
|
|
75
|
-
MINGW* )
|
|
76
|
-
msys=true
|
|
77
|
-
;;
|
|
78
|
-
NONSTOP* )
|
|
79
|
-
nonstop=true
|
|
80
|
-
;;
|
|
81
|
-
esac
|
|
82
|
-
|
|
83
|
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# Determine the Java command to use to start the JVM.
|
|
87
|
-
if [ -n "$JAVA_HOME" ] ; then
|
|
88
|
-
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
89
|
-
# IBM's JDK on AIX uses strange locations for the executables
|
|
90
|
-
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
91
|
-
else
|
|
92
|
-
JAVACMD="$JAVA_HOME/bin/java"
|
|
93
|
-
fi
|
|
94
|
-
if [ ! -x "$JAVACMD" ] ; then
|
|
95
|
-
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
96
|
-
|
|
97
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
98
|
-
location of your Java installation."
|
|
99
|
-
fi
|
|
100
|
-
else
|
|
101
|
-
JAVACMD="java"
|
|
102
|
-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
103
|
-
|
|
104
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
105
|
-
location of your Java installation."
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
# Increase the maximum file descriptors if we can.
|
|
109
|
-
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
110
|
-
MAX_FD_LIMIT=`ulimit -H -n`
|
|
111
|
-
if [ $? -eq 0 ] ; then
|
|
112
|
-
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
113
|
-
MAX_FD="$MAX_FD_LIMIT"
|
|
114
|
-
fi
|
|
115
|
-
ulimit -n $MAX_FD
|
|
116
|
-
if [ $? -ne 0 ] ; then
|
|
117
|
-
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
118
|
-
fi
|
|
119
|
-
else
|
|
120
|
-
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
121
|
-
fi
|
|
122
|
-
fi
|
|
123
|
-
|
|
124
|
-
# For Darwin, add options to specify how the application appears in the dock
|
|
125
|
-
if $darwin; then
|
|
126
|
-
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
130
|
-
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
131
|
-
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
132
|
-
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
133
|
-
|
|
134
|
-
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
135
|
-
|
|
136
|
-
# We build the pattern for arguments to be converted via cygpath
|
|
137
|
-
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
138
|
-
SEP=""
|
|
139
|
-
for dir in $ROOTDIRSRAW ; do
|
|
140
|
-
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
141
|
-
SEP="|"
|
|
142
|
-
done
|
|
143
|
-
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
144
|
-
# Add a user-defined pattern to the cygpath arguments
|
|
145
|
-
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
146
|
-
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
147
|
-
fi
|
|
148
|
-
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
149
|
-
i=0
|
|
150
|
-
for arg in "$@" ; do
|
|
151
|
-
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
152
|
-
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
153
|
-
|
|
154
|
-
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
155
|
-
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
156
|
-
else
|
|
157
|
-
eval `echo args$i`="\"$arg\""
|
|
158
|
-
fi
|
|
159
|
-
i=`expr $i + 1`
|
|
160
|
-
done
|
|
161
|
-
case $i in
|
|
162
|
-
0) set -- ;;
|
|
163
|
-
1) set -- "$args0" ;;
|
|
164
|
-
2) set -- "$args0" "$args1" ;;
|
|
165
|
-
3) set -- "$args0" "$args1" "$args2" ;;
|
|
166
|
-
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
167
|
-
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
168
|
-
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
169
|
-
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
170
|
-
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
171
|
-
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
172
|
-
esac
|
|
173
|
-
fi
|
|
174
|
-
|
|
175
|
-
# Escape application args
|
|
176
|
-
save () {
|
|
177
|
-
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
178
|
-
echo " "
|
|
179
|
-
}
|
|
180
|
-
APP_ARGS=`save "$@"`
|
|
181
|
-
|
|
182
|
-
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
183
|
-
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
184
|
-
|
|
185
|
-
exec "$JAVACMD" "$@"
|