@datadog/mobile-react-native 1.0.0-rc3 → 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/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/lib/commonjs/DdSdkReactNative.js +5 -0
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/foundation.js +13 -31
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +24 -4
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +87 -2
- 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 +4 -0
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/foundation.js +13 -31
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +23 -4
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js +83 -2
- 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 +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +4 -0
- package/lib/typescript/types.d.ts +12 -11
- package/lib/typescript/version.d.ts +1 -0
- package/package.json +3 -3
- package/src/DdSdkReactNative.tsx +4 -0
- package/src/__tests__/DdRumWrapper.test.tsx +91 -0
- package/src/__tests__/DdSdkReactNative.test.tsx +15 -0
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +104 -10
- package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +265 -15
- package/src/foundation.tsx +64 -70
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +28 -7
- package/src/rum/instrumentation/DdRumResourceTracking.tsx +74 -2
- package/src/types.tsx +12 -11
- package/src/version.ts +2 -0
package/src/foundation.tsx
CHANGED
|
@@ -9,87 +9,81 @@ import { DdSdkConfiguration, DdSdkType, DdLogsType, DdTraceType, DdRumType } fro
|
|
|
9
9
|
|
|
10
10
|
class DdLogsWrapper implements DdLogsType {
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
private nativeLogs: DdLogsType = NativeModules.DdLogs;
|
|
13
|
+
|
|
14
|
+
debug(message: string, context: object = {}): Promise<void> {
|
|
15
|
+
return this.nativeLogs.debug(message, context);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
info(message: string, context: object = {}): Promise<void> {
|
|
19
|
+
return this.nativeLogs.info(message, context);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
warn(message: string, context: object = {}): Promise<void> {
|
|
23
|
+
return this.nativeLogs.warn(message, context);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
error(message: string, context: object = {}): Promise<void> {
|
|
27
|
+
return this.nativeLogs.error(message, context);
|
|
28
|
+
}
|
|
26
29
|
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
class DdTraceWrapper implements DdTraceType {
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
private nativeTrace: DdTraceType = NativeModules.DdTrace;
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
finishSpan(spanId
|
|
39
|
-
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
return this.nativeTrace.finishSpan(spanId, timestampMs, context);
|
|
42
|
-
}
|
|
36
|
+
startSpan(operation: string, context: object = {}, timestampMs: number = Date.now()): Promise<string> {
|
|
37
|
+
return this.nativeTrace.startSpan(operation, context, timestampMs);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
finishSpan(spanId: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
41
|
+
return this.nativeTrace.finishSpan(spanId, context, timestampMs);
|
|
42
|
+
}
|
|
43
43
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
class DdRumWrapper implements DdRumType {
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
stopView(key
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
return this.nativeRum.addError(message, source, stacktrace, timestampMs, context);
|
|
89
|
-
}
|
|
90
|
-
addTiming(name: string): Promise<void> {
|
|
91
|
-
return this.nativeRum.addTiming(name);
|
|
92
|
-
}
|
|
48
|
+
private nativeRum: DdRumType = NativeModules.DdRum;
|
|
49
|
+
|
|
50
|
+
startView(key: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
51
|
+
return this.nativeRum.startView(key, name, context, timestampMs);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
stopView(key: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
55
|
+
return this.nativeRum.stopView(key, context, timestampMs);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
startAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
59
|
+
return this.nativeRum.startAction(type, name, context, timestampMs);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
stopAction(context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
63
|
+
return this.nativeRum.stopAction(context, timestampMs);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
addAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
67
|
+
return this.nativeRum.addAction(type, name, context, timestampMs);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
71
|
+
return this.nativeRum.startResource(key, method, url, context, timestampMs);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
stopResource(key: string, statusCode: number, kind: string, size: number = -1, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
75
|
+
return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
addError(message: string, source: string, stacktrace: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {
|
|
79
|
+
let updatedContext: any = context;
|
|
80
|
+
updatedContext["_dd.error.source_type"] = "react-native";
|
|
81
|
+
return this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
addTiming(name: string): Promise<void> {
|
|
85
|
+
return this.nativeRum.addTiming(name);
|
|
86
|
+
}
|
|
93
87
|
|
|
94
88
|
}
|
|
95
89
|
|
|
@@ -8,6 +8,7 @@ import type { ErrorHandlerCallback } from 'react-native';
|
|
|
8
8
|
import { DdRum } from '../../foundation';
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
const EMPTY_MESSAGE = "Unknown Error"
|
|
11
12
|
const EMPTY_STACK_TRACE = ""
|
|
12
13
|
const TYPE_SOURCE = "SOURCE"
|
|
13
14
|
const TYPE_CONSOLE = "CONSOLE"
|
|
@@ -52,10 +53,12 @@ export class DdRumErrorTracking {
|
|
|
52
53
|
|
|
53
54
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
54
55
|
static onGlobalError(error: any, isFatal?: boolean): void {
|
|
56
|
+
const message = DdRumErrorTracking.getErrorMessage(error);
|
|
57
|
+
const stacktrace = DdRumErrorTracking.getErrorStackTrace(error);
|
|
55
58
|
DdRum.addError(
|
|
56
|
-
|
|
59
|
+
message,
|
|
57
60
|
TYPE_SOURCE,
|
|
58
|
-
|
|
61
|
+
stacktrace,
|
|
59
62
|
{ "_dd.error.is_crash": isFatal, "_dd.error.raw": error }
|
|
60
63
|
).then(() => {
|
|
61
64
|
DdRumErrorTracking.isInDefaultErrorHandler = true;
|
|
@@ -76,17 +79,16 @@ export class DdRumErrorTracking {
|
|
|
76
79
|
let stack: string = EMPTY_STACK_TRACE;
|
|
77
80
|
for (let i = 0; i < params.length; i += 1) {
|
|
78
81
|
const param = params[i];
|
|
79
|
-
const paramStack = DdRumErrorTracking.getErrorStackTrace(param)
|
|
82
|
+
const paramStack = DdRumErrorTracking.getErrorStackTrace(param);
|
|
80
83
|
if (paramStack != undefined && paramStack != EMPTY_STACK_TRACE) {
|
|
81
84
|
stack = paramStack;
|
|
82
85
|
break;
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
const message = params.map((param) => {
|
|
87
|
-
if (typeof param === 'string') { return param }
|
|
88
|
-
else
|
|
89
|
-
else { return JSON.stringify(param) }
|
|
89
|
+
const message = params.map((param) => {
|
|
90
|
+
if (typeof param === 'string') { return param; }
|
|
91
|
+
else { return DdRumErrorTracking.getErrorMessage(param); }
|
|
90
92
|
}).join(' ');
|
|
91
93
|
|
|
92
94
|
|
|
@@ -100,17 +102,36 @@ export class DdRumErrorTracking {
|
|
|
100
102
|
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
private static getErrorMessage(error: any | undefined): string {
|
|
106
|
+
let message = EMPTY_MESSAGE;
|
|
107
|
+
if (error == undefined) {
|
|
108
|
+
message = EMPTY_MESSAGE;
|
|
109
|
+
} else if ("message" in error){
|
|
110
|
+
message = String(error.message);
|
|
111
|
+
} else {
|
|
112
|
+
message = String(error);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return message
|
|
116
|
+
}
|
|
117
|
+
|
|
103
118
|
private static getErrorStackTrace(error: any | undefined): string {
|
|
104
119
|
let stack = EMPTY_STACK_TRACE
|
|
120
|
+
|
|
105
121
|
if (error == undefined) {
|
|
106
122
|
stack = EMPTY_STACK_TRACE;
|
|
107
123
|
} else if (typeof error === 'string') {
|
|
108
124
|
stack = EMPTY_STACK_TRACE;
|
|
109
125
|
} else if ('componentStack' in error) {
|
|
110
126
|
stack = String(error.componentStack);
|
|
127
|
+
} else if ('stacktrace' in error) {
|
|
128
|
+
stack = String(error.stacktrace);
|
|
129
|
+
} else if ('stack' in error) {
|
|
130
|
+
stack = String(error.stack);
|
|
111
131
|
} else if (('sourceURL' in error) && ('line' in error) && ('column' in error)) {
|
|
112
132
|
stack = `at ${error.sourceURL}:${error.line}:${error.column}`;
|
|
113
133
|
}
|
|
134
|
+
|
|
114
135
|
return stack
|
|
115
136
|
}
|
|
116
137
|
}
|
|
@@ -13,9 +13,12 @@ import { generateTraceId } from './TraceIdentifier';
|
|
|
13
13
|
export const TRACE_ID_HEADER_KEY = "x-datadog-trace-id"
|
|
14
14
|
export const PARENT_ID_HEADER_KEY = "x-datadog-parent-id"
|
|
15
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"
|
|
16
18
|
export const ORIGIN_RUM = "rum"
|
|
17
19
|
|
|
18
20
|
const RESPONSE_START_LABEL = "response_start"
|
|
21
|
+
const MISSING_RESOURCE_SIZE = -1
|
|
19
22
|
|
|
20
23
|
interface Timing {
|
|
21
24
|
/**
|
|
@@ -71,6 +74,70 @@ function timeToNanos(durationMs: number): number {
|
|
|
71
74
|
return +(durationMs * 1e6).toFixed(0)
|
|
72
75
|
}
|
|
73
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
|
+
|
|
74
141
|
/**
|
|
75
142
|
* Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
|
|
76
143
|
*/
|
|
@@ -149,7 +216,8 @@ export class DdRumResourceTracking {
|
|
|
149
216
|
this.setRequestHeader(TRACE_ID_HEADER_KEY, this._datadog_xhr.traceId)
|
|
150
217
|
this.setRequestHeader(PARENT_ID_HEADER_KEY, this._datadog_xhr.spanId)
|
|
151
218
|
this.setRequestHeader(ORIGIN_HEADER_KEY, ORIGIN_RUM)
|
|
152
|
-
|
|
219
|
+
this.setRequestHeader(SAMPLING_PRIORITY_HEADER_KEY, "1")
|
|
220
|
+
this.setRequestHeader(SAMPLED_HEADER_KEY, "1")
|
|
153
221
|
}
|
|
154
222
|
|
|
155
223
|
DdRumResourceTracking.proxyOnReadyStateChange(this, xhrType);
|
|
@@ -180,6 +248,8 @@ export class DdRumResourceTracking {
|
|
|
180
248
|
|
|
181
249
|
private static reportXhr(xhrProxy: DdRumXhr): void {
|
|
182
250
|
|
|
251
|
+
const responseSize = calculateResponseSize(xhrProxy)
|
|
252
|
+
|
|
183
253
|
const context = xhrProxy._datadog_xhr
|
|
184
254
|
|
|
185
255
|
const key = context.timer.startTime + "/" + context.method
|
|
@@ -200,6 +270,7 @@ export class DdRumResourceTracking {
|
|
|
200
270
|
key,
|
|
201
271
|
xhrProxy.status,
|
|
202
272
|
"xhr",
|
|
273
|
+
responseSize,
|
|
203
274
|
{
|
|
204
275
|
"_dd.resource_timings": context.timer.hasTickFor(RESPONSE_START_LABEL) ?
|
|
205
276
|
createTimings(
|
|
@@ -208,7 +279,8 @@ export class DdRumResourceTracking {
|
|
|
208
279
|
context.timer.stopTime
|
|
209
280
|
) : null
|
|
210
281
|
},
|
|
211
|
-
context.timer.stopTime
|
|
282
|
+
context.timer.stopTime
|
|
283
|
+
);
|
|
212
284
|
})
|
|
213
285
|
}
|
|
214
286
|
|
package/src/types.tsx
CHANGED
|
@@ -92,7 +92,7 @@ export type DdTraceType = {
|
|
|
92
92
|
* Start a span, and returns a unique identifier for the span.
|
|
93
93
|
* @param operation: The operation name of the span.
|
|
94
94
|
* @param context: The additional context to send.
|
|
95
|
-
* @param timestampMs: The timestamp when the operation started (in milliseconds).
|
|
95
|
+
* @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
|
|
96
96
|
*/
|
|
97
97
|
startSpan(operation: string, context?: object, timestampMs?: number): Promise<string>;
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ export type DdTraceType = {
|
|
|
100
100
|
* Finish a started span.
|
|
101
101
|
* @param spanId: The unique identifier of the span.
|
|
102
102
|
* @param context: The additional context to send.
|
|
103
|
-
* @param timestampMs: The timestamp when the operation stopped (in milliseconds).
|
|
103
|
+
* @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
104
104
|
*/
|
|
105
105
|
finishSpan(spanId: string, context?: object, timestampMs?: number): Promise<void>;
|
|
106
106
|
|
|
@@ -115,7 +115,7 @@ export type DdRumType = {
|
|
|
115
115
|
* @param key: The view unique key identifier.
|
|
116
116
|
* @param name: The view name.
|
|
117
117
|
* @param context: The additional context to send.
|
|
118
|
-
* @param timestampMs: The timestamp when the view started (in milliseconds).
|
|
118
|
+
* @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
|
|
119
119
|
*/
|
|
120
120
|
startView(key: string, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
121
121
|
|
|
@@ -123,7 +123,7 @@ export type DdRumType = {
|
|
|
123
123
|
* Stop tracking a RUM View.
|
|
124
124
|
* @param key: The view unique key identifier.
|
|
125
125
|
* @param context: The additional context to send.
|
|
126
|
-
* @param timestampMs: The timestamp when the view stopped (in milliseconds).
|
|
126
|
+
* @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
127
127
|
*/
|
|
128
128
|
stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
|
|
129
129
|
|
|
@@ -132,14 +132,14 @@ export type DdRumType = {
|
|
|
132
132
|
* @param type: The action type (tap, scroll, swipe, click, custom).
|
|
133
133
|
* @param name: The action name.
|
|
134
134
|
* @param context: The additional context to send.
|
|
135
|
-
* @param timestampMs: The timestamp when the action started (in milliseconds).
|
|
135
|
+
* @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
|
|
136
136
|
*/
|
|
137
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
141
|
* @param context: The additional context to send.
|
|
142
|
-
* @param timestampMs: The timestamp when the action stopped (in milliseconds).
|
|
142
|
+
* @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
143
143
|
*/
|
|
144
144
|
stopAction(context?: object, timestampMs?: number): Promise<void>;
|
|
145
145
|
|
|
@@ -148,7 +148,7 @@ export type DdRumType = {
|
|
|
148
148
|
* @param type: The action type (tap, scroll, swipe, click, custom).
|
|
149
149
|
* @param name: The action name.
|
|
150
150
|
* @param context: The additional context to send.
|
|
151
|
-
* @param timestampMs: The timestamp when the action occurred (in milliseconds).
|
|
151
|
+
* @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
152
152
|
*/
|
|
153
153
|
addAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
154
154
|
|
|
@@ -158,7 +158,7 @@ export type DdRumType = {
|
|
|
158
158
|
* @param method: The resource method (GET, POST, …).
|
|
159
159
|
* @param url: The resource url.
|
|
160
160
|
* @param context: The additional context to send.
|
|
161
|
-
* @param timestampMs: The timestamp when the resource started (in milliseconds).
|
|
161
|
+
* @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
|
|
162
162
|
*/
|
|
163
163
|
startResource(key: string, method: string, url: string, context?: object, timestampMs?: number): Promise<void>;
|
|
164
164
|
|
|
@@ -167,10 +167,11 @@ export type DdRumType = {
|
|
|
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 size: The resource size in bytes. If size is unknown, use -1.
|
|
170
171
|
* @param context: The additional context to send.
|
|
171
|
-
* @param timestampMs: The timestamp when the resource stopped (in milliseconds).
|
|
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, context?: object, timestampMs?: number): Promise<void>;
|
|
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.
|
|
@@ -178,7 +179,7 @@ export type DdRumType = {
|
|
|
178
179
|
* @param source: The error source (network, source, console, logger, …).
|
|
179
180
|
* @param stacktrace: The error stacktrace.
|
|
180
181
|
* @param context: The additional context to send.
|
|
181
|
-
* @param timestampMs: The timestamp when the error occurred (in milliseconds).
|
|
182
|
+
* @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
182
183
|
*/
|
|
183
184
|
addError(message: string, source: string, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
|
|
184
185
|
|
package/src/version.ts
ADDED