@datadog/mobile-react-native 1.0.0-rc2 → 1.0.0-rc5
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 +8 -121
- 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 +63 -0
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +9 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/InternalLog.js +51 -0
- package/lib/commonjs/InternalLog.js.map +1 -0
- package/lib/commonjs/ProxyConfiguration.js +53 -0
- package/lib/commonjs/ProxyConfiguration.js.map +1 -0
- package/lib/commonjs/SdkVerbosity.js +26 -0
- package/lib/commonjs/SdkVerbosity.js.map +1 -0
- package/lib/commonjs/Timer.js +99 -0
- package/lib/commonjs/Timer.js.map +1 -0
- package/lib/commonjs/foundation.js +102 -45
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +28 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js +6 -2
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +61 -14
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +110 -17
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js +16 -4
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumXhr.js +4 -0
- package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.js +1 -1
- package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.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 +54 -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/InternalLog.js +46 -0
- package/lib/module/InternalLog.js.map +1 -0
- package/lib/module/ProxyConfiguration.js +46 -0
- package/lib/module/ProxyConfiguration.js.map +1 -0
- package/lib/module/SdkVerbosity.js +18 -0
- package/lib/module/SdkVerbosity.js.map +1 -0
- package/lib/module/Timer.js +90 -0
- package/lib/module/Timer.js.map +1 -0
- package/lib/module/foundation.js +69 -44
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js +5 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +56 -14
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js +99 -17
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js +12 -4
- 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/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 +9 -0
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +5 -2
- package/lib/typescript/InternalLog.d.ts +6 -0
- package/lib/typescript/ProxyConfiguration.d.ts +56 -0
- package/lib/typescript/SdkVerbosity.d.ts +9 -0
- package/lib/typescript/Timer.d.ts +20 -0
- package/lib/typescript/index.d.ts +3 -1
- 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 +12 -11
- package/lib/typescript/version.d.ts +1 -0
- package/package.json +3 -3
- package/src/DdSdkReactNative.tsx +57 -8
- package/src/DdSdkReactNativeConfiguration.tsx +6 -3
- package/src/InternalLog.tsx +48 -0
- package/src/ProxyConfiguration.tsx +37 -0
- package/src/{NativeSdkVerbosity.tsx → SdkVerbosity.tsx} +2 -2
- package/src/Timer.ts +96 -0
- package/src/__tests__/DdRumWrapper.test.tsx +91 -0
- package/src/__tests__/DdSdkReactNative.test.tsx +213 -13
- package/src/__tests__/InternalLog.test.tsx +382 -0
- package/src/__tests__/Timer.test.ts +145 -0
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +155 -12
- package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +270 -26
- package/src/foundation.tsx +43 -33
- package/src/index.tsx +4 -2
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +68 -27
- package/src/rum/instrumentation/DdRumResourceTracking.tsx +96 -22
- package/src/rum/instrumentation/DdRumUserInteractionTracking.tsx +4 -0
- package/src/rum/instrumentation/DdRumXhr.tsx +6 -5
- package/src/types.tsx +12 -11
- package/src/version.ts +2 -0
- package/lib/commonjs/NativeSdkVerbosity.js +0 -26
- package/lib/commonjs/NativeSdkVerbosity.js.map +0 -1
- package/lib/module/NativeSdkVerbosity.js +0 -18
- package/lib/module/NativeSdkVerbosity.js.map +0 -1
- package/lib/typescript/NativeSdkVerbosity.d.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","GRANTED","undefined"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,eAAT,QAAgC,mBAAhC;;
|
|
1
|
+
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","GRANTED","undefined"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,eAAT,QAAgC,mBAAhC;;AAIA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAAN,CAAoC;AAYvCC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAQT;AAAA,QAJWC,iBAIX,uEAJwC,KAIxC;AAAA,QAHWC,cAGX,uEAHqC,KAGrC;AAAA,QAFWC,WAEX,uEAFkC,KAElC;AAAA,QADWC,eACX,uEAD8CT,eAAe,CAACU,OAC9D;AAAA,SAPWP,WAOX,GAPWA,WAOX;AAAA,SANWC,GAMX,GANWA,GAMX;AAAA,SALWC,aAKX,GALWA,aAKX;AAAA,SAJWC,iBAIX,GAJWA,iBAIX;AAAA,SAHWC,cAGX,GAHWA,cAGX;AAAA,SAFWC,WAEX,GAFWA,WAEX;AAAA,SADWC,eACX,GADWA,eACX;;AAAA,sDAlByC,KAkBzC;;AAAA,wCAjB0B,KAiB1B;;AAAA,kCAhBoB,IAgBpB;;AAAA,uCAfyCE,SAezC;;AAAA,gDAdmC,KAcnC;;AAAA,yCAbwCA,SAaxC;;AAAA,yCAZ4BA,SAY5B;;AAAA,8CAV4C,EAU5C;AAED;;AAtBsC","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 { TrackingConsent } from './TrackingConsent'\nimport type { SdkVerbosity } from './SdkVerbosity'\nimport type { ProxyConfiguration } from './ProxyConfiguration';\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n\n public nativeCrashReportEnabled: boolean = false;\n public sampleRate: number = 100.0;\n public site: string = \"US\"\n public verbosity: SdkVerbosity|undefined = undefined\n public nativeViewTracking: boolean = false\n public proxyConfig?: ProxyConfiguration = undefined\n public serviceName?: string = undefined\n\n public additionalConfig: {[k: string]: any} = {};\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = TrackingConsent.GRANTED\n ) {\n\n }\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
5
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
6
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
7
|
+
*/
|
|
8
|
+
import { SdkVerbosity } from './SdkVerbosity';
|
|
9
|
+
export class InternalLog {
|
|
10
|
+
static log(message, verbosity) {
|
|
11
|
+
if (InternalLog.verbosity === undefined) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const requiredLevel = InternalLog.levelMap.get(verbosity);
|
|
16
|
+
const allowedLevel = InternalLog.levelMap.get(InternalLog.verbosity);
|
|
17
|
+
|
|
18
|
+
if (allowedLevel === undefined || requiredLevel === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const prefixedMessage = "DATADOG: " + message;
|
|
23
|
+
|
|
24
|
+
if (verbosity == SdkVerbosity.ERROR && requiredLevel >= allowedLevel) {
|
|
25
|
+
console.error(prefixedMessage);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (verbosity == SdkVerbosity.WARN && requiredLevel >= allowedLevel) {
|
|
29
|
+
console.warn(prefixedMessage);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (verbosity == SdkVerbosity.INFO && requiredLevel >= allowedLevel) {
|
|
33
|
+
console.info(prefixedMessage);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (verbosity == SdkVerbosity.DEBUG && requiredLevel >= allowedLevel) {
|
|
37
|
+
console.debug(prefixedMessage);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_defineProperty(InternalLog, "levelMap", new Map([[SdkVerbosity.DEBUG, 1], [SdkVerbosity.INFO, 2], [SdkVerbosity.WARN, 3], [SdkVerbosity.ERROR, 4]]));
|
|
44
|
+
|
|
45
|
+
_defineProperty(InternalLog, "verbosity", undefined);
|
|
46
|
+
//# sourceMappingURL=InternalLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InternalLog.tsx"],"names":["SdkVerbosity","InternalLog","log","message","verbosity","undefined","requiredLevel","levelMap","get","allowedLevel","prefixedMessage","ERROR","console","error","WARN","warn","INFO","info","DEBUG","debug","Map"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAAQA,YAAR,QAA2B,gBAA3B;AAEA,OAAO,MAAMC,WAAN,CAAkB;AAWJ,SAAHC,GAAG,CAAEC,OAAF,EAAmBC,SAAnB,EAAk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wise 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 {SdkVerbosity} from './SdkVerbosity'\n\nexport class InternalLog {\n\n private static levelMap = new Map<SdkVerbosity, number>([\n [SdkVerbosity.DEBUG, 1],\n [SdkVerbosity.INFO, 2],\n [SdkVerbosity.WARN, 3],\n [SdkVerbosity.ERROR, 4]\n ]);\n\n public static verbosity: SdkVerbosity|undefined = undefined\n\n public static log (message: string, verbosity: SdkVerbosity): void {\n if (InternalLog.verbosity === undefined) {\n return;\n }\n const requiredLevel = InternalLog.levelMap.get(verbosity);\n const allowedLevel = InternalLog.levelMap.get(InternalLog.verbosity);\n if (allowedLevel === undefined || requiredLevel === undefined) {\n return;\n }\n const prefixedMessage = \"DATADOG: \" + message\n if (verbosity == SdkVerbosity.ERROR && (requiredLevel >= allowedLevel)) {\n console.error(prefixedMessage)\n }\n\n if (verbosity == SdkVerbosity.WARN && (requiredLevel >= allowedLevel)) {\n console.warn(prefixedMessage)\n }\n\n if (verbosity == SdkVerbosity.INFO && (requiredLevel >= allowedLevel)) {\n console.info(prefixedMessage)\n }\n\n if (verbosity == SdkVerbosity.DEBUG && (requiredLevel >= allowedLevel)) {\n console.debug(prefixedMessage)\n }\n }\n\n\n}"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxy server configuration.
|
|
3
|
+
*/
|
|
4
|
+
class ProxyConfiguration {
|
|
5
|
+
constructor(
|
|
6
|
+
/**
|
|
7
|
+
* Proxy type.
|
|
8
|
+
*/
|
|
9
|
+
type,
|
|
10
|
+
/**
|
|
11
|
+
* Proxy address. Can be either in the IP address format, ex. "1.1.1.1", or hostname, ex. "example.com".
|
|
12
|
+
*/
|
|
13
|
+
address,
|
|
14
|
+
/**
|
|
15
|
+
* Proxy port.
|
|
16
|
+
*/
|
|
17
|
+
port,
|
|
18
|
+
/**
|
|
19
|
+
* Username for Basic authentication scheme.
|
|
20
|
+
*
|
|
21
|
+
* Note: "SOCKS + authentication" scheme is not supported.
|
|
22
|
+
*/
|
|
23
|
+
username,
|
|
24
|
+
/**
|
|
25
|
+
* Password for Basic authentication scheme.
|
|
26
|
+
*/
|
|
27
|
+
password) {
|
|
28
|
+
this.type = type;
|
|
29
|
+
this.address = address;
|
|
30
|
+
this.port = port;
|
|
31
|
+
this.username = username;
|
|
32
|
+
this.password = password;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var ProxyType;
|
|
38
|
+
|
|
39
|
+
(function (ProxyType) {
|
|
40
|
+
ProxyType["HTTP"] = "http";
|
|
41
|
+
ProxyType["HTTPS"] = "https";
|
|
42
|
+
ProxyType["SOCKS"] = "socks";
|
|
43
|
+
})(ProxyType || (ProxyType = {}));
|
|
44
|
+
|
|
45
|
+
export { ProxyConfiguration, ProxyType };
|
|
46
|
+
//# sourceMappingURL=ProxyConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ProxyConfiguration.tsx"],"names":["ProxyConfiguration","constructor","type","address","port","username","password","ProxyType"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,kBAAN,CAAyB;AACrBC,EAAAA,WAAW;AACP;AACR;AACA;AACiBC,EAAAA,IAJF;AAKP;AACR;AACA;AACiBC,EAAAA,OARF;AASP;AACR;AACA;AACiBC,EAAAA,IAZF;AAaP;AACR;AACA;AACA;AACA;AACiBC,EAAAA,QAlBF;AAmBP;AACR;AACA;AACiBC,EAAAA,QAtBF,EAuBT;AAAA,SAnBWJ,IAmBX,GAnBWA,IAmBX;AAAA,SAfWC,OAeX,GAfWA,OAeX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SALWC,QAKX,GALWA,QAKX;AAAA,SADWC,QACX,GADWA,QACX;AAAG;;AAxBgB;;IA2BpBC,S;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,KAAAA,S;;AAML,SAASP,kBAAT,EAA6BO,SAA7B","sourcesContent":["/**\n * Proxy server configuration.\n */\nclass ProxyConfiguration {\n constructor(\n /**\n * Proxy type.\n */\n readonly type: ProxyType,\n /**\n * Proxy address. Can be either in the IP address format, ex. \"1.1.1.1\", or hostname, ex. \"example.com\".\n */\n readonly address: string,\n /**\n * Proxy port.\n */\n readonly port: number,\n /**\n * Username for Basic authentication scheme.\n *\n * Note: \"SOCKS + authentication\" scheme is not supported.\n */\n readonly username?: string,\n /**\n * Password for Basic authentication scheme.\n */\n readonly password?: string\n ) { }\n}\n\nenum ProxyType {\n HTTP = \"http\",\n HTTPS = \"https\",\n SOCKS = \"socks\"\n}\n\nexport { ProxyConfiguration, ProxyType }\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enum specifying possible log levels for DD SDK.
|
|
9
|
+
*/
|
|
10
|
+
export let SdkVerbosity;
|
|
11
|
+
|
|
12
|
+
(function (SdkVerbosity) {
|
|
13
|
+
SdkVerbosity["DEBUG"] = "debug";
|
|
14
|
+
SdkVerbosity["INFO"] = "info";
|
|
15
|
+
SdkVerbosity["WARN"] = "warn";
|
|
16
|
+
SdkVerbosity["ERROR"] = "error";
|
|
17
|
+
})(SdkVerbosity || (SdkVerbosity = {}));
|
|
18
|
+
//# sourceMappingURL=SdkVerbosity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["SdkVerbosity.tsx"],"names":["SdkVerbosity"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,KAAAA,Y","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 log levels for DD SDK.\n */\nexport enum SdkVerbosity {\n DEBUG = \"debug\",\n INFO = \"info\",\n WARN = \"warn\",\n ERROR = \"error\"\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
const START_LABEL = "__start";
|
|
4
|
+
const STOP_LABEL = "__stop";
|
|
5
|
+
/**
|
|
6
|
+
* Simple timer which records time ticks. Shouldn't be re-used once stopped.
|
|
7
|
+
* All timestamps/durations returned are in milliseconds.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export default class Timer {
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "times", {});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get startTime() {
|
|
16
|
+
return this.times[START_LABEL].unix;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get stopTime() {
|
|
20
|
+
return this.startTime + this.durationBetween(START_LABEL, STOP_LABEL);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
start() {
|
|
24
|
+
this.recordTick(START_LABEL);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
stop() {
|
|
28
|
+
this.recordTick(STOP_LABEL);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
recordTick(label) {
|
|
32
|
+
this.times[label] = {
|
|
33
|
+
unix: Date.now(),
|
|
34
|
+
react_native: this.performanceNow()
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
hasTickFor(label) {
|
|
39
|
+
return label in this.times;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
durationBetween(startLabel, endLabel) {
|
|
43
|
+
this.checkLabelExists(startLabel);
|
|
44
|
+
this.checkLabelExists(endLabel);
|
|
45
|
+
const startTick = this.times[startLabel];
|
|
46
|
+
const endTick = this.times[endLabel];
|
|
47
|
+
return this.durationBetweenTicks(startTick, endTick);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
timeAt(label) {
|
|
51
|
+
this.checkLabelExists(label);
|
|
52
|
+
return this.startTime + this.durationBetween(START_LABEL, label);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
reset() {
|
|
56
|
+
this.times = {};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
durationBetweenTicks(start, end) {
|
|
60
|
+
if (start.react_native != null && end.react_native != null) {
|
|
61
|
+
return end.react_native - start.react_native;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return end.unix - start.unix;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
performanceNow() {
|
|
68
|
+
if (this.canUsePerformanceNow()) {
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
return performance.now();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
canUsePerformanceNow() {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
return global.performance && typeof performance.now === 'function';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
checkLabelExists(label) {
|
|
84
|
+
if (!this.hasTickFor(label)) {
|
|
85
|
+
throw new Error(`Label ${label} is not registered`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=Timer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Timer.ts"],"names":["START_LABEL","STOP_LABEL","Timer","startTime","times","unix","stopTime","durationBetween","start","recordTick","stop","label","Date","now","react_native","performanceNow","hasTickFor","startLabel","endLabel","checkLabelExists","startTick","endTick","durationBetweenTicks","timeAt","reset","end","canUsePerformanceNow","performance","global","Error"],"mappings":";;AAQA,MAAMA,WAAW,GAAG,SAApB;AACA,MAAMC,UAAU,GAAG,QAAnB;AAEA;AACA;AACA;AACA;;AACA,eAAe,MAAMC,KAAN,CAAY;AAAA;AAAA,mCAEoB,EAFpB;AAAA;;AAIV,MAATC,SAAS,GAAW;AACpB,WAAO,KAAKC,KAAL,CAAWJ,WAAX,EAAwBK,IAA/B;AACH;;AAEW,MAARC,QAAQ,GAAW;AACnB,WAAO,KAAKH,SAAL,GAAiB,KAAKI,eAAL,CAAqBP,WAArB,EAAkCC,UAAlC,CAAxB;AACH;;AAEDO,EAAAA,KAAK,GAAS;AACV,SAAKC,UAAL,CAAgBT,WAAhB;AACH;;AAEDU,EAAAA,IAAI,GAAS;AACT,SAAKD,UAAL,CAAgBR,UAAhB;AACH;;AAEDQ,EAAAA,UAAU,CAACE,KAAD,EAAsB;AAC5B,SAAKP,KAAL,CAAWO,KAAX,IAAoB;AAChBN,MAAAA,IAAI,EAAEO,IAAI,CAACC,GAAL,EADU;AAEhBC,MAAAA,YAAY,EAAE,KAAKC,cAAL;AAFE,KAApB;AAIH;;AAEDC,EAAAA,UAAU,CAACL,KAAD,EAAyB;AAC/B,WAAOA,KAAK,IAAI,KAAKP,KAArB;AACH;;AAEDG,EAAAA,eAAe,CAACU,UAAD,EAAqBC,QAArB,EAA+C;AAC1D,SAAKC,gBAAL,CAAsBF,UAAtB;AACA,SAAKE,gBAAL,CAAsBD,QAAtB;AAEA,UAAME,SAAS,GAAG,KAAKhB,KAAL,CAAWa,UAAX,CAAlB;AACA,UAAMI,OAAO,GAAG,KAAKjB,KAAL,CAAWc,QAAX,CAAhB;AAEA,WAAO,KAAKI,oBAAL,CAA0BF,SAA1B,EAAqCC,OAArC,CAAP;AACH;;AAEDE,EAAAA,MAAM,CAACZ,KAAD,EAAwB;AAC1B,SAAKQ,gBAAL,CAAsBR,KAAtB;AAEA,WAAO,KAAKR,SAAL,GAAiB,KAAKI,eAAL,CAAqBP,WAArB,EAAkCW,KAAlC,CAAxB;AACH;;AAEDa,EAAAA,KAAK,GAAS;AACV,SAAKpB,KAAL,GAAa,EAAb;AACH;;AAEOkB,EAAAA,oBAAoB,CAACd,KAAD,EAAmBiB,GAAnB,EAA2C;AACnE,QAAIjB,KAAK,CAACM,YAAN,IAAsB,IAAtB,IAA8BW,GAAG,CAACX,YAAJ,IAAoB,IAAtD,EAA4D;AACxD,aAAOW,GAAG,CAACX,YAAJ,GAAmBN,KAAK,CAACM,YAAhC;AACH;;AACD,WAAOW,GAAG,CAACpB,IAAJ,GAAWG,KAAK,CAACH,IAAxB;AACH;;AAGOU,EAAAA,cAAc,GAAkB;AACpC,QAAI,KAAKW,oBAAL,EAAJ,EAAiC;AAC7B;AACA;AACA,aAAOC,WAAW,CAACd,GAAZ,EAAP;AACH;;AACD,WAAO,IAAP;AACH;;AAEOa,EAAAA,oBAAoB,GAAY;AACpC;AACA;AACA,WAAOE,MAAM,CAACD,WAAP,IAAsB,OAAOA,WAAW,CAACd,GAAnB,KAA2B,UAAxD;AACH;;AAEOM,EAAAA,gBAAgB,CAACR,KAAD,EAAgB;AACpC,QAAI,CAAC,KAAKK,UAAL,CAAgBL,KAAhB,CAAL,EAA6B;AACzB,YAAM,IAAIkB,KAAJ,CAAW,SAAQlB,KAAM,oBAAzB,CAAN;AACH;AACJ;;AA9EsB","sourcesContent":["type Timestamp = {\n // Result of Date API. Unix timestamp in ms.\n unix: number,\n // Result of performance.now API. Timestamp in ms (with microsecond precision)\n // since JS context start.\n react_native: number | null\n}\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\n private times: Record<string, Timestamp> = {};\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] = {\n unix: Date.now(),\n react_native: this.performanceNow()\n }\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\n private performanceNow(): number | null {\n if (this.canUsePerformanceNow()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return performance.now();\n }\n return null;\n }\n\n private canUsePerformanceNow(): boolean {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return global.performance && typeof performance.now === 'function';\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}\n"]}
|
package/lib/module/foundation.js
CHANGED
|
@@ -7,25 +7,35 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
*/
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
import { DdSdkConfiguration } from './types';
|
|
10
|
+
import { InternalLog } from "./InternalLog";
|
|
11
|
+
import { SdkVerbosity } from "./SdkVerbosity";
|
|
10
12
|
|
|
11
13
|
class DdLogsWrapper {
|
|
12
14
|
constructor() {
|
|
13
15
|
_defineProperty(this, "nativeLogs", NativeModules.DdLogs);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
debug(message
|
|
18
|
+
debug(message) {
|
|
19
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20
|
+
InternalLog.log("Tracking debug log “" + message + "”", SdkVerbosity.DEBUG);
|
|
17
21
|
return this.nativeLogs.debug(message, context);
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
info(message
|
|
24
|
+
info(message) {
|
|
25
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
|
+
InternalLog.log("Tracking info log “" + message + "”", SdkVerbosity.DEBUG);
|
|
21
27
|
return this.nativeLogs.info(message, context);
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
warn(message
|
|
30
|
+
warn(message) {
|
|
31
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
32
|
+
InternalLog.log("Tracking warn log “" + message + "”", SdkVerbosity.DEBUG);
|
|
25
33
|
return this.nativeLogs.warn(message, context);
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
error(message
|
|
36
|
+
error(message) {
|
|
37
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
38
|
+
InternalLog.log("Tracking error log “" + message + "”", SdkVerbosity.DEBUG);
|
|
29
39
|
return this.nativeLogs.error(message, context);
|
|
30
40
|
}
|
|
31
41
|
|
|
@@ -36,16 +46,19 @@ class DdTraceWrapper {
|
|
|
36
46
|
_defineProperty(this, "nativeTrace", NativeModules.DdTrace);
|
|
37
47
|
}
|
|
38
48
|
|
|
39
|
-
startSpan(operation
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
startSpan(operation) {
|
|
50
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
51
|
+
let timestampMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
|
|
52
|
+
let spanId = this.nativeTrace.startSpan(operation, context, timestampMs);
|
|
53
|
+
InternalLog.log("Starting span “" + operation + "” #" + spanId, SdkVerbosity.DEBUG);
|
|
54
|
+
return spanId;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
|
-
finishSpan(spanId
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
finishSpan(spanId) {
|
|
58
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
59
|
+
let timestampMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
|
|
60
|
+
InternalLog.log("Finishing span #" + spanId, SdkVerbosity.DEBUG);
|
|
61
|
+
return this.nativeTrace.finishSpan(spanId, context, timestampMs);
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
}
|
|
@@ -55,55 +68,67 @@ class DdRumWrapper {
|
|
|
55
68
|
_defineProperty(this, "nativeRum", NativeModules.DdRum);
|
|
56
69
|
}
|
|
57
70
|
|
|
58
|
-
startView(key, name
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
startView(key, name) {
|
|
72
|
+
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
73
|
+
let timestampMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Date.now();
|
|
74
|
+
InternalLog.log("Starting RUM View “" + name + "” #" + key, SdkVerbosity.DEBUG);
|
|
75
|
+
return this.nativeRum.startView(key, name, context, timestampMs);
|
|
62
76
|
}
|
|
63
77
|
|
|
64
|
-
stopView(key
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
stopView(key) {
|
|
79
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
80
|
+
let timestampMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
|
|
81
|
+
InternalLog.log("Stopping RUM View #" + key, SdkVerbosity.DEBUG);
|
|
82
|
+
return this.nativeRum.stopView(key, context, timestampMs);
|
|
68
83
|
}
|
|
69
84
|
|
|
70
|
-
startAction(type, name
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
startAction(type, name) {
|
|
86
|
+
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
87
|
+
let timestampMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Date.now();
|
|
88
|
+
InternalLog.log("Starting RUM Action “" + name + "” (" + type + ")", SdkVerbosity.DEBUG);
|
|
89
|
+
return this.nativeRum.startAction(type, name, context, timestampMs);
|
|
74
90
|
}
|
|
75
91
|
|
|
76
|
-
stopAction(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
stopAction() {
|
|
93
|
+
let context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
94
|
+
let timestampMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
|
|
95
|
+
InternalLog.log("Stopping current RUM Action", SdkVerbosity.DEBUG);
|
|
96
|
+
return this.nativeRum.stopAction(context, timestampMs);
|
|
80
97
|
}
|
|
81
98
|
|
|
82
|
-
addAction(type, name
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
addAction(type, name) {
|
|
100
|
+
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
101
|
+
let timestampMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Date.now();
|
|
102
|
+
InternalLog.log("Adding RUM Action “" + name + "” (" + type + ")", SdkVerbosity.DEBUG);
|
|
103
|
+
return this.nativeRum.addAction(type, name, context, timestampMs);
|
|
86
104
|
}
|
|
87
105
|
|
|
88
|
-
startResource(key, method, url
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
106
|
+
startResource(key, method, url) {
|
|
107
|
+
let context = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
108
|
+
let timestampMs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Date.now();
|
|
109
|
+
InternalLog.log("Starting RUM Resource #" + key + " " + method + ": " + url, SdkVerbosity.DEBUG);
|
|
110
|
+
return this.nativeRum.startResource(key, method, url, context, timestampMs);
|
|
92
111
|
}
|
|
93
112
|
|
|
94
|
-
stopResource(key, statusCode, kind
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
stopResource(key, statusCode, kind) {
|
|
114
|
+
let size = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
|
|
115
|
+
let context = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
116
|
+
let timestampMs = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : Date.now();
|
|
117
|
+
InternalLog.log("Stopping RUM Resource #" + key + " status:" + statusCode, SdkVerbosity.DEBUG);
|
|
118
|
+
return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);
|
|
98
119
|
}
|
|
99
120
|
|
|
100
|
-
addError(message, source, stacktrace
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
addError(message, source, stacktrace) {
|
|
122
|
+
let context = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
123
|
+
let timestampMs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Date.now();
|
|
124
|
+
InternalLog.log("Adding RUM Error “" + message + "”", SdkVerbosity.DEBUG);
|
|
125
|
+
let updatedContext = context;
|
|
126
|
+
updatedContext["_dd.error.source_type"] = "react-native";
|
|
127
|
+
return this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs);
|
|
104
128
|
}
|
|
105
129
|
|
|
106
130
|
addTiming(name) {
|
|
131
|
+
InternalLog.log("Adding timing “" + name + "” to RUM View", SdkVerbosity.DEBUG);
|
|
107
132
|
return this.nativeRum.addTiming(name);
|
|
108
133
|
}
|
|
109
134
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["foundation.tsx"],"names":["NativeModules","DdSdkConfiguration","DdLogsWrapper","DdLogs","debug","message","context","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","Date","now","nativeTrace","finishSpan","spanId","DdRumWrapper","DdRum","startView","key","name","nativeRum","stopView","startAction","type","stopAction","addAction","startResource","method","url","stopResource","statusCode","kind","addError","source","stacktrace","addTiming","DdSdk"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AACA,SAASC,kBAAT,QAAkF,SAAlF;;AAEA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCAELF,aAAa,CAACG,MAFT;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxD,WAAO,KAAKC,UAAL,CAAgBH,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AACDE,EAAAA,IAAI,CAACH,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvD,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBH,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AACDG,EAAAA,IAAI,CAACJ,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvD,WAAO,KAAKC,UAAL,CAAgBE,IAAhB,CAAqBJ,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AACDI,EAAAA,KAAK,CAACL,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxD,WAAO,KAAKC,UAAL,CAAgBG,KAAhB,CAAsBL,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAfqC;;AAmB1C,MAAMK,cAAN,CAA4C;AAAA;AAAA,yCAELX,aAAa,CAACY,OAFT;AAAA;;AAIxCC,EAAAA,SAAS,CAACC,SAAD,EAAoBR,OAAe,GAAG,EAAtC,EAA0CS,WAAmB,GAAGC,IAAI,CAACC,GAAL,E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;AACH;;AACDmC,EAAAA,SAAS,CAAChB,IAAD,EAA8B;AACnC,WAAO,KAAKC,SAAL,CAAee,SAAf,CAAyBhB,IAAzB,CAAP;AACH;;AA9CmC;;AAkDxC,MAAMiB,KAAgB,GAAG1C,aAAa,CAAC0C,KAAvC;AACA,MAAMvC,MAAkB,GAAG,IAAID,aAAJ,EAA3B;AACA,MAAMU,OAAoB,GAAG,IAAID,cAAJ,EAA7B;AACA,MAAMW,KAAgB,GAAG,IAAID,YAAJ,EAAzB;AAEA,SAASpB,kBAAT,EAA6ByC,KAA7B,EAAoCvC,MAApC,EAA4CS,OAA5C,EAAqDU,KAArD","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';\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.debug(message, context);\n }\n info(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.info(message, context);\n }\n warn(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.warn(message, context);\n }\n error(message: string, context: object = {}): Promise<void> {\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 // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeTrace.startSpan(operation, timestampMs, context);\n }\n finishSpan(spanId: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeTrace.finishSpan(spanId, timestampMs, context);\n }\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 // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.startView(key, name, timestampMs, context);\n }\n stopView(key: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.stopView(key, timestampMs, context);\n }\n startAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.startAction(type, name, timestampMs, context);\n }\n stopAction(context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.stopAction(timestampMs, context);\n }\n addAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.addAction(type, name, timestampMs, context);\n }\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.startResource(key, method, url, timestampMs, context);\n }\n stopResource(key: string, statusCode: number, kind: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.stopResource(key, statusCode, kind, timestampMs, context);\n }\n addError(message: string, source: string, stacktrace: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.addError(message, source, stacktrace, timestampMs, context);\n }\n addTiming(name: string): Promise<void> {\n return this.nativeRum.addTiming(name);\n }\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":["NativeModules","DdSdkConfiguration","InternalLog","SdkVerbosity","DdLogsWrapper","DdLogs","debug","message","context","log","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":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AACA,SAASC,kBAAT,QAAkF,SAAlF;AACA,SAAQC,WAAR,QAA0B,eAA1B;AACA,SAAQC,YAAR,QAA2B,gBAA3B;;AAEA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCAELJ,aAAa,CAACK,MAFT;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAuD;AAAA,QAArCC,OAAqC,uEAAnB,EAAmB;AACxDN,IAAAA,WAAW,CAACO,GAAZ,CAAgB,yBAA0BF,OAA1B,GAAoC,GAApD,EAAyDJ,YAAY,CAACO,KAAtE;AACA,WAAO,KAAKC,UAAL,CAAgBL,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAEDI,EAAAA,IAAI,CAACL,OAAD,EAAuD;AAAA,QAArCC,OAAqC,uEAAnB,EAAmB;AACvDN,IAAAA,WAAW,CAACO,GAAZ,CAAgB,wBAAyBF,OAAzB,GAAmC,GAAnD,EAAwDJ,YAAY,CAACO,KAArE;AACA,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBL,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AAEDK,EAAAA,IAAI,CA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B,GAAG,IAAID,YAAJ,EAAzB;AAEA,SAASxB,kBAAT,EAA6B+C,KAA7B,EAAoC3C,MAApC,EAA4CW,OAA5C,EAAqDU,KAArD","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"]}
|
package/lib/module/index.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { DdLogs, DdTrace, DdRum } from './foundation';
|
|
7
7
|
import { DdSdkReactNativeConfiguration } from './DdSdkReactNativeConfiguration';
|
|
8
8
|
import { DdSdkReactNative } from './DdSdkReactNative';
|
|
9
|
+
import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
|
|
9
10
|
import { TrackingConsent } from './TrackingConsent';
|
|
10
|
-
|
|
11
|
+
import { SdkVerbosity } from './SdkVerbosity';
|
|
12
|
+
export { DdLogs, DdTrace, DdRum, DdSdkReactNativeConfiguration, DdSdkReactNative, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity };
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["DdLogs","DdTrace","DdRum","DdSdkReactNativeConfiguration","DdSdkReactNative","TrackingConsent"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,MAAT,EAAiBC,OAAjB,EAA0BC,KAA1B,QAAuC,cAAvC;AAEA,SAASC,6BAAT,QAA8C,iCAA9C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA,
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["DdLogs","DdTrace","DdRum","DdSdkReactNativeConfiguration","DdSdkReactNative","ProxyConfiguration","ProxyType","TrackingConsent","SdkVerbosity"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,MAAT,EAAiBC,OAAjB,EAA0BC,KAA1B,QAAuC,cAAvC;AAEA,SAASC,6BAAT,QAA8C,iCAA9C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,kBAAT,EAA6BC,SAA7B,QAA8C,sBAA9C;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SAASR,MAAT,EAAiBC,OAAjB,EAA0BC,KAA1B,EAAiCC,6BAAjC,EAAgEC,gBAAhE,EAAkFC,kBAAlF,EAAsGC,SAAtG,EAAiHC,eAAjH,EAAkIC,YAAlI","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 { DdLogs, DdTrace, DdRum } from './foundation';\n\nimport { DdSdkReactNativeConfiguration } from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { TrackingConsent } from './TrackingConsent';\nimport { SdkVerbosity } from './SdkVerbosity'\n\nexport { DdLogs, DdTrace, DdRum, DdSdkReactNativeConfiguration, DdSdkReactNative, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity };\n"]}
|
|
@@ -15,7 +15,11 @@ export class DdEventsInterceptor {
|
|
|
15
15
|
_defineProperty(this, "debouncingStartedTimestamp", Number.MIN_VALUE);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
interceptOnPress(
|
|
18
|
+
interceptOnPress() {
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
if (args.length > 0 && args[0] && args[0]._targetInst) {
|
|
20
24
|
const currentTime = Date.now();
|
|
21
25
|
const timestampDifference = Math.abs(Date.now() - this.debouncingStartedTimestamp);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdEventsInterceptor.tsx"],"names":["DdRum","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","addAction","RumActionType","TAP","valueOf","closestActionLabel","findClosestActionLabel","accessibilityLabel","memoizedProps","elementTypeName","resolveElementTypeName","elementType","name","currentNode","props","return"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAGA,SAASA,KAAT,QAAsB,kBAAtB;AAEA,OAAO,MAAMC,mBAAmB,GAAG,gBAA5B;AACP,MAAMC,8BAA8B,GAAG,EAAvC;AACA,MAAMC,qCAAqC,GAAG,CAA9C;AACA,MAAMC,mBAAmB,GAAG,gBAA5B;AAEA,OAAO,MAAMC,mBAAN,CAAuD;AAAA;AAAA,wDAErBC,MAAM,CAACC,SAFc;AAAA;;AAI1DC,EAAAA,gBAAgB,
|
|
1
|
+
{"version":3,"sources":["DdEventsInterceptor.tsx"],"names":["DdRum","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","addAction","RumActionType","TAP","valueOf","closestActionLabel","findClosestActionLabel","accessibilityLabel","memoizedProps","elementTypeName","resolveElementTypeName","elementType","name","currentNode","props","return"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAGA,SAASA,KAAT,QAAsB,kBAAtB;AAEA,OAAO,MAAMC,mBAAmB,GAAG,gBAA5B;AACP,MAAMC,8BAA8B,GAAG,EAAvC;AACA,MAAMC,qCAAqC,GAAG,CAA9C;AACA,MAAMC,mBAAmB,GAAG,gBAA5B;AAEA,OAAO,MAAMC,mBAAN,CAAuD;AAAA;AAAA,wDAErBC,MAAM,CAACC,SAFc;AAAA;;AAI1DC,EAAAA,gBAAgB,GAAuB;AAAA,sCAAnBC,IAAmB;AAAnBA,MAAAA,IAAmB;AAAA;;AACnC,QAAIA,IAAI,CAACC,MAAL,GAAc,CAAd,IAAmBD,IAAI,CAAC,CAAD,CAAvB,IAA8BA,IAAI,CAAC,CAAD,CAAJ,CAAQE,WAA1C,EAAuD;AACnD,YAAMC,WAAW,GAAGC,IAAI,CAACC,GAAL,EAApB;AACA,YAAMC,mBAAmB,GAAGC,IAAI,CAACC,GAAL,CAASJ,IAAI,CAACC,GAAL,KAAa,KAAKI,0BAA3B,CAA5B;;AACA,UAAIH,mBAAmB,GAAGb,8BAA1B,EAA0D;AACtD,cAAMiB,UAAU,GAAGV,IAAI,CAAC,CAAD,CAAJ,CAAQE,WAA3B;AACA,aAAKS,iBAAL,CAAuBD,UAAvB,EAFsD,CAGtD;;AACA,aAAKD,0BAAL,GAAkCN,WAAW,GAAGT,qCAAhD;AACH;AACJ;AACJ;;AAEOiB,EAAAA,iBAAiB,CAACD,UAAD,EAAyB;AAC9C,QAAIA,UAAJ,EAAgB;AACZ,YAAME,kBAAkB,GAAG,KAAKC,iBAAL,CAAuBH,UAAvB,CAA3B;AACAnB,MAAAA,KAAK,CAACuB,SAAN,CAAgBC,aAAa,CAACC,GAAd,CAAkBC,OAAlB,EAAhB,EAA6CL,kBAA7C;AACH;AACJ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,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,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 type EventsInterceptor from './EventsInterceptor'\nimport { DdRum } from '../../foundation'\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\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(Date.now() - this.debouncingStartedTimestamp)\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 = currentTime + HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS\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(targetNode.elementType)\n return elementTypeName ? 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"]}
|