@datadog/mobile-react-native 1.2.0-beta1 → 1.2.0-beta2
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 +2 -2
- package/android/build.gradle +28 -3
- package/android/detekt.yml +572 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +7 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +118 -8
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +23 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +29 -1
- package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +41 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +7 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +377 -27
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +5 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +33 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +21 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +1 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +21 -2
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/PackageInfoForgeryFactory.kt +2 -3
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +94 -0
- package/datadog-sourcemaps.gradle +85 -28
- package/ios/Sources/Attributes.swift +0 -4
- package/ios/Sources/DdSdk.swift +99 -13
- package/ios/Sources/DdSdkConfiguration.swift +34 -1
- package/ios/Sources/JSRefreshRateListener.swift +86 -0
- package/ios/Sources/QueueHolder.swift +7 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +23 -1
- package/lib/commonjs/DdSdkReactNative.js +24 -25
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +66 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/errorUtils.js +12 -3
- package/lib/commonjs/errorUtils.js.map +1 -1
- package/lib/commonjs/longTasksUtils.js +40 -0
- package/lib/commonjs/longTasksUtils.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/getJsxRuntime.js +11 -8
- package/lib/commonjs/rum/instrumentation/getJsxRuntime.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js +2 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/types.js +5 -1
- 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 +23 -24
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +64 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/errorUtils.js +12 -3
- package/lib/module/errorUtils.js.map +1 -1
- package/lib/module/longTasksUtils.js +31 -0
- package/lib/module/longTasksUtils.js.map +1 -0
- package/lib/module/rum/instrumentation/getJsxRuntime.js +11 -8
- package/lib/module/rum/instrumentation/getJsxRuntime.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js +2 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/module/types.js +5 -1
- 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 +0 -7
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +51 -0
- package/lib/typescript/errorUtils.d.ts +8 -0
- package/lib/typescript/longTasksUtils.d.ts +6 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/types.d.ts +15 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +6 -3
- package/scripts/replace-react-require.js +78 -0
- package/src/DatadogProvider/__tests__/initialization.test.tsx +9 -1
- package/src/DdSdkReactNative.tsx +31 -34
- package/src/DdSdkReactNativeConfiguration.tsx +66 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +56 -13
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +15 -2
- package/src/__tests__/longTasksUtils.ts +23 -0
- package/src/errorUtils.ts +11 -3
- package/src/longTasksUtils.ts +30 -0
- package/src/rum/instrumentation/getJsxRuntime.ts +11 -11
- package/src/rum/instrumentation/resourceTracking/domain/distributedTracing.tsx +3 -1
- package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +2 -1
- package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +9 -47
- package/src/types.tsx +10 -1
- package/src/version.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["longTasksUtils.ts"],"names":["MIN_LONG_TASK_THRESHOLD_MS","MAX_LONG_TASK_THRESHOLD_MS","adaptLongTaskThreshold","longTaskThreshold"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA,MAAMA,0BAA0B,GAAG,GAAnC;AAEA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,IAAnC;AAEA;AACA;AACA;AACA;AACA;;AACO,MAAMC,sBAAsB,GAC/BC,iBADkC,IAEzB;AACT,MAAI,CAACA,iBAAL,EAAwB;AACpB,WAAO,CAAP;AACH;;AACD,MAAIA,iBAAiB,GAAGH,0BAAxB,EAAoD;AAChD,WAAOA,0BAAP;AACH;;AACD,MAAIG,iBAAiB,GAAGF,0BAAxB,EAAoD;AAChD,WAAOA,0BAAP;AACH;;AAED,SAAOE,iBAAP;AACH,CAdM","sourcesContent":["/**\n * 100ms is the lower bound for a noticeable long task event.\n */\nconst MIN_LONG_TASK_THRESHOLD_MS = 100;\n\n/**\n * 5000ms is considered an Application Not Responding (ANR) event.\n */\nconst MAX_LONG_TASK_THRESHOLD_MS = 5000;\n\n/**\n * Makes sure the long task threshold value is above 100 and below 5000.\n * Also makes sure it is a number, passing `0` if it is `false`, as the React Native\n * bridge cannot handle values with dual types.\n */\nexport const adaptLongTaskThreshold = (\n longTaskThreshold: number | false\n): number => {\n if (!longTaskThreshold) {\n return 0;\n }\n if (longTaskThreshold < MIN_LONG_TASK_THRESHOLD_MS) {\n return MIN_LONG_TASK_THRESHOLD_MS;\n }\n if (longTaskThreshold > MAX_LONG_TASK_THRESHOLD_MS) {\n return MAX_LONG_TASK_THRESHOLD_MS;\n }\n\n return longTaskThreshold;\n};\n"]}
|
|
@@ -12,27 +12,30 @@ exports.getJsxRuntime = void 0;
|
|
|
12
12
|
*/
|
|
13
13
|
const getJsxRuntime = () => {
|
|
14
14
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
15
|
-
const [major, minor] = require('react/package.json').version.split('.'); // We need to check on the version of React before
|
|
15
|
+
const [major, minor] = require('react/package.json').version.split('.'); // We need to check on the version of React before requiring 'react/jsx-runtime') as
|
|
16
16
|
// it might crash other exports if the export does not exist (even if there is a try/catch).
|
|
17
17
|
// See: https://github.com/facebook/metro/issues/836
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
if (!isJsxExportedInReactVersion(major, minor)) {
|
|
21
21
|
throw new Error('React version does not support new jsx transform');
|
|
22
|
-
} //
|
|
23
|
-
//
|
|
24
|
-
|
|
22
|
+
} // /!\/!\/!\/!\/!\/!\
|
|
23
|
+
// We have to use inline require here because older React versions (below 16.14) don't have jsx-runtime.
|
|
24
|
+
// metro does not support dynamic require, so 'react/jsx-runtime' is replaced by 'react' on postinstall
|
|
25
|
+
// when react is equal or above 16.14 to avoid this require call to fail during the import phase and then
|
|
26
|
+
// disable all further imports.
|
|
27
|
+
// /!\/!\/!\/!\/!\/!\
|
|
28
|
+
//
|
|
29
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
25
30
|
|
|
26
|
-
const jsxRuntimePackage = isJsxExportedInReactVersion(major, minor) ? 'react/jsx-runtime' : 'react'; // We have to use inline require here because older React versions (below 17) don't have jsx-runtime
|
|
27
|
-
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires, import/no-dynamic-require
|
|
28
31
|
|
|
29
|
-
const jsxRuntime = require(
|
|
32
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
30
33
|
|
|
31
34
|
if (!jsxRuntime.jsx) {
|
|
32
35
|
throw new Error('React jsx runtime does not export new jsx transform');
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
return jsxRuntime
|
|
38
|
+
return jsxRuntime;
|
|
36
39
|
};
|
|
37
40
|
/**
|
|
38
41
|
* JSX Transform is available for React 16.14.0 (last React 16 version) and above
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["getJsxRuntime.ts"],"names":["getJsxRuntime","major","minor","require","version","split","isJsxExportedInReactVersion","Error","
|
|
1
|
+
{"version":3,"sources":["getJsxRuntime.ts"],"names":["getJsxRuntime","major","minor","require","version","split","isJsxExportedInReactVersion","Error","jsxRuntime","jsx","Number"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEO,MAAMA,aAAa,GAAG,MAAM;AAC/B;AACA,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBC,OAAO,CAAC,oBAAD,CAAP,CAA8BC,OAA9B,CAAsCC,KAAtC,CAA4C,GAA5C,CAAvB,CAF+B,CAG/B;AACA;AACA;;;AACA,MAAI,CAACC,2BAA2B,CAACL,KAAD,EAAQC,KAAR,CAAhC,EAAgD;AAC5C,UAAM,IAAIK,KAAJ,CAAU,kDAAV,CAAN;AACH,GAR8B,CAU/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,QAAMC,UAAU,GAAGL,OAAO,CAAC,mBAAD,CAA1B;;AACA,MAAI,CAACK,UAAU,CAACC,GAAhB,EAAqB;AACjB,UAAM,IAAIF,KAAJ,CAAU,qDAAV,CAAN;AACH;;AACD,SAAOC,UAAP;AACH,CAvBM;AAyBP;AACA;AACA;;;;;AACA,MAAMF,2BAA2B,GAAG,CAACL,KAAD,EAAgBC,KAAhB,KAA2C;AAC3E,MAAIQ,MAAM,CAACT,KAAD,CAAN,GAAgB,EAApB,EAAwB;AACpB,WAAO,IAAP;AACH;;AACD,MAAIS,MAAM,CAACT,KAAD,CAAN,KAAkB,EAAlB,IAAwBS,MAAM,CAACR,KAAD,CAAN,GAAgB,EAA5C,EAAgD;AAC5C,WAAO,IAAP;AACH;;AACD,SAAO,KAAP;AACH,CARD","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\nexport const getJsxRuntime = () => {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const [major, minor] = require('react/package.json').version.split('.');\n // We need to check on the version of React before requiring 'react/jsx-runtime') as\n // it might crash other exports if the export does not exist (even if there is a try/catch).\n // See: https://github.com/facebook/metro/issues/836\n if (!isJsxExportedInReactVersion(major, minor)) {\n throw new Error('React version does not support new jsx transform');\n }\n\n // /!\\/!\\/!\\/!\\/!\\/!\\\n // We have to use inline require here because older React versions (below 16.14) don't have jsx-runtime.\n // metro does not support dynamic require, so 'react/jsx-runtime' is replaced by 'react' on postinstall\n // when react is equal or above 16.14 to avoid this require call to fail during the import phase and then\n // disable all further imports.\n // /!\\/!\\/!\\/!\\/!\\/!\\\n //\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsxRuntime = require('react/jsx-runtime');\n if (!jsxRuntime.jsx) {\n throw new Error('React jsx runtime does not export new jsx transform');\n }\n return jsxRuntime;\n};\n\n/**\n * JSX Transform is available for React 16.14.0 (last React 16 version) and above\n */\nconst isJsxExportedInReactVersion = (major: string, minor: string): boolean => {\n if (Number(major) > 16) {\n return true;\n }\n if (Number(major) === 16 && Number(minor) > 13) {\n return true;\n }\n return false;\n};\n"]}
|
|
@@ -42,7 +42,8 @@ const generateTracingAttributesWithSampling = tracingSamplingRate => {
|
|
|
42
42
|
traceId: generateTraceId(),
|
|
43
43
|
spanId: generateTraceId(),
|
|
44
44
|
samplingPriorityHeader: '1',
|
|
45
|
-
tracingStrategy: 'KEEP'
|
|
45
|
+
tracingStrategy: 'KEEP',
|
|
46
|
+
rulePsr: tracingSamplingRate / 100
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["distributedTracing.tsx"],"names":["DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegex","tracingSamplingRate","generateTracingAttributesWithSampling","Math","random","traceId","generateTraceId","spanId","radix","MAX_32_BITS_NUMBER","low","floor","high","str","modH","temp","digit","toString"],"mappings":";;;;;;;;AAOA;;AAPA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["distributedTracing.tsx"],"names":["DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegex","tracingSamplingRate","generateTracingAttributesWithSampling","Math","random","traceId","generateTraceId","spanId","rulePsr","radix","MAX_32_BITS_NUMBER","low","floor","high","str","modH","temp","digit","toString"],"mappings":";;;;;;;;AAOA;;AAPA;AACA;AACA;AACA;AACA;AAoBA,MAAMA,0BAA0D,GAAG;AAC/DC,EAAAA,sBAAsB,EAAE,GADuC;AAE/DC,EAAAA,eAAe,EAAE;AAF8C,CAAnE;;AAKO,MAAMC,oBAAoB,GAAG,CAAC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,oBAFiC;AAGjCC,EAAAA;AAHiC,CAAD,KAQE;AAClC,MAAIF,QAAQ,KAAK,IAAjB,EAAuB;AACnB,WAAOJ,0BAAP;AACH;;AACD,MAAI,uCAAiBI,QAAjB,EAA2BC,oBAA3B,CAAJ,EAAsD;AAClD,WAAOE,qCAAqC,CAACD,mBAAD,CAA5C;AACH;;AACD,SAAON,0BAAP;AACH,CAhBM;;;;AAkBP,MAAMO,qCAAqC,GACvCD,mBAD0C,IAET;AACjC,MAAIE,IAAI,CAACC,MAAL,KAAgB,GAAhB,IAAuBH,mBAA3B,EAAgD;AAC5C,WAAO;AACHI,MAAAA,OAAO,EAAEC,eAAe,EADrB;AAEHC,MAAAA,MAAM,EAAED,eAAe,EAFpB;AAGHV,MAAAA,sBAAsB,EAAE,GAHrB;AAIHC,MAAAA,eAAe,EAAE,MAJd;AAKHW,MAAAA,OAAO,EAAEP,mBAAmB,GAAG;AAL5B,KAAP;AAOH;;AACD,SAAON,0BAAP;AACH,CAbD;AAeA;AACA;AACA;;;AACO,SAASW,eAAT,GAAmC;AACtC,QAAMG,KAAK,GAAG,EAAd;AACA,QAAMC,kBAAkB,GAAG,UAA3B,CAFsC,CAEC;;AACvC,MAAIC,GAAW,GAAGR,IAAI,CAACS,KAAL,CAAWT,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAlB;AACA,MAAIG,IAAY,GAAGV,IAAI,CAACS,KAAL,CAAWT,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAnB;AACA,MAAII,GAAG,GAAG,EAAV;;AAEA,SAAOD,IAAI,GAAG,CAAP,IAAYF,GAAG,GAAG,CAAzB,EAA4B;AACxB;AACA;AACA,UAAMI,IAAI,GAAGF,IAAI,GAAGJ,KAApB;AACA,UAAMO,IAAI,GAAG,CAACD,IAAI,IAAI,EAAT,IAAeJ,GAA5B;AACA,UAAMM,KAAK,GAAGD,IAAI,GAAGP,KAArB,CALwB,CAOxB;;AACAI,IAAAA,IAAI,GAAG,CAACA,IAAI,GAAGE,IAAR,IAAgBN,KAAvB,CARwB,CAQM;AAC9B;;AACAE,IAAAA,GAAG,GAAG,CAACK,IAAI,GAAGC,KAAR,IAAiBR,KAAvB,CAVwB,CAUM;AAE9B;;AACAK,IAAAA,GAAG,GAAGG,KAAK,CAACC,QAAN,KAAmBJ,GAAzB;AACH;;AACD,SAAOA,GAAP;AACH","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 { Hostname } from './firstPartyHosts';\nimport { isHostFirstParty } from './firstPartyHosts';\n\nexport type DdRumResourceTracingAttributes =\n | {\n tracingStrategy: 'KEEP';\n traceId: string;\n spanId: string;\n samplingPriorityHeader: '1';\n rulePsr: number;\n }\n | {\n tracingStrategy: 'DISCARD';\n traceId?: void;\n spanId?: void;\n samplingPriorityHeader: '0';\n };\n\nconst DISCARDED_TRACE_ATTRIBUTES: DdRumResourceTracingAttributes = {\n samplingPriorityHeader: '0',\n tracingStrategy: 'DISCARD'\n};\n\nexport const getTracingAttributes = ({\n hostname,\n firstPartyHostsRegex,\n tracingSamplingRate\n}: {\n hostname: Hostname | null;\n firstPartyHostsRegex: RegExp;\n tracingSamplingRate: number;\n}): DdRumResourceTracingAttributes => {\n if (hostname === null) {\n return DISCARDED_TRACE_ATTRIBUTES;\n }\n if (isHostFirstParty(hostname, firstPartyHostsRegex)) {\n return generateTracingAttributesWithSampling(tracingSamplingRate);\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\nconst generateTracingAttributesWithSampling = (\n tracingSamplingRate: number\n): DdRumResourceTracingAttributes => {\n if (Math.random() * 100 <= tracingSamplingRate) {\n return {\n traceId: generateTraceId(),\n spanId: generateTraceId(),\n samplingPriorityHeader: '1',\n tracingStrategy: 'KEEP',\n rulePsr: tracingSamplingRate / 100\n };\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\n/*\n * This code was inspired from browser-sdk at (https://github.com/DataDog/browser-sdk/blob/master/packages/rum-core/src/domain/tracing/tracer.ts#L107)\n */\nexport function generateTraceId(): string {\n const radix = 10;\n const MAX_32_BITS_NUMBER = 4294967295; // 2^32-1\n let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n let str = '';\n\n while (high > 0 && low > 0) {\n // Create an intermediate value with the same modulo as the combined high and low value\n // but requiring 36 bits max (32 for the low value + 4 for the high part)\n const modH = high % radix;\n const temp = (modH << 32) + low;\n const digit = temp % radix;\n\n // update the high value\n high = (high - modH) / radix; // we reuse the modH to avoid the need of a floor op\n // the low value reuses the previous temp value to account for the \"missing mod\" in the high update\n low = (temp - digit) / radix; // we reuse the digit to avoid the need of a floor op\n\n // update the string from right to left\n str = digit.toString() + str;\n }\n return str;\n}\n"]}
|
|
@@ -39,7 +39,8 @@ exports.ResourceReporter = ResourceReporter;
|
|
|
39
39
|
const formatResourceStartContext = tracingAttributes => {
|
|
40
40
|
return tracingAttributes.tracingStrategy === 'DISCARD' ? undefined : {
|
|
41
41
|
'_dd.span_id': tracingAttributes.spanId,
|
|
42
|
-
'_dd.trace_id': tracingAttributes.traceId
|
|
42
|
+
'_dd.trace_id': tracingAttributes.traceId,
|
|
43
|
+
'_dd.rule_psr': tracingAttributes.rulePsr
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ResourceReporter.ts"],"names":["ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","tracingStrategy","undefined","spanId","traceId","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","DdRum","startResource","key","request","method","url","stopResource","response","statusCode","kind","size"],"mappings":";;;;;;;AAMA;;AAGA;;;;AAIO,MAAMA,gBAAN,CAAuB;AAG1BC,EAAAA,WAAW,CAACC,eAAD,EAAoC;AAAA;;AAAA,4CAI7BC,QAAD,IAA2B;AACxC,UAAIC,gBAAoC,GAAGD,QAA3C;;AAEA,WAAK,MAAME,MAAX,IAAqB,KAAKC,OAA1B,EAAmC;AAC/BF,QAAAA,gBAAgB,GAAGC,MAAM,CAACF,QAAD,CAAzB;;AACA,YAAIC,gBAAgB,KAAK,IAAzB,EAA+B;AAC3B;AACH;AACJ;;AAEDG,MAAAA,cAAc,CAACH,gBAAD,CAAd;AACH,KAf8C;;AAC3C,SAAKE,OAAL,GAAeJ,eAAf;AACH;;AALyB;;;;AAqB9B,MAAMM,0BAA0B,GAC5BC,iBAD+B,IAEO;AACtC,SAAOA,iBAAiB,CAACC,eAAlB,KAAsC,SAAtC,GACDC,SADC,GAED;AACI,mBAAeF,iBAAiB,CAACG,MADrC;AAEI,oBAAgBH,iBAAiB,CAACI;
|
|
1
|
+
{"version":3,"sources":["ResourceReporter.ts"],"names":["ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","tracingStrategy","undefined","spanId","traceId","rulePsr","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","DdRum","startResource","key","request","method","url","stopResource","response","statusCode","kind","size"],"mappings":";;;;;;;AAMA;;AAGA;;;;AAIO,MAAMA,gBAAN,CAAuB;AAG1BC,EAAAA,WAAW,CAACC,eAAD,EAAoC;AAAA;;AAAA,4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,CAACwB,QAAT,CAAkBG,IAJtB,EAKIf,yBAAyB,CAACZ,QAAQ,CAACa,OAAV,CAL7B,EAMIb,QAAQ,CAACa,OAAT,CAAiBG,QANrB;AAQH,CAjBD","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 { DdRum } from '../../../../../foundation';\nimport type { RUMResource } from '../../domain/interfaces/RumResource';\n\nimport { createTimings } from './resourceTiming';\n\ntype ResourceMapper = (resource: RUMResource) => RUMResource | null;\n\nexport class ResourceReporter {\n private mappers: ResourceMapper[];\n\n constructor(resourceMappers: ResourceMapper[]) {\n this.mappers = resourceMappers;\n }\n\n reportResource = (resource: RUMResource) => {\n let modifiedResource: RUMResource | null = resource;\n\n for (const mapper of this.mappers) {\n modifiedResource = mapper(resource);\n if (modifiedResource === null) {\n return;\n }\n }\n\n reportResource(modifiedResource);\n };\n}\n\nconst formatResourceStartContext = (\n tracingAttributes: RUMResource['tracingAttributes']\n): Record<string, unknown> | undefined => {\n return tracingAttributes.tracingStrategy === 'DISCARD'\n ? undefined\n : {\n '_dd.span_id': tracingAttributes.spanId,\n '_dd.trace_id': tracingAttributes.traceId,\n '_dd.rule_psr': tracingAttributes.rulePsr\n };\n};\n\nconst formatResourceStopContext = (\n timings: RUMResource['timings']\n): Record<string, unknown> => {\n return {\n '_dd.resource_timings':\n timings.responseStartTime !== undefined\n ? createTimings(\n timings.startTime,\n timings.responseStartTime,\n timings.stopTime\n )\n : null\n };\n};\n\nconst reportResource = async (resource: RUMResource) => {\n await DdRum.startResource(\n resource.key,\n resource.request.method,\n resource.request.url,\n formatResourceStartContext(resource.tracingAttributes),\n resource.timings.startTime\n );\n\n DdRum.stopResource(\n resource.key,\n resource.response.statusCode,\n resource.request.kind,\n resource.response.size,\n formatResourceStopContext(resource.timings),\n resource.timings.stopTime\n );\n};\n"]}
|
package/lib/commonjs/types.js
CHANGED
|
@@ -15,16 +15,20 @@ exports.ErrorSource = exports.RumActionType = exports.DdSdkConfiguration = void
|
|
|
15
15
|
* A configuration object to initialize Datadog's features.
|
|
16
16
|
*/
|
|
17
17
|
class DdSdkConfiguration {
|
|
18
|
-
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate) {
|
|
18
|
+
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate, vitalsUpdateFrequency, configurationForTelemetry) {
|
|
19
19
|
this.clientToken = clientToken;
|
|
20
20
|
this.env = env;
|
|
21
21
|
this.applicationId = applicationId;
|
|
22
22
|
this.nativeCrashReportEnabled = nativeCrashReportEnabled;
|
|
23
|
+
this.nativeLongTaskThresholdMs = nativeLongTaskThresholdMs;
|
|
24
|
+
this.longTaskThresholdMs = longTaskThresholdMs;
|
|
23
25
|
this.sampleRate = sampleRate;
|
|
24
26
|
this.site = site;
|
|
25
27
|
this.trackingConsent = trackingConsent;
|
|
26
28
|
this.additionalConfig = additionalConfig;
|
|
27
29
|
this.telemetrySampleRate = telemetrySampleRate;
|
|
30
|
+
this.vitalsUpdateFrequency = vitalsUpdateFrequency;
|
|
31
|
+
this.configurationForTelemetry = configurationForTelemetry;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","RumActionType","ErrorSource"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,gBARF,EASEC,mBATF,EAUT;AAAA,SATWR,WASX,GATWA,WASX;AAAA,SARWC,GAQX,GARWA,GAQX;AAAA,SAPWC,aAOX,GAPWA,aAOX;AAAA,SANWC,wBAMX,GANWA,wBAMX;AAAA,SALWC,UAKX,GALWA,UAKX;AAAA,SAJWC,IAIX,GAJWA,IAIX;AAAA,SAHWC,eAGX,GAHWA,eAGX;AAAA,SAFWC,gBAEX,GAFWA,gBAEX;AAAA,SADWC,mBACX,GADWA,mBACX;AAAE;;AAXwB;AAchC;AACA;AACA;;;;;AAqOA;AACA;AACA;IACYC,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a;;IA0BAC,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","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 * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\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 pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry","RumActionType","ErrorSource"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,gBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,yBAbF,EAmBT;AAAA,SAlBWZ,WAkBX,GAlBWA,WAkBX;AAAA,SAjBWC,GAiBX,GAjBWA,GAiBX;AAAA,SAhBWC,aAgBX,GAhBWA,aAgBX;AAAA,SAfWC,wBAeX,GAfWA,wBAeX;AAAA,SAdWC,yBAcX,GAdWA,yBAcX;AAAA,SAbWC,mBAaX,GAbWA,mBAaX;AAAA,SAZWC,UAYX,GAZWA,UAYX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SAVWC,eAUX,GAVWA,eAUX;AAAA,SATWC,gBASX,GATWA,gBASX;AAAA,SARWC,mBAQX,GARWA,mBAQX;AAAA,SAPWC,qBAOX,GAPWA,qBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AApBwB;AAuBhC;AACA;AACA;;;;;AAqOA;AACA;AACA;IACYC,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a;;IA0BAC,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","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 * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n }\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\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 pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n"]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,aAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.2.0-
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,aAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.2.0-beta2';\n"]}
|
|
@@ -12,6 +12,7 @@ import { InternalLog } from './InternalLog';
|
|
|
12
12
|
import { ProxyType } from './ProxyConfiguration';
|
|
13
13
|
import { SdkVerbosity } from './SdkVerbosity';
|
|
14
14
|
import { DdSdk } from './foundation';
|
|
15
|
+
import { adaptLongTaskThreshold } from './longTasksUtils';
|
|
15
16
|
import { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';
|
|
16
17
|
import { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking';
|
|
17
18
|
import { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';
|
|
@@ -30,7 +31,9 @@ export class DdSdkReactNative {
|
|
|
30
31
|
* @returns a Promise.
|
|
31
32
|
*/
|
|
32
33
|
static async initialize(configuration) {
|
|
33
|
-
await DdSdkReactNative.initializeNativeSDK(configuration
|
|
34
|
+
await DdSdkReactNative.initializeNativeSDK(configuration, {
|
|
35
|
+
initializationModeForTelemetry: 'LEGACY'
|
|
36
|
+
});
|
|
34
37
|
DdSdkReactNative.enableFeatures(configuration);
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -39,21 +42,26 @@ export class DdSdkReactNative {
|
|
|
39
42
|
*/
|
|
40
43
|
static async _initializeFromDatadogProvider(configuration) {
|
|
41
44
|
DdSdkReactNative.enableFeatures(configuration);
|
|
42
|
-
DdSdkReactNative.configuration = configuration;
|
|
43
45
|
|
|
44
46
|
if (configuration.initializationMode === InitializationMode.SYNC) {
|
|
45
|
-
return DdSdkReactNative.initializeNativeSDK(configuration
|
|
47
|
+
return DdSdkReactNative.initializeNativeSDK(configuration, {
|
|
48
|
+
initializationModeForTelemetry: 'SYNC'
|
|
49
|
+
});
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
if (configuration.initializationMode === InitializationMode.ASYNC) {
|
|
49
53
|
return InteractionManager.runAfterInteractions(() => {
|
|
50
|
-
return DdSdkReactNative.initializeNativeSDK(configuration
|
|
54
|
+
return DdSdkReactNative.initializeNativeSDK(configuration, {
|
|
55
|
+
initializationModeForTelemetry: 'ASYNC'
|
|
56
|
+
});
|
|
51
57
|
});
|
|
52
58
|
} // TODO: Remove when DdSdkReactNativeConfiguration is deprecated
|
|
53
59
|
|
|
54
60
|
|
|
55
61
|
if (configuration instanceof DdSdkReactNativeConfiguration) {
|
|
56
|
-
return DdSdkReactNative.initializeNativeSDK(configuration
|
|
62
|
+
return DdSdkReactNative.initializeNativeSDK(configuration, {
|
|
63
|
+
initializationModeForTelemetry: 'SYNC'
|
|
64
|
+
});
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
/**
|
|
@@ -154,19 +162,13 @@ _defineProperty(DdSdkReactNative, "DD_PROXY_USERNAME_KEY", '_dd.proxy.username')
|
|
|
154
162
|
|
|
155
163
|
_defineProperty(DdSdkReactNative, "DD_PROXY_PASSWORD_KEY", '_dd.proxy.password');
|
|
156
164
|
|
|
157
|
-
_defineProperty(DdSdkReactNative, "DD_NATIVE_LONG_TASK_THRESHOLD_KEY", '_dd.long_task.threshold');
|
|
158
|
-
|
|
159
|
-
_defineProperty(DdSdkReactNative, "NATIVE_LONG_TASK_THRESHOLD_MS", 200);
|
|
160
|
-
|
|
161
165
|
_defineProperty(DdSdkReactNative, "wasInitialized", false);
|
|
162
166
|
|
|
163
167
|
_defineProperty(DdSdkReactNative, "wasAutoInstrumented", false);
|
|
164
168
|
|
|
165
|
-
_defineProperty(DdSdkReactNative, "configuration", void 0);
|
|
166
|
-
|
|
167
169
|
_defineProperty(DdSdkReactNative, "features", void 0);
|
|
168
170
|
|
|
169
|
-
_defineProperty(DdSdkReactNative, "initializeNativeSDK", async configuration => {
|
|
171
|
+
_defineProperty(DdSdkReactNative, "initializeNativeSDK", async (configuration, params) => {
|
|
170
172
|
if (DdSdkReactNative.wasInitialized) {
|
|
171
173
|
InternalLog.log("Can't initialize Datadog, SDK was already initialized", SdkVerbosity.WARN);
|
|
172
174
|
|
|
@@ -179,28 +181,26 @@ _defineProperty(DdSdkReactNative, "initializeNativeSDK", async configuration =>
|
|
|
179
181
|
|
|
180
182
|
InternalLog.verbosity = configuration.verbosity;
|
|
181
183
|
DdSdkReactNative.buildConfiguration(configuration);
|
|
182
|
-
await DdSdk.initialize(new DdSdkConfiguration(configuration.clientToken, configuration.env, configuration.applicationId, configuration.nativeCrashReportEnabled, configuration.sampleRate === undefined ? configuration.sessionSamplingRate : configuration.sampleRate, configuration.site, configuration.trackingConsent, configuration.additionalConfig, configuration.telemetrySampleRate
|
|
184
|
+
await DdSdk.initialize(new DdSdkConfiguration(configuration.clientToken, configuration.env, configuration.applicationId, configuration.nativeCrashReportEnabled, adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs), adaptLongTaskThreshold(configuration.longTaskThresholdMs), configuration.sampleRate === undefined ? configuration.sessionSamplingRate : configuration.sampleRate, configuration.site, configuration.trackingConsent, configuration.additionalConfig, configuration.telemetrySampleRate, configuration.vitalsUpdateFrequency, {
|
|
185
|
+
initializationType: params.initializationModeForTelemetry,
|
|
186
|
+
trackErrors: configuration.trackErrors,
|
|
187
|
+
trackInteractions: configuration.trackInteractions,
|
|
188
|
+
trackNetworkRequests: configuration.trackResources
|
|
189
|
+
}));
|
|
183
190
|
InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);
|
|
184
191
|
DdSdkReactNative.wasInitialized = true;
|
|
185
192
|
BufferSingleton.onInitialization();
|
|
186
193
|
});
|
|
187
194
|
|
|
188
|
-
_defineProperty(DdSdkReactNative, "_initializeFromDatadogProviderAsync", async () => {
|
|
189
|
-
if (!DdSdkReactNative.configuration) {
|
|
190
|
-
InternalLog.log("Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function", SdkVerbosity.WARN);
|
|
191
|
-
return new Promise(resolve => resolve());
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return DdSdkReactNative.initializeNativeSDK(DdSdkReactNative.configuration);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
195
|
_defineProperty(DdSdkReactNative, "_initializeFromDatadogProviderWithConfigurationAsync", async configuration => {
|
|
198
196
|
if (!DdSdkReactNative.features) {
|
|
199
197
|
InternalLog.log("Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function", SdkVerbosity.WARN);
|
|
200
198
|
return new Promise(resolve => resolve());
|
|
201
199
|
}
|
|
202
200
|
|
|
203
|
-
return DdSdkReactNative.initializeNativeSDK(buildConfigurationFromPartialConfiguration(DdSdkReactNative.features, configuration)
|
|
201
|
+
return DdSdkReactNative.initializeNativeSDK(buildConfigurationFromPartialConfiguration(DdSdkReactNative.features, configuration), {
|
|
202
|
+
initializationModeForTelemetry: 'PARTIAL'
|
|
203
|
+
});
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
_defineProperty(DdSdkReactNative, "buildConfiguration", configuration => {
|
|
@@ -243,7 +243,6 @@ _defineProperty(DdSdkReactNative, "buildConfiguration", configuration => {
|
|
|
243
243
|
configuration.additionalConfig[DdSdkReactNative.DD_VERSION_SUFFIX] = `-${configuration.versionSuffix}`;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_LONG_TASK_THRESHOLD_KEY] = DdSdkReactNative.NATIVE_LONG_TASK_THRESHOLD_MS;
|
|
247
246
|
configuration.additionalConfig['_dd.first_party_hosts'] = configuration.firstPartyHosts;
|
|
248
247
|
});
|
|
249
248
|
//# sourceMappingURL=DdSdkReactNative.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdSdkReactNative.tsx"],"names":["InteractionManager","BufferSingleton","DdSdkReactNativeConfiguration","buildConfigurationFromPartialConfiguration","addDefaultValuesToAutoInstrumentationConfiguration","InitializationMode","InternalLog","ProxyType","SdkVerbosity","DdSdk","DdRumErrorTracking","DdRumUserInteractionTracking","DdRumResourceTracking","DdSdkConfiguration","version","sdkVersion","DdSdkReactNative","initialize","configuration","initializeNativeSDK","enableFeatures","_initializeFromDatadogProvider","initializationMode","SYNC","ASYNC","runAfterInteractions","_enableFeaturesFromDatadogProvider","features","setAttributes","attributes","log","JSON","stringify","DEBUG","setUser","user","setTrackingConsent","consent","wasAutoInstrumented","WARN","trackInteractions","startTracking","trackResources","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","wasInitialized","__DEV__","telemetryDebug","Promise","resolve","verbosity","buildConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","additionalConfig","telemetrySampleRate","INFO","onInitialization","DD_SOURCE_KEY","DD_SDK_VERSION","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX","DD_NATIVE_LONG_TASK_THRESHOLD_KEY","NATIVE_LONG_TASK_THRESHOLD_MS"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,kBAAT,QAAmC,cAAnC;AAEA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SACIC,6BADJ,EAEIC,0CAFJ,EAGIC,kDAHJ,EAIIC,kBAJJ,QAKO,iCALP;AAYA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,kBAAT,QAAmC,0CAAnC;AACA,SAASC,4BAAT,QAA6C,oDAA7C;AACA,SAASC,qBAAT,QAAsC,8DAAtC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,OAAO,IAAIC,UAApB,QAAsC,WAAtC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAN,CAAuB;AAU1B;;AAgBA;AACJ;AACA;AACA;AACA;AAC2B,eAAVC,UAAU,CACnBC,aADmB,EAEN;AACb,UAAMF,gBAAgB,CAACG,mBAAjB,CAAqCD,aAArC,CAAN;AACAF,IAAAA,gBAAgB,CAACI,cAAjB,CAAgCF,aAAhC;AACH;;AA0CD;AACJ;AACA;AAC+C,eAA9BG,8BAA8B,CACvCH,aADuC,EAE1B;AACbF,IAAAA,gBAAgB,CAACI,cAAjB,CAAgCF,aAAhC;AACAF,IAAAA,gBAAgB,CAACE,aAAjB,GAAiCA,aAAjC;;AACA,QAAIA,aAAa,CAACI,kBAAd,KAAqCjB,kBAAkB,CAACkB,IAA5D,EAAkE;AAC9D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AIN,WAAW,CAACO,QAAZ,IAAwBP,WAAW,CAACQ,QAAxC,EAAkD;AAC9C,UAAIR,WAAW,CAACE,IAAZ,KAAqBnE,SAAS,CAAC0E,KAAnC,EAA0C;AACtCC,QAAAA,OAAO,CAACC,IAAR,CACI,iEADJ;AAGH,OAJD,MAIO;AACHpB,QAAAA,gBAAgB,CAAC/C,gBAAgB,CAACoE,qBAAlB,CAAhB,GACIZ,WAAW,CAACO,QADhB;AAEAhB,QAAAA,gBAAgB,CAAC/C,gBAAgB,CAACqE,qBAAlB,CAAhB,GACIb,WAAW,CAACQ,QADhB;AAEH;AACJ;AACJ;;AAED,MAAI9D,aAAa,CAACoE,WAAlB,EAA+B;AAC3BpE,IAAAA,aAAa,CAAC6C,gBAAd,CAA+B/C,gBAAgB,CAACuE,eAAhD,IACIrE,aAAa,CAACoE,WADlB;AAEH;;AAED,MAAIpE,aAAa,CAACJ,OAAlB,EAA2B;AACvBI,IAAAA,aAAa,CAAC6C,gBAAd,CAA+B/C,gBAAgB,CAACwE,UAAhD,IAA+D,GAC3DtE,aAAa,CAACJ,OACjB,GACGI,aAAa,CAACuE,aAAd,GACO,IAAGvE,aAAa,CAACuE,aAAc,EADtC,GAEM,EACT,EAND;AAOH,GApDA,CAsDD;AACA;;;AACA,MAAIvE,aAAa,CAACuE,aAAd,IAA+B,CAACvE,aAAa,CAACJ,OAAlD,EAA2D;AACvDI,IAAAA,aAAa,CAAC6C,gBAAd,CACI/C,gBAAgB,CAAC0E,iBADrB,IAEK,IAAGxE,aAAa,CAACuE,aAAc,EAFpC;AAGH;;AAEDvE,EAAAA,aAAa,CAAC6C,gBAAd,CACI/C,gBAAgB,CAAC2E,iCADrB,IAEI3E,gBAAgB,CAAC4E,6BAFrB;AAIA1E,EAAAA,aAAa,CAAC6C,gBAAd,CAA+B,uBAA/B,IACI7C,aAAa,CAAC2B,eADlB;AAEH,C","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 { InteractionManager } from 'react-native';\n\nimport { BufferSingleton } from './DatadogProvider/Buffer/BufferSingleton';\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdSdk } from './foundation';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { DdSdkConfiguration } from './types';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_SERVICE_NAME = '_dd.service_name';\n private static readonly DD_SDK_VERBOSITY_KEY = '_dd.sdk_verbosity';\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY =\n '_dd.native_view_tracking';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = '_dd.proxy.type';\n private static readonly DD_PROXY_ADDRESS_KEY = '_dd.proxy.address';\n private static readonly DD_PROXY_PORT_KEY = '_dd.proxy.port';\n private static readonly DD_PROXY_USERNAME_KEY = '_dd.proxy.username';\n private static readonly DD_PROXY_PASSWORD_KEY = '_dd.proxy.password';\n\n private static readonly DD_NATIVE_LONG_TASK_THRESHOLD_KEY =\n '_dd.long_task.threshold';\n private static readonly NATIVE_LONG_TASK_THRESHOLD_MS = 200;\n\n private static wasInitialized = false;\n private static wasAutoInstrumented = false;\n private static configuration?: DdSdkReactNativeConfiguration;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static async initialize(\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> {\n await DdSdkReactNative.initializeNativeSDK(configuration);\n DdSdkReactNative.enableFeatures(configuration);\n }\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> => {\n if (DdSdkReactNative.wasInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n DdSdkReactNative.buildConfiguration(configuration);\n\n await DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig,\n configuration.telemetrySampleRate\n )\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative.wasInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n DdSdkReactNative.configuration = configuration;\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration);\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration);\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration);\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderAsync = async (): Promise<void> => {\n if (!DdSdkReactNative.configuration) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n return DdSdkReactNative.initializeNativeSDK(\n DdSdkReactNative.configuration\n );\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n )\n );\n };\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes(attributes: object): Promise<void> {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setAttributes(attributes);\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser(user: object): Promise<void> {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setUser(user);\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration\n ) => {\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY\n ] = configuration.nativeViewTracking;\n if (configuration.verbosity) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERBOSITY_KEY\n ] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] =\n proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] =\n proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] =\n proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] =\n proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] =\n proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] =\n configuration.serviceName;\n }\n\n if (configuration.version) {\n configuration.additionalConfig[DdSdkReactNative.DD_VERSION] = `${\n configuration.version\n }${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_LONG_TASK_THRESHOLD_KEY\n ] = DdSdkReactNative.NATIVE_LONG_TASK_THRESHOLD_MS;\n\n configuration.additionalConfig['_dd.first_party_hosts'] =\n configuration.firstPartyHosts;\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: configuration.firstPartyHosts\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["DdSdkReactNative.tsx"],"names":["InteractionManager","BufferSingleton","DdSdkReactNativeConfiguration","buildConfigurationFromPartialConfiguration","addDefaultValuesToAutoInstrumentationConfiguration","InitializationMode","InternalLog","ProxyType","SdkVerbosity","DdSdk","adaptLongTaskThreshold","DdRumErrorTracking","DdRumUserInteractionTracking","DdRumResourceTracking","DdSdkConfiguration","version","sdkVersion","DdSdkReactNative","initialize","configuration","initializeNativeSDK","initializationModeForTelemetry","enableFeatures","_initializeFromDatadogProvider","initializationMode","SYNC","ASYNC","runAfterInteractions","_enableFeaturesFromDatadogProvider","features","setAttributes","attributes","log","JSON","stringify","DEBUG","setUser","user","setTrackingConsent","consent","wasAutoInstrumented","WARN","trackInteractions","startTracking","trackResources","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","params","wasInitialized","__DEV__","telemetryDebug","Promise","resolve","verbosity","buildConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","initializationType","trackNetworkRequests","INFO","onInitialization","DD_SOURCE_KEY","DD_SDK_VERSION","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,kBAAT,QAAmC,cAAnC;AAEA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SACIC,6BADJ,EAEIC,0CAFJ,EAGIC,kDAHJ,EAIIC,kBAJJ,QAKO,iCALP;AAaA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,sBAAT,QAAuC,kBAAvC;AACA,SAASC,kBAAT,QAAmC,0CAAnC;AACA,SAASC,4BAAT,QAA6C,oDAA7C;AACA,SAASC,qBAAT,QAAsC,8DAAtC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,OAAO,IAAIC,UAApB,QAAsC,WAAtC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAN,CAAuB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,aAAa,CAACiD,gBAAd,CAA+BnD,gBAAgB,CAAC+E,UAAhD,IAA+D,GAC3D7E,aAAa,CAACJ,OACjB,GACGI,aAAa,CAAC8E,aAAd,GACO,IAAG9E,aAAa,CAAC8E,aAAc,EADtC,GAEM,EACT,EAND;AAOH,GApDA,CAsDD;AACA;;;AACA,MAAI9E,aAAa,CAAC8E,aAAd,IAA+B,CAAC9E,aAAa,CAACJ,OAAlD,EAA2D;AACvDI,IAAAA,aAAa,CAACiD,gBAAd,CACInD,gBAAgB,CAACiF,iBADrB,IAEK,IAAG/E,aAAa,CAAC8E,aAAc,EAFpC;AAGH;;AAED9E,EAAAA,aAAa,CAACiD,gBAAd,CAA+B,uBAA/B,IACIjD,aAAa,CAAC4B,eADlB;AAEH,C","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 { InteractionManager } from 'react-native';\n\nimport { BufferSingleton } from './DatadogProvider/Buffer/BufferSingleton';\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdSdk } from './foundation';\nimport { adaptLongTaskThreshold } from './longTasksUtils';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { DdSdkConfiguration } from './types';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_SERVICE_NAME = '_dd.service_name';\n private static readonly DD_SDK_VERBOSITY_KEY = '_dd.sdk_verbosity';\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY =\n '_dd.native_view_tracking';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = '_dd.proxy.type';\n private static readonly DD_PROXY_ADDRESS_KEY = '_dd.proxy.address';\n private static readonly DD_PROXY_PORT_KEY = '_dd.proxy.port';\n private static readonly DD_PROXY_USERNAME_KEY = '_dd.proxy.username';\n private static readonly DD_PROXY_PASSWORD_KEY = '_dd.proxy.password';\n\n private static wasInitialized = false;\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static async initialize(\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n }\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (DdSdkReactNative.wasInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n DdSdkReactNative.buildConfiguration(configuration);\n\n await DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources\n }\n )\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative.wasInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes(attributes: object): Promise<void> {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setAttributes(attributes);\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser(user: object): Promise<void> {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setUser(user);\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration\n ) => {\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY\n ] = configuration.nativeViewTracking;\n if (configuration.verbosity) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERBOSITY_KEY\n ] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] =\n proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] =\n proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] =\n proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] =\n proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] =\n proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] =\n configuration.serviceName;\n }\n\n if (configuration.version) {\n configuration.additionalConfig[DdSdkReactNative.DD_VERSION] = `${\n configuration.version\n }${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n configuration.additionalConfig['_dd.first_party_hosts'] =\n configuration.firstPartyHosts;\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: configuration.firstPartyHosts\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
|
|
@@ -6,16 +6,28 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
6
6
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
7
|
*/
|
|
8
8
|
import { TrackingConsent } from './TrackingConsent';
|
|
9
|
+
export let VitalsUpdateFrequency;
|
|
10
|
+
|
|
11
|
+
(function (VitalsUpdateFrequency) {
|
|
12
|
+
VitalsUpdateFrequency["FREQUENT"] = "FREQUENT";
|
|
13
|
+
VitalsUpdateFrequency["AVERAGE"] = "AVERAGE";
|
|
14
|
+
VitalsUpdateFrequency["RARE"] = "RARE";
|
|
15
|
+
VitalsUpdateFrequency["NEVER"] = "NEVER";
|
|
16
|
+
})(VitalsUpdateFrequency || (VitalsUpdateFrequency = {}));
|
|
17
|
+
|
|
9
18
|
const DEFAULTS = {
|
|
10
19
|
nativeCrashReportEnabled: false,
|
|
11
20
|
sessionSamplingRate: 100.0,
|
|
12
21
|
resourceTracingSamplingRate: 20.0,
|
|
13
22
|
site: 'US1',
|
|
23
|
+
longTaskThresholdMs: 0,
|
|
24
|
+
nativeLongTaskThresholdMs: 200,
|
|
14
25
|
nativeViewTracking: false,
|
|
15
26
|
getFirstPartyHosts: () => [],
|
|
16
27
|
getAdditionalConfig: () => ({}),
|
|
17
28
|
trackingConsent: TrackingConsent.GRANTED,
|
|
18
|
-
telemetrySampleRate: 20.0
|
|
29
|
+
telemetrySampleRate: 20.0,
|
|
30
|
+
vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE
|
|
19
31
|
};
|
|
20
32
|
/**
|
|
21
33
|
* The SDK configuration class.
|
|
@@ -23,6 +35,10 @@ const DEFAULTS = {
|
|
|
23
35
|
*/
|
|
24
36
|
|
|
25
37
|
export class DdSdkReactNativeConfiguration {
|
|
38
|
+
/**
|
|
39
|
+
* Enables crash reporting for native plaforms (iOS, Android). Default `false`.
|
|
40
|
+
*/
|
|
41
|
+
|
|
26
42
|
/**
|
|
27
43
|
* @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.
|
|
28
44
|
*/
|
|
@@ -35,6 +51,23 @@ export class DdSdkReactNativeConfiguration {
|
|
|
35
51
|
* Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.
|
|
36
52
|
*/
|
|
37
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Verbosity for internal SDK logging.
|
|
56
|
+
* Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Enables native views tracking.
|
|
61
|
+
* Set to `true` if you use a custom navigation system relying on native views.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* List of your backends hosts to enable tracing with.
|
|
66
|
+
* Regular expressions are NOT supported.
|
|
67
|
+
*
|
|
68
|
+
* Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.
|
|
69
|
+
*/
|
|
70
|
+
|
|
38
71
|
/**
|
|
39
72
|
* Overrides the reported version of the app.
|
|
40
73
|
* Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
|
|
@@ -64,6 +97,30 @@ export class DdSdkReactNativeConfiguration {
|
|
|
64
97
|
* `telemetrySampleRate` is not set, the default value from the iOS and
|
|
65
98
|
* Android SDK is used, which is 20.
|
|
66
99
|
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The threshold for native long tasks reporting in milliseconds.
|
|
103
|
+
*
|
|
104
|
+
* - Setting it to `0` or `false` disables native long task reporting.
|
|
105
|
+
* - Values below `100` will be raised to `100`.
|
|
106
|
+
* - Values above `5000` will be lowered to `5000`.
|
|
107
|
+
*
|
|
108
|
+
* Default value is `200`.
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The threshold for javascript long tasks reporting in milliseconds.
|
|
113
|
+
*
|
|
114
|
+
* - Setting it to `0` or `false` disables javascript long task reporting.
|
|
115
|
+
* - Values below `100` will be raised to `100`.
|
|
116
|
+
* - Values above `5000` will be lowered to `5000`.
|
|
117
|
+
*
|
|
118
|
+
* Default value is `0`
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Sets the preferred frequency for collecting mobile vitals.
|
|
123
|
+
*/
|
|
67
124
|
constructor(clientToken, env, applicationId, trackInteractions = false, trackResources = false, trackErrors = false, trackingConsent = DEFAULTS.trackingConsent) {
|
|
68
125
|
this.clientToken = clientToken;
|
|
69
126
|
this.env = env;
|
|
@@ -99,6 +156,12 @@ export class DdSdkReactNativeConfiguration {
|
|
|
99
156
|
|
|
100
157
|
_defineProperty(this, "telemetrySampleRate", DEFAULTS.telemetrySampleRate);
|
|
101
158
|
|
|
159
|
+
_defineProperty(this, "nativeLongTaskThresholdMs", DEFAULTS.nativeLongTaskThresholdMs);
|
|
160
|
+
|
|
161
|
+
_defineProperty(this, "longTaskThresholdMs", DEFAULTS.longTaskThresholdMs);
|
|
162
|
+
|
|
163
|
+
_defineProperty(this, "vitalsUpdateFrequency", DEFAULTS.vitalsUpdateFrequency);
|
|
164
|
+
|
|
102
165
|
_defineProperty(this, "additionalConfig", DEFAULTS.getAdditionalConfig());
|
|
103
166
|
}
|
|
104
167
|
|