@datadog/mobile-react-native 1.0.0-rc5 → 1.0.0-rc8
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 +48 -17
- package/android/build.gradle +1 -1
- package/android/gradle.properties +4 -4
- package/ios/Sources/DdSdk.swift +6 -3
- package/lib/commonjs/DdSdkReactNative.js +35 -31
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +20 -7
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/InternalLog.js +10 -5
- package/lib/commonjs/InternalLog.js.map +1 -1
- package/lib/commonjs/ProxyConfiguration.js.map +1 -1
- package/lib/commonjs/SdkVerbosity.js.map +1 -1
- package/lib/commonjs/TimeProvider.js +72 -0
- package/lib/commonjs/TimeProvider.js.map +1 -0
- package/lib/commonjs/Timer.js +10 -23
- package/lib/commonjs/Timer.js.map +1 -1
- package/lib/commonjs/TrackingConsent.js.map +1 -1
- package/lib/commonjs/foundation.js +19 -54
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +27 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js +16 -11
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +19 -23
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +118 -42
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js +46 -19
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumXhr.js +0 -4
- package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.js +1 -1
- package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js +34 -0
- package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/TraceIdentifier.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/URLHostParser.js +33 -0
- package/lib/commonjs/rum/instrumentation/URLHostParser.js.map +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +33 -29
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +21 -8
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/InternalLog.js +11 -5
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/ProxyConfiguration.js.map +1 -1
- package/lib/module/SdkVerbosity.js.map +1 -1
- package/lib/module/TimeProvider.js +63 -0
- package/lib/module/TimeProvider.js.map +1 -0
- package/lib/module/Timer.js +14 -23
- package/lib/module/Timer.js.map +1 -1
- package/lib/module/TrackingConsent.js.map +1 -1
- package/lib/module/foundation.js +16 -39
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js +12 -10
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +19 -23
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js +113 -39
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js +44 -17
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumXhr.js +1 -1
- package/lib/module/rum/instrumentation/NoOpEventsInterceptor.js +1 -1
- package/lib/module/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js +25 -0
- package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
- package/lib/module/rum/instrumentation/TraceIdentifier.js.map +1 -1
- package/lib/module/rum/instrumentation/URLHostParser.js +24 -0
- package/lib/module/rum/instrumentation/URLHostParser.js.map +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts +6 -6
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +15 -3
- package/lib/typescript/InternalLog.d.ts +5 -0
- package/lib/typescript/TimeProvider.d.ts +20 -0
- package/lib/typescript/Timer.d.ts +3 -2
- package/lib/typescript/index.d.ts +4 -3
- package/lib/typescript/rum/instrumentation/DdEventsInterceptor.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +2 -2
- package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +19 -9
- package/lib/typescript/rum/instrumentation/DdRumUserInteractionTracking.d.ts +3 -3
- package/lib/typescript/rum/instrumentation/DdRumXhr.d.ts +13 -3
- package/lib/typescript/rum/instrumentation/ShallowObjectEqualityChecker.d.ts +4 -0
- package/lib/typescript/rum/instrumentation/URLHostParser.d.ts +6 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +6 -3
- package/src/DdSdkReactNative.tsx +116 -70
- package/src/DdSdkReactNativeConfiguration.tsx +22 -13
- package/src/InternalLog.tsx +18 -16
- package/src/ProxyConfiguration.tsx +5 -5
- package/src/SdkVerbosity.tsx +4 -4
- package/src/TimeProvider.tsx +64 -0
- package/src/Timer.ts +20 -35
- package/src/TrackingConsent.tsx +3 -3
- package/src/__mocks__/InternalLog.tsx +9 -0
- package/src/__tests__/DdRumWrapper.test.tsx +40 -33
- package/src/__tests__/DdSdkReactNative.test.tsx +712 -513
- package/src/__tests__/InternalLog.test.tsx +114 -117
- package/src/__tests__/TimeProvider.test.tsx +75 -0
- package/src/__tests__/Timer.test.ts +148 -57
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +151 -92
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +168 -116
- package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +789 -644
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +239 -85
- package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +31 -0
- package/src/__tests__/rum/instrumentation/TraceIdentifier.test.tsx +13 -15
- package/src/__tests__/rum/instrumentation/URLHostParser.test.ts +40 -0
- package/src/__tests__/rum/instrumentation/__utils__/XMLHttpRequestMock.ts +97 -0
- package/src/foundation.tsx +13 -10
- package/src/index.tsx +15 -4
- package/src/rum/instrumentation/DdEventsInterceptor.tsx +51 -35
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +49 -44
- package/src/rum/instrumentation/DdRumResourceTracking.tsx +369 -234
- package/src/rum/instrumentation/DdRumUserInteractionTracking.tsx +72 -29
- package/src/rum/instrumentation/DdRumXhr.tsx +21 -11
- package/src/rum/instrumentation/EventsInterceptor.tsx +3 -3
- package/src/rum/instrumentation/NoOpEventsInterceptor.tsx +2 -2
- package/src/rum/instrumentation/ShallowObjectEqualityChecker.ts +24 -0
- package/src/rum/instrumentation/TraceIdentifier.tsx +19 -19
- package/src/rum/instrumentation/URLHostParser.ts +23 -0
- package/src/types.tsx +199 -158
- package/src/version.ts +1 -1
package/lib/commonjs/Timer.js
CHANGED
|
@@ -5,18 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _TimeProvider = require("./TimeProvider");
|
|
9
|
+
|
|
8
10
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
11
|
|
|
10
|
-
const START_LABEL =
|
|
11
|
-
const STOP_LABEL =
|
|
12
|
+
const START_LABEL = '__start';
|
|
13
|
+
const STOP_LABEL = '__stop';
|
|
12
14
|
/**
|
|
13
15
|
* Simple timer which records time ticks. Shouldn't be re-used once stopped.
|
|
14
16
|
* All timestamps/durations returned are in milliseconds.
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
class Timer {
|
|
18
|
-
constructor() {
|
|
20
|
+
constructor(timeProvider = new _TimeProvider.TimeProvider()) {
|
|
21
|
+
_defineProperty(this, "timeProvider", void 0);
|
|
22
|
+
|
|
19
23
|
_defineProperty(this, "times", {});
|
|
24
|
+
|
|
25
|
+
this.timeProvider = timeProvider;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
get startTime() {
|
|
@@ -36,10 +42,7 @@ class Timer {
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
recordTick(label) {
|
|
39
|
-
this.times[label] =
|
|
40
|
-
unix: Date.now(),
|
|
41
|
-
react_native: this.performanceNow()
|
|
42
|
-
};
|
|
45
|
+
this.times[label] = this.timeProvider.getTimestamp();
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
hasTickFor(label) {
|
|
@@ -71,22 +74,6 @@ class Timer {
|
|
|
71
74
|
return end.unix - start.unix;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
performanceNow() {
|
|
75
|
-
if (this.canUsePerformanceNow()) {
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
return performance.now();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
canUsePerformanceNow() {
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
86
|
-
// @ts-ignore
|
|
87
|
-
return global.performance && typeof performance.now === 'function';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
77
|
checkLabelExists(label) {
|
|
91
78
|
if (!this.hasTickFor(label)) {
|
|
92
79
|
throw new Error(`Label ${label} is not registered`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Timer.ts"],"names":["START_LABEL","STOP_LABEL","Timer","startTime","times","unix","stopTime","durationBetween","start","recordTick","stop","label","
|
|
1
|
+
{"version":3,"sources":["Timer.ts"],"names":["START_LABEL","STOP_LABEL","Timer","constructor","timeProvider","TimeProvider","startTime","times","unix","stopTime","durationBetween","start","recordTick","stop","label","getTimestamp","hasTickFor","startLabel","endLabel","checkLabelExists","startTick","endTick","durationBetweenTicks","timeAt","reset","end","react_native","Error"],"mappings":";;;;;;;AAOA;;;;AAEA,MAAMA,WAAW,GAAG,SAApB;AACA,MAAMC,UAAU,GAAG,QAAnB;AAEA;AACA;AACA;AACA;;AACe,MAAMC,KAAN,CAAY;AAIvBC,EAAAA,WAAW,CAACC,YAA0B,GAAG,IAAIC,0BAAJ,EAA9B,EAAkD;AAAA;;AAAA,mCAFlB,EAEkB;;AACzD,SAAKD,YAAL,GAAoBA,YAApB;AACH;;AAEY,MAATE,SAAS,GAAW;AACpB,WAAO,KAAKC,KAAL,CAAWP,WAAX,EAAwBQ,IAA/B;AACH;;AAEW,MAARC,QAAQ,GAAW;AACnB,WAAO,KAAKH,SAAL,GAAiB,KAAKI,eAAL,CAAqBV,WAArB,EAAkCC,UAAlC,CAAxB;AACH;;AAEDU,EAAAA,KAAK,GAAS;AACV,SAAKC,UAAL,CAAgBZ,WAAhB;AACH;;AAEDa,EAAAA,IAAI,GAAS;AACT,SAAKD,UAAL,CAAgBX,UAAhB;AACH;;AAEDW,EAAAA,UAAU,CAACE,KAAD,EAAsB;AAC5B,SAAKP,KAAL,CAAWO,KAAX,IAAoB,KAAKV,YAAL,CAAkBW,YAAlB,EAApB;AACH;;AAEDC,EAAAA,UAAU,CAACF,KAAD,EAAyB;AAC/B,WAAOA,KAAK,IAAI,KAAKP,KAArB;AACH;;AAEDG,EAAAA,eAAe,CAACO,UAAD,EAAqBC,QAArB,EAA+C;AAC1D,SAAKC,gBAAL,CAAsBF,UAAtB;AACA,SAAKE,gBAAL,CAAsBD,QAAtB;AAEA,UAAME,SAAS,GAAG,KAAKb,KAAL,CAAWU,UAAX,CAAlB;AACA,UAAMI,OAAO,GAAG,KAAKd,KAAL,CAAWW,QAAX,CAAhB;AAEA,WAAO,KAAKI,oBAAL,CAA0BF,SAA1B,EAAqCC,OAArC,CAAP;AACH;;AAEDE,EAAAA,MAAM,CAACT,KAAD,EAAwB;AAC1B,SAAKK,gBAAL,CAAsBL,KAAtB;AAEA,WAAO,KAAKR,SAAL,GAAiB,KAAKI,eAAL,CAAqBV,WAArB,EAAkCc,KAAlC,CAAxB;AACH;;AAEDU,EAAAA,KAAK,GAAS;AACV,SAAKjB,KAAL,GAAa,EAAb;AACH;;AAEOe,EAAAA,oBAAoB,CAACX,KAAD,EAAmBc,GAAnB,EAA2C;AACnE,QAAId,KAAK,CAACe,YAAN,IAAsB,IAAtB,IAA8BD,GAAG,CAACC,YAAJ,IAAoB,IAAtD,EAA4D;AACxD,aAAOD,GAAG,CAACC,YAAJ,GAAmBf,KAAK,CAACe,YAAhC;AACH;;AACD,WAAOD,GAAG,CAACjB,IAAJ,GAAWG,KAAK,CAACH,IAAxB;AACH;;AAEOW,EAAAA,gBAAgB,CAACL,KAAD,EAAgB;AACpC,QAAI,CAAC,KAAKE,UAAL,CAAgBF,KAAhB,CAAL,EAA6B;AACzB,YAAM,IAAIa,KAAJ,CAAW,SAAQb,KAAM,oBAAzB,CAAN;AACH;AACJ;;AA/DsB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { Timestamp } from './TimeProvider';\nimport { TimeProvider } from './TimeProvider';\n\nconst START_LABEL = '__start';\nconst STOP_LABEL = '__stop';\n\n/**\n * Simple timer which records time ticks. Shouldn't be re-used once stopped.\n * All timestamps/durations returned are in milliseconds.\n */\nexport default class Timer {\n private timeProvider: TimeProvider;\n private times: Record<string, Timestamp> = {};\n\n constructor(timeProvider: TimeProvider = new TimeProvider()) {\n this.timeProvider = timeProvider;\n }\n\n get startTime(): number {\n return this.times[START_LABEL].unix;\n }\n\n get stopTime(): number {\n return this.startTime + this.durationBetween(START_LABEL, STOP_LABEL);\n }\n\n start(): void {\n this.recordTick(START_LABEL);\n }\n\n stop(): void {\n this.recordTick(STOP_LABEL);\n }\n\n recordTick(label: string): void {\n this.times[label] = this.timeProvider.getTimestamp();\n }\n\n hasTickFor(label: string): boolean {\n return label in this.times;\n }\n\n durationBetween(startLabel: string, endLabel: string): number {\n this.checkLabelExists(startLabel);\n this.checkLabelExists(endLabel);\n\n const startTick = this.times[startLabel];\n const endTick = this.times[endLabel];\n\n return this.durationBetweenTicks(startTick, endTick);\n }\n\n timeAt(label: string): number {\n this.checkLabelExists(label);\n\n return this.startTime + this.durationBetween(START_LABEL, label);\n }\n\n reset(): void {\n this.times = {};\n }\n\n private durationBetweenTicks(start: Timestamp, end: Timestamp): number {\n if (start.react_native != null && end.react_native != null) {\n return end.react_native - start.react_native;\n }\n return end.unix - start.unix;\n }\n\n private checkLabelExists(label: string) {\n if (!this.hasTickFor(label)) {\n throw new Error(`Label ${label} is not registered`);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["TrackingConsent.tsx"],"names":["TrackingConsent"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;IACYA,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * Enum specifying possible consent options for DD SDK.\n */\nexport enum TrackingConsent {\n PENDING =
|
|
1
|
+
{"version":3,"sources":["TrackingConsent.tsx"],"names":["TrackingConsent"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;IACYA,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * Enum specifying possible consent options for DD SDK.\n */\nexport enum TrackingConsent {\n PENDING = 'pending',\n GRANTED = 'granted',\n NOT_GRANTED = 'not_granted'\n}\n"]}
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DdSdk = exports.DdRum = exports.DdLogs = void 0;
|
|
7
6
|
Object.defineProperty(exports, "DdSdkConfiguration", {
|
|
8
7
|
enumerable: true,
|
|
9
8
|
get: function () {
|
|
10
9
|
return _types.DdSdkConfiguration;
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
|
-
exports.DdTrace = void 0;
|
|
12
|
+
exports.DdRum = exports.DdTrace = exports.DdLogs = exports.DdSdk = void 0;
|
|
14
13
|
|
|
15
14
|
var _reactNative = require("react-native");
|
|
16
15
|
|
|
@@ -20,40 +19,36 @@ var _InternalLog = require("./InternalLog");
|
|
|
20
19
|
|
|
21
20
|
var _SdkVerbosity = require("./SdkVerbosity");
|
|
22
21
|
|
|
22
|
+
var _TimeProvider = require("./TimeProvider");
|
|
23
|
+
|
|
23
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
25
|
|
|
26
|
+
const timeProvider = new _TimeProvider.TimeProvider();
|
|
27
|
+
|
|
25
28
|
class DdLogsWrapper {
|
|
26
29
|
constructor() {
|
|
27
30
|
_defineProperty(this, "nativeLogs", _reactNative.NativeModules.DdLogs);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
debug(message) {
|
|
31
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
32
|
-
|
|
33
|
+
debug(message, context = {}) {
|
|
33
34
|
_InternalLog.InternalLog.log("Tracking debug log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
34
35
|
|
|
35
36
|
return this.nativeLogs.debug(message, context);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
info(message) {
|
|
39
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
|
-
|
|
39
|
+
info(message, context = {}) {
|
|
41
40
|
_InternalLog.InternalLog.log("Tracking info log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
42
41
|
|
|
43
42
|
return this.nativeLogs.info(message, context);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
warn(message) {
|
|
47
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
48
|
-
|
|
45
|
+
warn(message, context = {}) {
|
|
49
46
|
_InternalLog.InternalLog.log("Tracking warn log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
50
47
|
|
|
51
48
|
return this.nativeLogs.warn(message, context);
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
error(message) {
|
|
55
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
56
|
-
|
|
51
|
+
error(message, context = {}) {
|
|
57
52
|
_InternalLog.InternalLog.log("Tracking error log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
58
53
|
|
|
59
54
|
return this.nativeLogs.error(message, context);
|
|
@@ -66,9 +61,7 @@ class DdTraceWrapper {
|
|
|
66
61
|
_defineProperty(this, "nativeTrace", _reactNative.NativeModules.DdTrace);
|
|
67
62
|
}
|
|
68
63
|
|
|
69
|
-
startSpan(operation) {
|
|
70
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
71
|
-
let timestampMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
|
|
64
|
+
startSpan(operation, context = {}, timestampMs = timeProvider.now()) {
|
|
72
65
|
let spanId = this.nativeTrace.startSpan(operation, context, timestampMs);
|
|
73
66
|
|
|
74
67
|
_InternalLog.InternalLog.log("Starting span “" + operation + "” #" + spanId, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
@@ -76,10 +69,7 @@ class DdTraceWrapper {
|
|
|
76
69
|
return spanId;
|
|
77
70
|
}
|
|
78
71
|
|
|
79
|
-
finishSpan(spanId) {
|
|
80
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
81
|
-
let timestampMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
|
|
82
|
-
|
|
72
|
+
finishSpan(spanId, context = {}, timestampMs = timeProvider.now()) {
|
|
83
73
|
_InternalLog.InternalLog.log("Finishing span #" + spanId, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
84
74
|
|
|
85
75
|
return this.nativeTrace.finishSpan(spanId, context, timestampMs);
|
|
@@ -92,74 +82,49 @@ class DdRumWrapper {
|
|
|
92
82
|
_defineProperty(this, "nativeRum", _reactNative.NativeModules.DdRum);
|
|
93
83
|
}
|
|
94
84
|
|
|
95
|
-
startView(key, name) {
|
|
96
|
-
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
97
|
-
let timestampMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Date.now();
|
|
98
|
-
|
|
85
|
+
startView(key, name, context = {}, timestampMs = timeProvider.now()) {
|
|
99
86
|
_InternalLog.InternalLog.log("Starting RUM View “" + name + "” #" + key, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
100
87
|
|
|
101
88
|
return this.nativeRum.startView(key, name, context, timestampMs);
|
|
102
89
|
}
|
|
103
90
|
|
|
104
|
-
stopView(key) {
|
|
105
|
-
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106
|
-
let timestampMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
|
|
107
|
-
|
|
91
|
+
stopView(key, context = {}, timestampMs = timeProvider.now()) {
|
|
108
92
|
_InternalLog.InternalLog.log("Stopping RUM View #" + key, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
109
93
|
|
|
110
94
|
return this.nativeRum.stopView(key, context, timestampMs);
|
|
111
95
|
}
|
|
112
96
|
|
|
113
|
-
startAction(type, name) {
|
|
114
|
-
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
115
|
-
let timestampMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Date.now();
|
|
116
|
-
|
|
97
|
+
startAction(type, name, context = {}, timestampMs = timeProvider.now()) {
|
|
117
98
|
_InternalLog.InternalLog.log("Starting RUM Action “" + name + "” (" + type + ")", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
118
99
|
|
|
119
100
|
return this.nativeRum.startAction(type, name, context, timestampMs);
|
|
120
101
|
}
|
|
121
102
|
|
|
122
|
-
stopAction() {
|
|
123
|
-
let context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
124
|
-
let timestampMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
|
|
125
|
-
|
|
103
|
+
stopAction(context = {}, timestampMs = timeProvider.now()) {
|
|
126
104
|
_InternalLog.InternalLog.log("Stopping current RUM Action", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
127
105
|
|
|
128
106
|
return this.nativeRum.stopAction(context, timestampMs);
|
|
129
107
|
}
|
|
130
108
|
|
|
131
|
-
addAction(type, name) {
|
|
132
|
-
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
133
|
-
let timestampMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Date.now();
|
|
134
|
-
|
|
109
|
+
addAction(type, name, context = {}, timestampMs = timeProvider.now()) {
|
|
135
110
|
_InternalLog.InternalLog.log("Adding RUM Action “" + name + "” (" + type + ")", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
136
111
|
|
|
137
112
|
return this.nativeRum.addAction(type, name, context, timestampMs);
|
|
138
113
|
}
|
|
139
114
|
|
|
140
|
-
startResource(key, method, url) {
|
|
141
|
-
let context = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
142
|
-
let timestampMs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Date.now();
|
|
143
|
-
|
|
115
|
+
startResource(key, method, url, context = {}, timestampMs = timeProvider.now()) {
|
|
144
116
|
_InternalLog.InternalLog.log("Starting RUM Resource #" + key + " " + method + ": " + url, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
145
117
|
|
|
146
118
|
return this.nativeRum.startResource(key, method, url, context, timestampMs);
|
|
147
119
|
}
|
|
148
120
|
|
|
149
|
-
stopResource(key, statusCode, kind) {
|
|
150
|
-
let size = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
|
|
151
|
-
let context = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
152
|
-
let timestampMs = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : Date.now();
|
|
153
|
-
|
|
121
|
+
stopResource(key, statusCode, kind, size = -1, context = {}, timestampMs = timeProvider.now()) {
|
|
154
122
|
_InternalLog.InternalLog.log("Stopping RUM Resource #" + key + " status:" + statusCode, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
155
123
|
|
|
156
124
|
return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);
|
|
157
125
|
}
|
|
158
126
|
|
|
159
|
-
addError(message, source, stacktrace) {
|
|
160
|
-
let context = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
161
|
-
let timestampMs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Date.now();
|
|
162
|
-
|
|
127
|
+
addError(message, source, stacktrace, context = {}, timestampMs = timeProvider.now()) {
|
|
163
128
|
_InternalLog.InternalLog.log("Adding RUM Error “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
164
129
|
|
|
165
130
|
let updatedContext = context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["foundation.tsx"],"names":["DdLogsWrapper","NativeModules","DdLogs","debug","message","context","InternalLog","log","SdkVerbosity","DEBUG","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","Date","now","spanId","nativeTrace","finishSpan","DdRumWrapper","DdRum","startView","key","name","nativeRum","stopView","startAction","type","stopAction","addAction","startResource","method","url","stopResource","statusCode","kind","size","addError","source","stacktrace","updatedContext","addTiming","DdSdk"],"mappings":";;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,aAAN,CAA0C;AAAA;AAAA,wCAELC,2BAAcC,MAFT;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAuD;AAAA,QAArCC,OAAqC,uEAAnB,EAAmB;;AACxDC,6BAAYC,GAAZ,CAAgB,yBAA0BH,OAA1B,GAAoC,GAApD,EAAyDI,2BAAaC,KAAtE;;AACA,WAAO,KAAKC,UAAL,CAAgBP,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAEDM,EAAAA,IAAI,CAACP,OAAD,EAAuD;AAAA,QAArCC,OAAqC,uEAAnB,EAAmB;;AACvDC,6BAAYC,GAAZ,CAAgB,wBAAyBH,OAAzB,GAAmC,GAAnD,EAAwDI,2BAAaC,KAArE;;AACA,WAAO,KAAKC,UAAL,CAAgBC,IA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AiD,uEAA3BC,IAAI,CAACC,GAAL,EAA2B;;AAClJd,6BAAYC,GAAZ,CAAgB,4BAA4BoB,GAA5B,GAAkC,UAAlC,GAA+CY,UAA/D,EAA2E/B,2BAAaC,KAAxF;;AACA,WAAO,KAAKoB,SAAL,CAAeS,YAAf,CAA4BX,GAA5B,EAAiCY,UAAjC,EAA6CC,IAA7C,EAAmDC,IAAnD,EAAyDpC,OAAzD,EAAkEa,WAAlE,CAAP;AACH;;AAEDwB,EAAAA,QAAQ,CAACtC,OAAD,EAAkBuC,MAAlB,EAAkCC,UAAlC,EAA6H;AAAA,QAAvEvC,OAAuE,uEAArD,EAAqD;AAAA,QAAjDa,WAAiD,uEAA3BC,IAAI,CAACC,GAAL,EAA2B;;AACjId,6BAAYC,GAAZ,CAAgB,uBAAuBH,OAAvB,GAAiC,GAAjD,EAAsDI,2BAAaC,KAAnE;;AACA,QAAIoC,cAAmB,GAAGxC,OAA1B;AACAwC,IAAAA,cAAc,CAAC,uBAAD,CAAd,GAA0C,cAA1C;AACA,WAAO,KAAKhB,SAAL,CAAea,QAAf,CAAwBtC,OAAxB,EAAiCuC,MAAjC,EAAyCC,UAAzC,EAAqDC,cAArD,EAAqE3B,WAArE,CAAP;AACH;;AAED4B,EAAAA,SAAS,CAAClB,IAAD,EAA8B;AACnCtB,6BAAYC,GAAZ,CAAgB,oBAAoBqB,IAApB,GAA2B,eAA3C,EAA4DpB,2BAAaC,KAAzE;;AACA,WAAO,KAAKoB,SAAL,CAAeiB,SAAf,CAAyBlB,IAAzB,CAAP;AACH;;AAjDmC;;AAoDxC,MAAMmB,KAAgB,GAAG9C,2BAAc8C,KAAvC;;AACA,MAAM7C,MAAkB,GAAG,IAAIF,aAAJ,EAA3B;;AACA,MAAMe,OAAoB,GAAG,IAAID,cAAJ,EAA7B;;AACA,MAAMW,KAAgB,GAAG,IAAID,YAAJ,EAAzB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdSdkType, DdLogsType, DdTraceType, DdRumType } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking debug log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.debug(message, context);\n }\n\n info(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking info log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.info(message, context);\n }\n\n warn(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking warn log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.warn(message, context);\n }\n\n error(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking error log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.error(message, context);\n }\n\n}\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = Date.now()): Promise<string> {\n let spanId = this.nativeTrace.startSpan(operation, context, timestampMs);\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return this.nativeTrace.finishSpan(spanId, context, timestampMs);\n }\n}\n\nclass DdRumWrapper implements DdRumType {\n\n private nativeRum: DdRumType = NativeModules.DdRum;\n\n startView(key: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Starting RUM View “\" + name + \"” #\" + key, SdkVerbosity.DEBUG);\n return this.nativeRum.startView(key, name, context, timestampMs);\n }\n\n stopView(key: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM View #\" + key, SdkVerbosity.DEBUG);\n return this.nativeRum.stopView(key, context, timestampMs);\n }\n\n startAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n return this.nativeRum.startAction(type, name, context, timestampMs);\n }\n\n stopAction(context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Stopping current RUM Action\", SdkVerbosity.DEBUG);\n return this.nativeRum.stopAction(context, timestampMs);\n }\n\n addAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n return this.nativeRum.addAction(type, name, context, timestampMs);\n }\n\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Resource #\" + key + \" \" + method + \": \" + url, SdkVerbosity.DEBUG);\n return this.nativeRum.startResource(key, method, url, context, timestampMs);\n }\n\n stopResource(key: string, statusCode: number, kind: string, size: number = -1, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM Resource #\" + key + \" status:\" + statusCode, SdkVerbosity.DEBUG);\n return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);\n }\n\n addError(message: string, source: string, stacktrace: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Error “\" + message + \"”\", SdkVerbosity.DEBUG);\n let updatedContext: any = context;\n updatedContext[\"_dd.error.source_type\"] = \"react-native\";\n return this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs);\n }\n\n addTiming(name: string): Promise<void> {\n InternalLog.log(\"Adding timing “\" + name + \"” to RUM View\", SdkVerbosity.DEBUG);\n return this.nativeRum.addTiming(name);\n }\n}\n\nconst DdSdk: DdSdkType = NativeModules.DdSdk;\nconst DdLogs: DdLogsType = new DdLogsWrapper();\nconst DdTrace: DdTraceType = new DdTraceWrapper();\nconst DdRum: DdRumType = new DdRumWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };\n"]}
|
|
1
|
+
{"version":3,"sources":["foundation.tsx"],"names":["timeProvider","TimeProvider","DdLogsWrapper","NativeModules","DdLogs","debug","message","context","InternalLog","log","SdkVerbosity","DEBUG","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","now","spanId","nativeTrace","finishSpan","DdRumWrapper","DdRum","startView","key","name","nativeRum","stopView","startAction","type","stopAction","addAction","startResource","method","url","stopResource","statusCode","kind","size","addError","source","stacktrace","updatedContext","addTiming","DdSdk"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCAELC,2BAAcC,MAFT;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxDC,6BAAYC,GAAZ,CAAgB,yBAA0BH,OAA1B,GAAoC,GAApD,EAAyDI,2BAAaC,KAAtE;;AACA,WAAO,KAAKC,UAAL,CAAgBP,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAEDM,EAAAA,IAAI,CAACP,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvDC,6BAAYC,GAAZ,CAAgB,wBAAyBH,OAAzB,GAAmC,GAAnD,EAAwDI,2BAAaC,KAArE;;AACA,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBP,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AAEDO,EAAAA,IAAI,CAACR,OAAD,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AAzD,EAAkEa,WAAlE,CAAP;AACH;;AAEDuB,EAAAA,QAAQ,CAACrC,OAAD,EAAkBsC,MAAlB,EAAkCC,UAAlC,EAAsDtC,OAAe,GAAG,EAAxE,EAA4Ea,WAAmB,GAAGpB,YAAY,CAACqB,GAAb,EAAlG,EAAqI;AACzIb,6BAAYC,GAAZ,CAAgB,uBAAuBH,OAAvB,GAAiC,GAAjD,EAAsDI,2BAAaC,KAAnE;;AACA,QAAImC,cAAmB,GAAGvC,OAA1B;AACAuC,IAAAA,cAAc,CAAC,uBAAD,CAAd,GAA0C,cAA1C;AACA,WAAO,KAAKhB,SAAL,CAAea,QAAf,CAAwBrC,OAAxB,EAAiCsC,MAAjC,EAAyCC,UAAzC,EAAqDC,cAArD,EAAqE1B,WAArE,CAAP;AACH;;AAED2B,EAAAA,SAAS,CAAClB,IAAD,EAA8B;AACnCrB,6BAAYC,GAAZ,CAAgB,oBAAoBoB,IAApB,GAA2B,eAA3C,EAA4DnB,2BAAaC,KAAzE;;AACA,WAAO,KAAKmB,SAAL,CAAeiB,SAAf,CAAyBlB,IAAzB,CAAP;AACH;;AAjDmC;;AAoDxC,MAAMmB,KAAgB,GAAG7C,2BAAc6C,KAAvC;;AACA,MAAM5C,MAAkB,GAAG,IAAIF,aAAJ,EAA3B;;AACA,MAAMe,OAAoB,GAAG,IAAID,cAAJ,EAA7B;;AACA,MAAMU,KAAgB,GAAG,IAAID,YAAJ,EAAzB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdSdkType, DdLogsType, DdTraceType, DdRumType } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\n\nconst timeProvider = new TimeProvider();\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking debug log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.debug(message, context);\n }\n\n info(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking info log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.info(message, context);\n }\n\n warn(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking warn log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.warn(message, context);\n }\n\n error(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking error log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.error(message, context);\n }\n\n}\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = this.nativeTrace.startSpan(operation, context, timestampMs);\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return this.nativeTrace.finishSpan(spanId, context, timestampMs);\n }\n}\n\nclass DdRumWrapper implements DdRumType {\n\n private nativeRum: DdRumType = NativeModules.DdRum;\n\n startView(key: string, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM View “\" + name + \"” #\" + key, SdkVerbosity.DEBUG);\n return this.nativeRum.startView(key, name, context, timestampMs);\n }\n\n stopView(key: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM View #\" + key, SdkVerbosity.DEBUG);\n return this.nativeRum.stopView(key, context, timestampMs);\n }\n\n startAction(type: string, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n return this.nativeRum.startAction(type, name, context, timestampMs);\n }\n\n stopAction(context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping current RUM Action\", SdkVerbosity.DEBUG);\n return this.nativeRum.stopAction(context, timestampMs);\n }\n\n addAction(type: string, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n return this.nativeRum.addAction(type, name, context, timestampMs);\n }\n\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Resource #\" + key + \" \" + method + \": \" + url, SdkVerbosity.DEBUG);\n return this.nativeRum.startResource(key, method, url, context, timestampMs);\n }\n\n stopResource(key: string, statusCode: number, kind: string, size: number = -1, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM Resource #\" + key + \" status:\" + statusCode, SdkVerbosity.DEBUG);\n return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);\n }\n\n addError(message: string, source: string, stacktrace: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Error “\" + message + \"”\", SdkVerbosity.DEBUG);\n let updatedContext: any = context;\n updatedContext[\"_dd.error.source_type\"] = \"react-native\";\n return this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs);\n }\n\n addTiming(name: string): Promise<void> {\n InternalLog.log(\"Adding timing “\" + name + \"” to RUM View\", SdkVerbosity.DEBUG);\n return this.nativeRum.addTiming(name);\n }\n}\n\nconst DdSdk: DdSdkType = NativeModules.DdSdk;\nconst DdLogs: DdLogsType = new DdLogsWrapper();\nconst DdTrace: DdTraceType = new DdTraceWrapper();\nconst DdRum: DdRumType = new DdRumWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _foundation.DdLogs;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "DdRum", {
|
|
6
|
+
Object.defineProperty(exports, "DdSdkReactNativeConfiguration", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function () {
|
|
15
|
-
return
|
|
9
|
+
return _DdSdkReactNativeConfiguration.DdSdkReactNativeConfiguration;
|
|
16
10
|
}
|
|
17
11
|
});
|
|
18
12
|
Object.defineProperty(exports, "DdSdkReactNative", {
|
|
@@ -21,16 +15,10 @@ Object.defineProperty(exports, "DdSdkReactNative", {
|
|
|
21
15
|
return _DdSdkReactNative.DdSdkReactNative;
|
|
22
16
|
}
|
|
23
17
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _DdSdkReactNativeConfiguration.DdSdkReactNativeConfiguration;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "DdTrace", {
|
|
18
|
+
Object.defineProperty(exports, "InternalLog", {
|
|
31
19
|
enumerable: true,
|
|
32
20
|
get: function () {
|
|
33
|
-
return
|
|
21
|
+
return _InternalLog.InternalLog;
|
|
34
22
|
}
|
|
35
23
|
});
|
|
36
24
|
Object.defineProperty(exports, "ProxyConfiguration", {
|
|
@@ -57,16 +45,36 @@ Object.defineProperty(exports, "TrackingConsent", {
|
|
|
57
45
|
return _TrackingConsent.TrackingConsent;
|
|
58
46
|
}
|
|
59
47
|
});
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
Object.defineProperty(exports, "DdLogs", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _foundation.DdLogs;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "DdTrace", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _foundation.DdTrace;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "DdRum", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _foundation.DdRum;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
62
66
|
|
|
63
67
|
var _DdSdkReactNativeConfiguration = require("./DdSdkReactNativeConfiguration");
|
|
64
68
|
|
|
65
69
|
var _DdSdkReactNative = require("./DdSdkReactNative");
|
|
66
70
|
|
|
71
|
+
var _InternalLog = require("./InternalLog");
|
|
72
|
+
|
|
67
73
|
var _ProxyConfiguration = require("./ProxyConfiguration");
|
|
68
74
|
|
|
75
|
+
var _SdkVerbosity = require("./SdkVerbosity");
|
|
76
|
+
|
|
69
77
|
var _TrackingConsent = require("./TrackingConsent");
|
|
70
78
|
|
|
71
|
-
var
|
|
79
|
+
var _foundation = require("./foundation");
|
|
72
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { DdSdkReactNativeConfiguration } from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdLogs, DdTrace, DdRum } from './foundation';\n\nexport {\n DdLogs,\n DdTrace,\n DdRum,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity\n};\n"]}
|
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.RumActionType = exports.DdEventsInterceptor = exports.UNKNOWN_TARGET_NAME = void 0;
|
|
7
|
+
|
|
8
|
+
var _InternalLog = require("../../InternalLog");
|
|
9
|
+
|
|
10
|
+
var _SdkVerbosity = require("../../SdkVerbosity");
|
|
7
11
|
|
|
8
12
|
var _foundation = require("../../foundation");
|
|
9
13
|
|
|
10
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
15
|
|
|
12
|
-
const UNKNOWN_TARGET_NAME =
|
|
16
|
+
const UNKNOWN_TARGET_NAME = 'unknown_target';
|
|
13
17
|
exports.UNKNOWN_TARGET_NAME = UNKNOWN_TARGET_NAME;
|
|
14
18
|
const DEBOUNCE_EVENT_THRESHOLD_IN_MS = 10;
|
|
15
19
|
const HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS = 1;
|
|
16
|
-
const DD_ACTION_NAME_PROP =
|
|
20
|
+
const DD_ACTION_NAME_PROP = 'dd-action-name';
|
|
17
21
|
|
|
18
22
|
class DdEventsInterceptor {
|
|
19
23
|
constructor() {
|
|
20
24
|
_defineProperty(this, "debouncingStartedTimestamp", Number.MIN_VALUE);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
interceptOnPress() {
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
-
args[_key] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
|
|
27
|
+
interceptOnPress(...args) {
|
|
28
28
|
if (args.length > 0 && args[0] && args[0]._targetInst) {
|
|
29
29
|
const currentTime = Date.now();
|
|
30
30
|
const timestampDifference = Math.abs(Date.now() - this.debouncingStartedTimestamp);
|
|
@@ -35,6 +35,8 @@ class DdEventsInterceptor {
|
|
|
35
35
|
|
|
36
36
|
this.debouncingStartedTimestamp = currentTime + HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS;
|
|
37
37
|
}
|
|
38
|
+
} else {
|
|
39
|
+
_InternalLog.InternalLog.log(DdEventsInterceptor.ACTION_EVENT_DROPPED_WARN_MESSAGE, _SdkVerbosity.SdkVerbosity.WARN);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -62,15 +64,15 @@ class DdEventsInterceptor {
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const elementTypeName = this.resolveElementTypeName(targetNode.elementType);
|
|
65
|
-
return elementTypeName
|
|
67
|
+
return elementTypeName || UNKNOWN_TARGET_NAME;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
resolveElementTypeName(elementType) {
|
|
69
71
|
let elementTypeName = null;
|
|
70
72
|
|
|
71
|
-
if (typeof elementType ===
|
|
73
|
+
if (typeof elementType === 'string') {
|
|
72
74
|
elementTypeName = elementType;
|
|
73
|
-
} else if (elementType && typeof elementType.name ===
|
|
75
|
+
} else if (elementType && typeof elementType.name === 'string') {
|
|
74
76
|
elementTypeName = elementType.name;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -100,6 +102,9 @@ class DdEventsInterceptor {
|
|
|
100
102
|
|
|
101
103
|
|
|
102
104
|
exports.DdEventsInterceptor = DdEventsInterceptor;
|
|
105
|
+
|
|
106
|
+
_defineProperty(DdEventsInterceptor, "ACTION_EVENT_DROPPED_WARN_MESSAGE", 'An action event was dropped because either the `onPress` method arguments' + ' were undefined or they were missing the target information.');
|
|
107
|
+
|
|
103
108
|
let RumActionType;
|
|
104
109
|
exports.RumActionType = RumActionType;
|
|
105
110
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdEventsInterceptor.tsx"],"names":["UNKNOWN_TARGET_NAME","DEBOUNCE_EVENT_THRESHOLD_IN_MS","HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS","DD_ACTION_NAME_PROP","DdEventsInterceptor","Number","MIN_VALUE","interceptOnPress","args","length","_targetInst","currentTime","Date","now","timestampDifference","Math","abs","debouncingStartedTimestamp","targetNode","handleTargetEvent","resolvedTargetName","resolveTargetName","DdRum","addAction","RumActionType","TAP","valueOf","closestActionLabel","findClosestActionLabel","accessibilityLabel","memoizedProps","elementTypeName","resolveElementTypeName","elementType","name","currentNode","props","return"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["DdEventsInterceptor.tsx"],"names":["UNKNOWN_TARGET_NAME","DEBOUNCE_EVENT_THRESHOLD_IN_MS","HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS","DD_ACTION_NAME_PROP","DdEventsInterceptor","Number","MIN_VALUE","interceptOnPress","args","length","_targetInst","currentTime","Date","now","timestampDifference","Math","abs","debouncingStartedTimestamp","targetNode","handleTargetEvent","InternalLog","log","ACTION_EVENT_DROPPED_WARN_MESSAGE","SdkVerbosity","WARN","resolvedTargetName","resolveTargetName","DdRum","addAction","RumActionType","TAP","valueOf","closestActionLabel","findClosestActionLabel","accessibilityLabel","memoizedProps","elementTypeName","resolveElementTypeName","elementType","name","currentNode","props","return"],"mappings":";;;;;;;AAMA;;AACA;;AACA;;;;AAIO,MAAMA,mBAAmB,GAAG,gBAA5B;;AACP,MAAMC,8BAA8B,GAAG,EAAvC;AACA,MAAMC,qCAAqC,GAAG,CAA9C;AACA,MAAMC,mBAAmB,GA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AArD;;AACA,QAAIA,kBAAkB,IAAI,IAA1B,EAAgC;AAC5B,aAAOA,kBAAP;AACH;;AACD,UAAME,eAAe,GAAG,KAAKC,sBAAL,CACpBnB,UAAU,CAACoB,WADS,CAAxB;AAGA,WAAOF,eAAe,IAAIpC,mBAA1B;AACH;;AAEOqC,EAAAA,sBAAsB,CAACC,WAAD,EAAkC;AAC5D,QAAIF,eAAe,GAAG,IAAtB;;AACA,QAAI,OAAOE,WAAP,KAAuB,QAA3B,EAAqC;AACjCF,MAAAA,eAAe,GAAGE,WAAlB;AACH,KAFD,MAEO,IAAIA,WAAW,IAAI,OAAOA,WAAW,CAACC,IAAnB,KAA4B,QAA/C,EAAyD;AAC5DH,MAAAA,eAAe,GAAGE,WAAW,CAACC,IAA9B;AACH;;AACD,WAAOH,eAAP;AACH;;AAEOH,EAAAA,sBAAsB,CAACf,UAAD,EAAiC;AAC3D,QAAIsB,WAAW,GAAGtB,UAAlB;;AACA,WAAOsB,WAAP,EAAoB;AAChB,YAAMC,KAAK,GAAGD,WAAW,CAACL,aAA1B;;AACA,UAAIM,KAAK,IAAIA,KAAK,CAACtC,mBAAD,CAAlB,EAAyC;AACrC,eAAOsC,KAAK,CAACtC,mBAAD,CAAZ;AACH;;AACDqC,MAAAA,WAAW,GAAGA,WAAW,CAACE,MAA1B;AACH;;AACD,WAAO,IAAP;AACH;;AAtEyD;AAyE9D;AACA;AACA;;;;;gBA3EatC,mB,uCAEL,8EACA,8D;;IAyEIyB,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InternalLog } from '../../InternalLog';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport { DdRum } from '../../foundation';\n\nimport type EventsInterceptor from './EventsInterceptor';\n\nexport const UNKNOWN_TARGET_NAME = 'unknown_target';\nconst DEBOUNCE_EVENT_THRESHOLD_IN_MS = 10;\nconst HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS = 1;\nconst DD_ACTION_NAME_PROP = 'dd-action-name';\n\nexport class DdEventsInterceptor implements EventsInterceptor {\n static ACTION_EVENT_DROPPED_WARN_MESSAGE =\n 'An action event was dropped because either the `onPress` method arguments' +\n ' were undefined or they were missing the target information.';\n\n private debouncingStartedTimestamp = Number.MIN_VALUE;\n\n interceptOnPress(...args: any[]): void {\n if (args.length > 0 && args[0] && args[0]._targetInst) {\n const currentTime = Date.now();\n const timestampDifference = Math.abs(\n Date.now() - this.debouncingStartedTimestamp\n );\n if (timestampDifference > DEBOUNCE_EVENT_THRESHOLD_IN_MS) {\n const targetNode = args[0]._targetInst;\n this.handleTargetEvent(targetNode);\n // we add an approximated 1 millisecond for the execution time of the `handleTargetEvent` function\n this.debouncingStartedTimestamp =\n currentTime + HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS;\n }\n } else {\n InternalLog.log(\n DdEventsInterceptor.ACTION_EVENT_DROPPED_WARN_MESSAGE,\n SdkVerbosity.WARN\n );\n }\n }\n\n private handleTargetEvent(targetNode: any | null) {\n if (targetNode) {\n const resolvedTargetName = this.resolveTargetName(targetNode);\n DdRum.addAction(RumActionType.TAP.valueOf(), resolvedTargetName);\n }\n }\n\n private resolveTargetName(targetNode: any): string {\n const closestActionLabel = this.findClosestActionLabel(targetNode);\n if (closestActionLabel != null) {\n return closestActionLabel;\n }\n const accessibilityLabel = targetNode.memoizedProps?.accessibilityLabel;\n if (accessibilityLabel != null) {\n return accessibilityLabel;\n }\n const elementTypeName = this.resolveElementTypeName(\n targetNode.elementType\n );\n return elementTypeName || UNKNOWN_TARGET_NAME;\n }\n\n private resolveElementTypeName(elementType: any): string | null {\n let elementTypeName = null;\n if (typeof elementType === 'string') {\n elementTypeName = elementType;\n } else if (elementType && typeof elementType.name === 'string') {\n elementTypeName = elementType.name;\n }\n return elementTypeName;\n }\n\n private findClosestActionLabel(targetNode: any): string | null {\n let currentNode = targetNode;\n while (currentNode) {\n const props = currentNode.memoizedProps;\n if (props && props[DD_ACTION_NAME_PROP]) {\n return props[DD_ACTION_NAME_PROP];\n }\n currentNode = currentNode.return;\n }\n return null;\n }\n}\n\n/**\n * Describe the type of a RUM Action.\n */\nexport enum RumActionType {\n /** User tapped on a widget. */\n TAP = 'TAP',\n /** User scrolled a view. */\n SCROLL = 'SCROLL',\n /** User swiped on a view. */\n SWIPE = 'SWIPE',\n /** User clicked on a widget (not used on Mobile). */\n CLICK = 'CLICK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n"]}
|
|
@@ -5,21 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DdRumErrorTracking = void 0;
|
|
7
7
|
|
|
8
|
-
var _foundation = require("../../foundation");
|
|
9
|
-
|
|
10
8
|
var _InternalLog = require("../../InternalLog");
|
|
11
9
|
|
|
12
10
|
var _SdkVerbosity = require("../../SdkVerbosity");
|
|
13
11
|
|
|
12
|
+
var _foundation = require("../../foundation");
|
|
13
|
+
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
15
|
|
|
16
|
-
const EMPTY_MESSAGE =
|
|
17
|
-
const EMPTY_STACK_TRACE =
|
|
18
|
-
const TYPE_SOURCE =
|
|
19
|
-
const TYPE_CONSOLE =
|
|
16
|
+
const EMPTY_MESSAGE = 'Unknown Error';
|
|
17
|
+
const EMPTY_STACK_TRACE = '';
|
|
18
|
+
const TYPE_SOURCE = 'SOURCE';
|
|
19
|
+
const TYPE_CONSOLE = 'CONSOLE';
|
|
20
20
|
/**
|
|
21
|
-
* Provides RUM auto-instrumentation feature to track errors as RUM events.
|
|
22
|
-
*/
|
|
21
|
+
* Provides RUM auto-instrumentation feature to track errors as RUM events.
|
|
22
|
+
*/
|
|
23
23
|
|
|
24
24
|
class DdRumErrorTracking {
|
|
25
25
|
// eslint-disable-next-line
|
|
@@ -31,7 +31,7 @@ class DdRumErrorTracking {
|
|
|
31
31
|
static startTracking() {
|
|
32
32
|
// extra safety to avoid wrapping the Error handler twice
|
|
33
33
|
if (DdRumErrorTracking.isTracking) {
|
|
34
|
-
_InternalLog.InternalLog.log(
|
|
34
|
+
_InternalLog.InternalLog.log('Datadog SDK is already tracking errors', _SdkVerbosity.SdkVerbosity.WARN);
|
|
35
35
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -43,9 +43,9 @@ class DdRumErrorTracking {
|
|
|
43
43
|
console.error = DdRumErrorTracking.onConsoleError;
|
|
44
44
|
DdRumErrorTracking.isTracking = true;
|
|
45
45
|
|
|
46
|
-
_InternalLog.InternalLog.log(
|
|
46
|
+
_InternalLog.InternalLog.log('Datadog SDK is tracking errors', _SdkVerbosity.SdkVerbosity.INFO);
|
|
47
47
|
} else {
|
|
48
|
-
_InternalLog.InternalLog.log(
|
|
48
|
+
_InternalLog.InternalLog.log('Datadog SDK cannot track errors, ErrorUtils is not defined', _SdkVerbosity.SdkVerbosity.ERROR);
|
|
49
49
|
}
|
|
50
50
|
} // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
51
51
|
|
|
@@ -55,8 +55,8 @@ class DdRumErrorTracking {
|
|
|
55
55
|
const stacktrace = DdRumErrorTracking.getErrorStackTrace(error);
|
|
56
56
|
|
|
57
57
|
_foundation.DdRum.addError(message, TYPE_SOURCE, stacktrace, {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
'_dd.error.is_crash': isFatal,
|
|
59
|
+
'_dd.error.raw': error
|
|
60
60
|
}).then(() => {
|
|
61
61
|
DdRumErrorTracking.isInDefaultErrorHandler = true;
|
|
62
62
|
|
|
@@ -68,11 +68,7 @@ class DdRumErrorTracking {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
static onConsoleError() {
|
|
72
|
-
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
-
params[_key] = arguments[_key];
|
|
74
|
-
}
|
|
75
|
-
|
|
71
|
+
static onConsoleError(...params) {
|
|
76
72
|
if (DdRumErrorTracking.isInDefaultErrorHandler) {
|
|
77
73
|
return;
|
|
78
74
|
}
|
|
@@ -83,7 +79,7 @@ class DdRumErrorTracking {
|
|
|
83
79
|
const param = params[i];
|
|
84
80
|
const paramStack = DdRumErrorTracking.getErrorStackTrace(param);
|
|
85
81
|
|
|
86
|
-
if (paramStack
|
|
82
|
+
if (paramStack !== EMPTY_STACK_TRACE) {
|
|
87
83
|
stack = paramStack;
|
|
88
84
|
break;
|
|
89
85
|
}
|
|
@@ -105,9 +101,9 @@ class DdRumErrorTracking {
|
|
|
105
101
|
static getErrorMessage(error) {
|
|
106
102
|
let message = EMPTY_MESSAGE;
|
|
107
103
|
|
|
108
|
-
if (error
|
|
104
|
+
if (error === undefined || error === null) {
|
|
109
105
|
message = EMPTY_MESSAGE;
|
|
110
|
-
} else if (typeof error
|
|
106
|
+
} else if (typeof error === 'object' && 'message' in error) {
|
|
111
107
|
message = String(error.message);
|
|
112
108
|
} else {
|
|
113
109
|
message = String(error);
|
|
@@ -119,7 +115,7 @@ class DdRumErrorTracking {
|
|
|
119
115
|
static getErrorStackTrace(error) {
|
|
120
116
|
let stack = EMPTY_STACK_TRACE;
|
|
121
117
|
|
|
122
|
-
if (error
|
|
118
|
+
if (error === undefined || error === null) {
|
|
123
119
|
stack = EMPTY_STACK_TRACE;
|
|
124
120
|
} else if (typeof error === 'string') {
|
|
125
121
|
stack = EMPTY_STACK_TRACE;
|
|
@@ -148,5 +144,5 @@ _defineProperty(DdRumErrorTracking, "isInDefaultErrorHandler", false);
|
|
|
148
144
|
|
|
149
145
|
_defineProperty(DdRumErrorTracking, "defaultErrorHandler", (_error, _isFatal) => {});
|
|
150
146
|
|
|
151
|
-
_defineProperty(DdRumErrorTracking, "defaultConsoleError",
|
|
147
|
+
_defineProperty(DdRumErrorTracking, "defaultConsoleError", (..._params) => {});
|
|
152
148
|
//# sourceMappingURL=DdRumErrorTracking.js.map
|