@datadog/mobile-react-native 1.4.0 → 1.5.1
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 +5 -5
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +6 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +124 -95
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +2 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +148 -25
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +5 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +2 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +10 -0
- package/datadog-sourcemaps.gradle +6 -1
- package/ios/Sources/DdSdk.m +4 -0
- package/ios/Sources/DdSdk.swift +17 -0
- package/ios/Sources/DdSdkConfiguration.swift +6 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +2 -0
- package/jest/mock.js +1 -1
- package/lib/commonjs/DdSdkReactNative.js +7 -7
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +8 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +3 -3
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -2
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +4 -4
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +4 -4
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +2 -2
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DdSdk.js +17 -0
- package/lib/commonjs/sdk/DdSdk.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +2 -2
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/{foundation.js → trace/DdTrace.js} +9 -19
- package/lib/commonjs/trace/DdTrace.js.map +1 -0
- package/lib/commonjs/types.js +2 -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 +2 -2
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +8 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +1 -1
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -5
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +4 -4
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DdSdk.js +9 -0
- package/lib/module/sdk/DdSdk.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/{foundation.js → trace/DdTrace.js} +9 -11
- package/lib/module/trace/DdTrace.js.map +1 -0
- package/lib/module/types.js +2 -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/DdSdkReactNativeConfiguration.d.ts +5 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/nativeModulesTypes.d.ts +5 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.d.ts +2 -2
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/sdk/DdSdk.d.ts +3 -0
- package/lib/typescript/trace/DdTrace.d.ts +3 -0
- package/lib/typescript/types.d.ts +2 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +76 -76
- package/src/DdSdkReactNative.tsx +2 -1
- package/src/DdSdkReactNativeConfiguration.tsx +8 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +1 -1
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +1 -1
- package/src/index.tsx +1 -1
- package/src/nativeModulesTypes.ts +6 -0
- package/src/rum/DdRum.ts +1 -1
- package/src/rum/__tests__/DdRum.test.ts +1 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +1 -1
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +5 -5
- package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.tsx +1 -1
- package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts +1 -2
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/ResourceReporter.test.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/__utils__/ResourceMockFactory.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.ts +3 -3
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.ts +6 -6
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/XHRProxy.test.ts +9 -9
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +1 -1
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +1 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -1
- package/src/sdk/DdSdk.ts +13 -0
- package/src/sdk/EventMappers/EventMapper.ts +1 -1
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +1 -1
- package/src/trace/DdTrace.ts +54 -0
- package/src/types.tsx +1 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/foundation.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
- package/lib/module/foundation.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/URLHostParser.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
- package/lib/typescript/foundation.d.ts +0 -5
- package/src/foundation.tsx +0 -36
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js.map +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js.map +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.d.ts +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.d.ts +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.d.ts +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/__tests__/distributedTracing.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/__tests__/firstPartyHosts.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/URLHostParser.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.ts +0 -0
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["responseSize.ts"],"names":["InternalLog","SdkVerbosity","MISSING_RESOURCE_SIZE","RESOURCE_SIZE_ERROR_MESSAGE","byteLength","str","unescape","encodeURI","length","getResponseContentLengthFromHeader","xhr","contentLengthHeader","parseInt","getResponseHeader","isNaN","calculateResponseSize","response","size","responseType","JSON","stringify","e","log","ERROR"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,WAAT,QAA4B,4BAA5B;AACA,SAASC,YAAT,QAA6B,6BAA7B;AAEA,MAAMC,qBAAqB,GAAG,CAAC,CAA/B;AACA,OAAO,MAAMC,2BAA2B,GACpC,wDADG;;AAGP,SAASC,UAAT,CAAoBC,GAApB,EAAyC;AACrC;AACA;AACA,SAAOC,QAAQ,CAACC,SAAS,CAACF,GAAD,CAAV,CAAR,CAAyBG,MAAhC;AACH;;AAED,SAASC,kCAAT,CACIC,GADJ,EAEiB;AAAA;;AACb,QAAMC,mBAAmB,GAAGC,QAAQ,0BAChCF,GAAG,CAACG,iBAAJ,CAAsB,gBAAtB,CADgC,yEACW,EADX,EAEhC,EAFgC,CAApC;;AAIA,MAAI,CAACC,KAAK,CAACH,mBAAD,CAAV,EAAiC;AAC7B,WAAOA,mBAAP;AACH;;AACD,SAAO,IAAP;AACH;;AAED,OAAO,SAASI,qBAAT,CAA+BL,GAA/B,EAA4D;AAC/D,QAAMC,mBAAmB,GAAGF,kCAAkC,CAACC,GAAD,CAA9D;;AACA,MAAIC,mBAAmB,IAAI,IAA3B,EAAiC;AAC7B,WAAOA,mBAAP;AACH;;AAED,QAAMK,QAAQ,GAAGN,GAAG,CAACM,QAArB;;AACA,MAAI,CAACA,QAAL,EAAe;AACX,WAAOd,qBAAP;AACH;;AAED,MAAIe,IAAJ;;AACA,MAAI;AACA,YAAQP,GAAG,CAACQ,YAAZ;AACI,WAAK,EAAL;AACA,WAAK,MAAL;AACI;AACAD,QAAAA,IAAI,GAAGb,UAAU,CAACY,QAAD,CAAjB;AACA;;AACJ,WAAK,MAAL;AACIC,QAAAA,IAAI,GAAGD,QAAQ,CAACC,IAAhB;AACA;;AACJ,WAAK,aAAL;AACIA,QAAAA,IAAI,GAAGD,QAAQ,CAACZ,UAAhB;AACA;;AACJ,WAAK,UAAL;AACI;AACA;AACA;;AACJ,WAAK,MAAL;AACI;AACA;AACA;AACA;AACAa,QAAAA,IAAI,GAAGb,UAAU,CAACe,IAAI,CAACC,SAAL,CAAeJ,QAAf,CAAD,CAAjB;AACA;;AACJ;AACI;AAxBR;AA0BH,GA3BD,CA2BE,OAAOK,CAAP,EAAU;AACRrB,IAAAA,WAAW,CAACsB,GAAZ,CACK,GAAEnB,2BAA4B,GAAEkB,CAAE,EADvC,EAEIpB,YAAY,CAACsB,KAFjB;AAIH;;AAED,MAAI,OAAON,IAAP,KAAgB,QAApB,EAA8B;AAC1B,WAAOf,qBAAP;AACH;;AACD,SAAOe,IAAP;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 { InternalLog } from '../../../../../InternalLog';\nimport { SdkVerbosity } from '../../../../../SdkVerbosity';\n\nconst MISSING_RESOURCE_SIZE = -1;\nexport const RESOURCE_SIZE_ERROR_MESSAGE =\n \"Couldn't get resource size, because an error occured: \";\n\nfunction byteLength(str: string): number {\n // This is a weird trick, but it works.\n // Output is the same as TextEncoder.encode(...).length\n return unescape(encodeURI(str)).length;\n}\n\nfunction getResponseContentLengthFromHeader(\n xhr: XMLHttpRequest\n): number | null {\n const contentLengthHeader = parseInt(\n xhr.getResponseHeader('Content-Length') ?? '',\n 10\n );\n if (!isNaN(contentLengthHeader)) {\n return contentLengthHeader;\n }\n return null;\n}\n\nexport function calculateResponseSize(xhr: XMLHttpRequest): number {\n const contentLengthHeader = getResponseContentLengthFromHeader(xhr);\n if (contentLengthHeader != null) {\n return contentLengthHeader as number;\n }\n\n const response = xhr.response;\n if (!response) {\n return MISSING_RESOURCE_SIZE;\n }\n\n let size;\n try {\n switch (xhr.responseType) {\n case '':\n case 'text':\n // String\n size = byteLength(response);\n break;\n case 'blob':\n size = response.size;\n break;\n case 'arraybuffer':\n size = response.byteLength;\n break;\n case 'document':\n // currently not supported by RN as of 0.66\n // HTML Document or XML Document\n break;\n case 'json':\n // plain JS object\n // original size was lost, because this is the object which was parsed.\n // We can only convert back to the string and calculate the size,\n // which will roughly match original.\n size = byteLength(JSON.stringify(response));\n break;\n default:\n break;\n }\n } catch (e) {\n InternalLog.log(\n `${RESOURCE_SIZE_ERROR_MESSAGE}${e}`,\n SdkVerbosity.ERROR\n );\n }\n\n if (typeof size !== 'number') {\n return MISSING_RESOURCE_SIZE;\n }\n return size;\n}\n"]}
|
|
@@ -8,7 +8,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
8
8
|
import { InternalLog } from '../../../InternalLog';
|
|
9
9
|
import { SdkVerbosity } from '../../../SdkVerbosity';
|
|
10
10
|
import { getErrorStackTrace } from '../../../errorUtils';
|
|
11
|
-
import { DdSdk } from '../../../
|
|
11
|
+
import { DdSdk } from '../../../sdk/DdSdk';
|
|
12
12
|
import { DatadogBuffer } from './DatadogBuffer';
|
|
13
13
|
const DEFAULT_BUFFER_SIZE = 100;
|
|
14
14
|
export class BoundedBuffer extends DatadogBuffer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BoundedBuffer.ts"],"names":["InternalLog","SdkVerbosity","getErrorStackTrace","DdSdk","DatadogBuffer","DEFAULT_BUFFER_SIZE","BoundedBuffer","constructor","bufferSize","callback","buffer","length","push","_type","addTelemetryEvent","Promise","resolve","undefined","bufferId","generateRandomBufferId","returnedBufferId","idTable","error","console","warn","Math","random","withBufferId","bufferIndex","item","callbackId","log","WARN","drainTelemetry","tries","hash","toString","slice","Error","message","stack","kind","telemetryBuffer","occurences","Object","values","forEach","telemetryError"],"mappings":";;AAAA;AACA;AACA;AACA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xBC,OADwB,EAExBC,KAFwB,EAGxBC,IAHwB,KAIvB;AACD,UAAI,KAAKC,eAAL,CAAqBD,IAArB,CAAJ,EAAgC;AAC5B,aAAKC,eAAL,CAAqBD,IAArB,EAA2BE,UAA3B;AACH,OAFD,MAEO;AACH,aAAKD,eAAL,CAAqBD,IAArB,IAA6B;AACzBF,UAAAA,OADyB;AAEzBC,UAAAA,KAFyB;AAGzBC,UAAAA,IAHyB;AAIzBE,UAAAA,UAAU,EAAE;AAJa,SAA7B;AAMH;AACJ,KApJqD;;AAAA,4CAsJ7B,MAAM;AAC3BC,MAAAA,MAAM,CAACC,MAAP,CAAc,KAAKH,eAAnB,EAAoCI,OAApC,CACI,CAAC;AAAEP,QAAAA,OAAF;AAAWC,QAAAA,KAAX;AAAkBC,QAAAA,IAAlB;AAAwBE,QAAAA;AAAxB,OAAD,KAA0C;AACtCxC,QAAAA,KAAK,CAAC4C,cAAN,CACK,GAAER,OAAQ,aAAYI,UAAW,SADtC,EAEIH,KAFJ,EAGIC,IAHJ;AAKH,OAPL;AASH,KAhKqD;;AAElD,SAAKjC,UAAL,GAAkBA,UAAlB;AACH;;AAhB4C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InternalLog } from '../../../InternalLog';\nimport { SdkVerbosity } from '../../../SdkVerbosity';\nimport { getErrorStackTrace } from '../../../errorUtils';\nimport { DdSdk } from '../../../foundation';\n\nimport { DatadogBuffer } from './DatadogBuffer';\n\nconst DEFAULT_BUFFER_SIZE = 100;\n\ntype VoidCallback = {\n callback: () => Promise<void>;\n _type: 'VOID';\n};\n\ntype CallbackReturningId = {\n callback: () => Promise<string>;\n returnedBufferId: string;\n _type: 'RETURNING_ID';\n};\n\ntype CallbackWithId = {\n callback: (id: string) => Promise<void>;\n withBufferId: string;\n _type: 'WITH_ID';\n};\n\ntype BufferItem = VoidCallback | CallbackReturningId | CallbackWithId;\n\nexport class BoundedBuffer extends DatadogBuffer {\n private bufferSize: number;\n private buffer: BufferItem[] = [];\n private idTable: { [bufferId: string]: string | null } = {};\n private telemetryBuffer: {\n [kind: string]: {\n message: string;\n stack: string;\n kind: string;\n occurences: number;\n };\n } = {};\n\n constructor(bufferSize: number = DEFAULT_BUFFER_SIZE) {\n super();\n this.bufferSize = bufferSize;\n }\n\n addCallback = (callback: () => Promise<void>) => {\n if (this.buffer.length < this.bufferSize) {\n this.buffer.push({ callback, _type: 'VOID' });\n } else {\n this.addTelemetryEvent('Buffer overflow', '', 'BufferOverflow');\n }\n\n return new Promise<void>(resolve => resolve(undefined));\n };\n\n addCallbackReturningId = (callback: () => Promise<string>) => {\n try {\n const bufferId = this.generateRandomBufferId();\n if (this.buffer.length < this.bufferSize) {\n this.buffer.push({\n callback,\n returnedBufferId: bufferId,\n _type: 'RETURNING_ID'\n });\n this.idTable[bufferId] = null;\n } else {\n this.addTelemetryEvent('Buffer overflow', '', 'BufferOverflow');\n }\n\n return new Promise<string>(resolve => resolve(bufferId));\n } catch (error) {\n this.addTelemetryEvent(\n 'Could not generate enough random numbers',\n getErrorStackTrace(error),\n 'RandomIdGenerationError'\n );\n // Not using InternalLog here as it is not yet instantiated\n console.warn(\n `[Datadog] Could not generate enough random numbers for RUM buffer. Please check that Math.random is not overwritten. Math.random returns: ${Math.random()}`\n );\n\n return new Promise<string>(resolve => resolve(''));\n }\n };\n\n addCallbackWithId = (\n callback: (id: string) => Promise<void>,\n bufferId: string\n ) => {\n if (this.idTable[bufferId] !== undefined) {\n this.buffer.push({\n callback,\n withBufferId: bufferId,\n _type: 'WITH_ID'\n });\n } else {\n this.addTelemetryEvent('Buffer overflow', '', 'BufferOverflow');\n }\n\n return new Promise<void>(resolve => resolve(undefined));\n };\n\n drain = async () => {\n for (\n let bufferIndex = 0;\n bufferIndex < this.buffer.length;\n bufferIndex++\n ) {\n try {\n const item = this.buffer[bufferIndex];\n if (item._type === 'RETURNING_ID') {\n try {\n // Here we want to await the callback result to make sure that it has registered the id returned\n // by the callback before executing the callback needing this id.\n // eslint-disable-next-line no-await-in-loop\n const callbackId = await item.callback();\n this.idTable[item.returnedBufferId] = callbackId;\n } catch (error) {\n InternalLog.log(\n `Error running a callback returning an id in Buffer: ${error}`,\n SdkVerbosity.WARN\n );\n }\n continue;\n }\n\n if (item._type === 'WITH_ID') {\n const callbackId = this.idTable[item.withBufferId];\n // callbackId can be `null` if the callback supposed to return the id errored. In this case, let's ignore the next callback.\n if (callbackId !== null && callbackId !== undefined) {\n item.callback(callbackId);\n delete this.idTable[item.withBufferId];\n } else {\n InternalLog.log(\n `1 event was not sent as callback id was ${\n callbackId === null\n ? 'not set'\n : 'already unset'\n }`,\n SdkVerbosity.WARN\n );\n }\n continue;\n }\n\n item.callback();\n } catch (error) {\n InternalLog.log(\n `Error while draining Datadog Buffer: ${error}`,\n SdkVerbosity.WARN\n );\n }\n }\n\n this.buffer = [];\n\n this.drainTelemetry();\n };\n\n private generateRandomBufferId = (): string => {\n let tries = 0;\n while (tries < 20) {\n const hash = Math.random().toString(36).slice(2);\n if (this.idTable[hash] !== undefined) {\n tries++;\n } else {\n return hash;\n }\n }\n\n throw new Error('Could not generate random Buffer id');\n };\n\n private addTelemetryEvent = (\n message: string,\n stack: string,\n kind: string\n ) => {\n if (this.telemetryBuffer[kind]) {\n this.telemetryBuffer[kind].occurences++;\n } else {\n this.telemetryBuffer[kind] = {\n message,\n stack,\n kind,\n occurences: 1\n };\n }\n };\n\n private drainTelemetry = () => {\n Object.values(this.telemetryBuffer).forEach(\n ({ message, stack, kind, occurences }) => {\n DdSdk.telemetryError(\n `${message} happened ${occurences} times.`,\n stack,\n kind\n );\n }\n );\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["BoundedBuffer.ts"],"names":["InternalLog","SdkVerbosity","getErrorStackTrace","DdSdk","DatadogBuffer","DEFAULT_BUFFER_SIZE","BoundedBuffer","constructor","bufferSize","callback","buffer","length","push","_type","addTelemetryEvent","Promise","resolve","undefined","bufferId","generateRandomBufferId","returnedBufferId","idTable","error","console","warn","Math","random","withBufferId","bufferIndex","item","callbackId","log","WARN","drainTelemetry","tries","hash","toString","slice","Error","message","stack","kind","telemetryBuffer","occurences","Object","values","forEach","telemetryError"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,WAAT,QAA4B,sBAA5B;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SAASC,kBAAT,QAAmC,qBAAnC;AACA,SAASC,KAAT,QAAsB,oBAAtB;AAEA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,MAAMC,mBAAmB,GAAG,GAA5B;AAqBA,OAAO,MAAMC,aAAN,SAA4BF,aAA5B,CAA0C;AAa7CG,EAAAA,WAAW,CAACC,UAAkB,GAAGH,mBAAtB,EAA2C;AAClD;;AADkD;;AAAA,oCAXvB,EAWuB;;AAAA,qCAVG,EAUH;;AAAA,6CAFlD,EAEkD;;AAAA,yCAKvCI,QAAD,IAAmC;AAC7C,UAAI,KAAKC,MAAL,CAAYC,MAAZ,GAAqB,KAAKH,UAA9B,EAA0C;AACtC,aAAKE,MAAL,CAAYE,IAAZ,CAAiB;AAAEH,UAAAA,QAAF;AAAYI,UAAAA,KAAK,EAAE;AAAnB,SAAjB;AACH,OAFD,MAEO;AACH,aAAKC,iBAAL,CAAuB,iBAAvB,EAA0C,EAA1C,EAA8C,gBAA9C;AACH;;AAED,aAAO,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OAAO,CAACC,SAAD,CAApC,CAAP;AACH,KAbqD;;AAAA,oDAe5BR,QAAD,IAAqC;AAC1D,UAAI;AACA,cAAMS,QAAQ,GAAG,KAAKC,sBAAL,EAAjB;;AACA,YAAI,KAAKT,MAAL,CAAYC,MAAZ,GAAqB,KAAKH,UAA9B,EAA0C;AACtC,eAAKE,MAAL,CAAYE,IAAZ,CAAiB;AACbH,YAAAA,QADa;AAEbW,YAAAA,gB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C,CAAjC,CAAb;;AACA,YAAI,KAAKhB,OAAL,CAAac,IAAb,MAAuBlB,SAA3B,EAAsC;AAClCiB,UAAAA,KAAK;AACR,SAFD,MAEO;AACH,iBAAOC,IAAP;AACH;AACJ;;AAED,YAAM,IAAIG,KAAJ,CAAU,qCAAV,CAAN;AACH,KAnIqD;;AAAA,+CAqI1B,CACxBC,OADwB,EAExBC,KAFwB,EAGxBC,IAHwB,KAIvB;AACD,UAAI,KAAKC,eAAL,CAAqBD,IAArB,CAAJ,EAAgC;AAC5B,aAAKC,eAAL,CAAqBD,IAArB,EAA2BE,UAA3B;AACH,OAFD,MAEO;AACH,aAAKD,eAAL,CAAqBD,IAArB,IAA6B;AACzBF,UAAAA,OADyB;AAEzBC,UAAAA,KAFyB;AAGzBC,UAAAA,IAHyB;AAIzBE,UAAAA,UAAU,EAAE;AAJa,SAA7B;AAMH;AACJ,KApJqD;;AAAA,4CAsJ7B,MAAM;AAC3BC,MAAAA,MAAM,CAACC,MAAP,CAAc,KAAKH,eAAnB,EAAoCI,OAApC,CACI,CAAC;AAAEP,QAAAA,OAAF;AAAWC,QAAAA,KAAX;AAAkBC,QAAAA,IAAlB;AAAwBE,QAAAA;AAAxB,OAAD,KAA0C;AACtCxC,QAAAA,KAAK,CAAC4C,cAAN,CACK,GAAER,OAAQ,aAAYI,UAAW,SADtC,EAEIH,KAFJ,EAGIC,IAHJ;AAKH,OAPL;AASH,KAhKqD;;AAElD,SAAKjC,UAAL,GAAkBA,UAAlB;AACH;;AAhB4C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InternalLog } from '../../../InternalLog';\nimport { SdkVerbosity } from '../../../SdkVerbosity';\nimport { getErrorStackTrace } from '../../../errorUtils';\nimport { DdSdk } from '../../../sdk/DdSdk';\n\nimport { DatadogBuffer } from './DatadogBuffer';\n\nconst DEFAULT_BUFFER_SIZE = 100;\n\ntype VoidCallback = {\n callback: () => Promise<void>;\n _type: 'VOID';\n};\n\ntype CallbackReturningId = {\n callback: () => Promise<string>;\n returnedBufferId: string;\n _type: 'RETURNING_ID';\n};\n\ntype CallbackWithId = {\n callback: (id: string) => Promise<void>;\n withBufferId: string;\n _type: 'WITH_ID';\n};\n\ntype BufferItem = VoidCallback | CallbackReturningId | CallbackWithId;\n\nexport class BoundedBuffer extends DatadogBuffer {\n private bufferSize: number;\n private buffer: BufferItem[] = [];\n private idTable: { [bufferId: string]: string | null } = {};\n private telemetryBuffer: {\n [kind: string]: {\n message: string;\n stack: string;\n kind: string;\n occurences: number;\n };\n } = {};\n\n constructor(bufferSize: number = DEFAULT_BUFFER_SIZE) {\n super();\n this.bufferSize = bufferSize;\n }\n\n addCallback = (callback: () => Promise<void>) => {\n if (this.buffer.length < this.bufferSize) {\n this.buffer.push({ callback, _type: 'VOID' });\n } else {\n this.addTelemetryEvent('Buffer overflow', '', 'BufferOverflow');\n }\n\n return new Promise<void>(resolve => resolve(undefined));\n };\n\n addCallbackReturningId = (callback: () => Promise<string>) => {\n try {\n const bufferId = this.generateRandomBufferId();\n if (this.buffer.length < this.bufferSize) {\n this.buffer.push({\n callback,\n returnedBufferId: bufferId,\n _type: 'RETURNING_ID'\n });\n this.idTable[bufferId] = null;\n } else {\n this.addTelemetryEvent('Buffer overflow', '', 'BufferOverflow');\n }\n\n return new Promise<string>(resolve => resolve(bufferId));\n } catch (error) {\n this.addTelemetryEvent(\n 'Could not generate enough random numbers',\n getErrorStackTrace(error),\n 'RandomIdGenerationError'\n );\n // Not using InternalLog here as it is not yet instantiated\n console.warn(\n `[Datadog] Could not generate enough random numbers for RUM buffer. Please check that Math.random is not overwritten. Math.random returns: ${Math.random()}`\n );\n\n return new Promise<string>(resolve => resolve(''));\n }\n };\n\n addCallbackWithId = (\n callback: (id: string) => Promise<void>,\n bufferId: string\n ) => {\n if (this.idTable[bufferId] !== undefined) {\n this.buffer.push({\n callback,\n withBufferId: bufferId,\n _type: 'WITH_ID'\n });\n } else {\n this.addTelemetryEvent('Buffer overflow', '', 'BufferOverflow');\n }\n\n return new Promise<void>(resolve => resolve(undefined));\n };\n\n drain = async () => {\n for (\n let bufferIndex = 0;\n bufferIndex < this.buffer.length;\n bufferIndex++\n ) {\n try {\n const item = this.buffer[bufferIndex];\n if (item._type === 'RETURNING_ID') {\n try {\n // Here we want to await the callback result to make sure that it has registered the id returned\n // by the callback before executing the callback needing this id.\n // eslint-disable-next-line no-await-in-loop\n const callbackId = await item.callback();\n this.idTable[item.returnedBufferId] = callbackId;\n } catch (error) {\n InternalLog.log(\n `Error running a callback returning an id in Buffer: ${error}`,\n SdkVerbosity.WARN\n );\n }\n continue;\n }\n\n if (item._type === 'WITH_ID') {\n const callbackId = this.idTable[item.withBufferId];\n // callbackId can be `null` if the callback supposed to return the id errored. In this case, let's ignore the next callback.\n if (callbackId !== null && callbackId !== undefined) {\n item.callback(callbackId);\n delete this.idTable[item.withBufferId];\n } else {\n InternalLog.log(\n `1 event was not sent as callback id was ${\n callbackId === null\n ? 'not set'\n : 'already unset'\n }`,\n SdkVerbosity.WARN\n );\n }\n continue;\n }\n\n item.callback();\n } catch (error) {\n InternalLog.log(\n `Error while draining Datadog Buffer: ${error}`,\n SdkVerbosity.WARN\n );\n }\n }\n\n this.buffer = [];\n\n this.drainTelemetry();\n };\n\n private generateRandomBufferId = (): string => {\n let tries = 0;\n while (tries < 20) {\n const hash = Math.random().toString(36).slice(2);\n if (this.idTable[hash] !== undefined) {\n tries++;\n } else {\n return hash;\n }\n }\n\n throw new Error('Could not generate random Buffer id');\n };\n\n private addTelemetryEvent = (\n message: string,\n stack: string,\n kind: string\n ) => {\n if (this.telemetryBuffer[kind]) {\n this.telemetryBuffer[kind].occurences++;\n } else {\n this.telemetryBuffer[kind] = {\n message,\n stack,\n kind,\n occurences: 1\n };\n }\n };\n\n private drainTelemetry = () => {\n Object.values(this.telemetryBuffer).forEach(\n ({ message, stack, kind, occurences }) => {\n DdSdk.telemetryError(\n `${message} happened ${occurences} times.`,\n stack,\n kind\n );\n }\n );\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
import { NativeModules } from 'react-native';
|
|
7
|
+
const DdSdk = NativeModules.DdSdk;
|
|
8
|
+
export { DdSdk };
|
|
9
|
+
//# sourceMappingURL=DdSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DdSdk.ts"],"names":["NativeModules","DdSdk"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AAIA,MAAMC,KAAsB,GAAGD,aAAa,CAACC,KAA7C;AAEA,SAASA,KAAT","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';\n\nimport type { DdNativeSdkType } from '../nativeModulesTypes';\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\n\nexport { DdSdk };\n"]}
|
|
@@ -7,7 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
*/
|
|
8
8
|
import { InternalLog } from '../../InternalLog';
|
|
9
9
|
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
10
|
-
import { DdSdk } from '../../
|
|
10
|
+
import { DdSdk } from '../../sdk/DdSdk';
|
|
11
11
|
import { AttributesSingleton } from '../AttributesSingleton/AttributesSingleton';
|
|
12
12
|
import { UserInfoSingleton } from '../UserInfoSingleton/UserInfoSingleton';
|
|
13
13
|
import { deepClone } from './utils/deepClone';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["EventMapper.ts"],"names":["InternalLog","SdkVerbosity","DdSdk","AttributesSingleton","UserInfoSingleton","deepClone","EventMapper","constructor","eventMapper","formatRawEventForMapper","formatMapperEventForNative","formatRawEventForNative","rawEvent","userInfo","getInstance","getUserInfo","attributes","getAttributes","initialEvent","backupEvent","mappedEvent","error","log","JSON","stringify","WARN","telemetryDebug"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,WAAT,QAA4B,mBAA5B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,KAAT,QAAsB,
|
|
1
|
+
{"version":3,"sources":["EventMapper.ts"],"names":["InternalLog","SdkVerbosity","DdSdk","AttributesSingleton","UserInfoSingleton","deepClone","EventMapper","constructor","eventMapper","formatRawEventForMapper","formatMapperEventForNative","formatRawEventForNative","rawEvent","userInfo","getInstance","getUserInfo","attributes","getAttributes","initialEvent","backupEvent","mappedEvent","error","log","JSON","stringify","WARN","telemetryDebug"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,WAAT,QAA4B,mBAA5B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,mBAAT,QAAoC,4CAApC;AAEA,SAASC,iBAAT,QAAkC,wCAAlC;AAGA,SAASC,SAAT,QAA0B,mBAA1B;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAN,CAAsD;AAYzDC,EAAAA,WAAW,CACPC,WADO,EAEPC,uBAFO,EAMPC,0BANO,EAUPC,uBAVO,EAWT;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,8CAOyBC,QAAD,IAA4C;AAClE,UAAI,CAAC,KAAKJ,WAAV,EAAuB;AACnB,eAAO,KAAKG,uBAAL,CAA6BC,QAA7B,CAAP;AACH,OAHiE,CAKlE;;;AACA,YAAMC,QAAQ,GAAGT,iBAAiB,CAACU,WAAlB,GAAgCC,WAAhC,EAAjB;AACA,YAAMC,UAAU,GAAGb,mBAAmB,CAACW,WAApB,GAAkCG,aAAlC,EAAnB;AACA,YAAMC,YAAY,GAAG,KAAKT,uBAAL,CAA6BG,QAA7B,EAAuC;AACxDC,QAAAA,QADwD;AAExDG,QAAAA;AAFwD,OAAvC,CAArB,CARkE,CAalE;;AACA,YAAMG,WAAW,GAAGd,SAAS,CAACa,YAAD,CAA7B;;AACA,UAAI;AACA,cAAME,WAAW,GAAG,KAAKZ,WAAL,CAAiBU,YAAjB,CAApB;;AACA,YAAI,CAACE,WAAL,EAAkB;AACd,iBAAO,IAAP;AACH;;AACD,eAAO,KAAKV,0BAAL,CAAgCU,WAAhC,EAA6CD,WAA7C,CAAP;AACH,OAND,CAME,OAAOE,KAAP,EAAc;AACZrB,QAAAA,WAAW,CAACsB,GAAZ,CACK,yCAAwCC,IAAI,CAACC,SAAL,CACrCL,WADqC,CAEvC,KAAIE,KAAM,EAHhB,EAIIpB,YAAY,CAACwB,IAJjB;AAMAvB,QAAAA,KAAK,CAACwB,cAAN,CAAqB,sCAArB;AACA,eAAO,KAAKhB,0BAAL,CAAgCS,WAAhC,EAA6CA,WAA7C,CAAP;AACH;AACJ,KAtCC;;AACE,SAAKX,WAAL,GAAmBA,WAAnB;AACA,SAAKC,uBAAL,GAA+BA,uBAA/B;AACA,SAAKC,0BAAL,GAAkCA,0BAAlC;AACA,SAAKC,uBAAL,GAA+BA,uBAA/B;AACH;;AA5BwD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InternalLog } from '../../InternalLog';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport { DdSdk } from '../../sdk/DdSdk';\nimport { AttributesSingleton } from '../AttributesSingleton/AttributesSingleton';\nimport type { Attributes } from '../AttributesSingleton/types';\nimport { UserInfoSingleton } from '../UserInfoSingleton/UserInfoSingleton';\nimport type { UserInfo } from '../UserInfoSingleton/types';\n\nimport { deepClone } from './utils/deepClone';\n\nexport type AdditionalEventDataForMapper = {\n userInfo: UserInfo;\n attributes: Attributes;\n};\n\n/**\n * Generic class for applying event mappers.\n *\n * Calls params in this order: formatRawEventForMapper, eventMapper, formatMapperEventForNative.\n *\n * @param eventMapper the user-registered event mapper\n * @param formatRawEventForMapper formatter that gets the raw event (from javascript call) and returns the input given to the mapper\n * @param formatMapperEventForNative formatter that gets the ouput of the mapper, and returns the input given to the native SDKs\n * @param formatRawEventForNative called when no event mapper is registered\n */\nexport class EventMapper<RawEvent, MapperEvent, NativeEvent> {\n private eventMapper?: (event: MapperEvent) => MapperEvent | null;\n private formatRawEventForMapper: (\n event: RawEvent,\n additionalData: AdditionalEventDataForMapper\n ) => MapperEvent;\n private formatMapperEventForNative: (\n event: MapperEvent,\n originalEvent: MapperEvent\n ) => NativeEvent;\n private formatRawEventForNative: (event: RawEvent) => NativeEvent;\n\n constructor(\n eventMapper: ((event: MapperEvent) => MapperEvent | null) | undefined,\n formatRawEventForMapper: (\n event: RawEvent,\n additionalData: AdditionalEventDataForMapper\n ) => MapperEvent,\n formatMapperEventForNative: (\n event: MapperEvent,\n originalEvent: MapperEvent\n ) => NativeEvent,\n formatRawEventForNative: (event: RawEvent) => NativeEvent\n ) {\n this.eventMapper = eventMapper;\n this.formatRawEventForMapper = formatRawEventForMapper;\n this.formatMapperEventForNative = formatMapperEventForNative;\n this.formatRawEventForNative = formatRawEventForNative;\n }\n\n public applyEventMapper = (rawEvent: RawEvent): NativeEvent | null => {\n if (!this.eventMapper) {\n return this.formatRawEventForNative(rawEvent);\n }\n\n // formatting\n const userInfo = UserInfoSingleton.getInstance().getUserInfo();\n const attributes = AttributesSingleton.getInstance().getAttributes();\n const initialEvent = this.formatRawEventForMapper(rawEvent, {\n userInfo,\n attributes\n });\n\n // mapper\n const backupEvent = deepClone(initialEvent);\n try {\n const mappedEvent = this.eventMapper(initialEvent);\n if (!mappedEvent) {\n return null;\n }\n return this.formatMapperEventForNative(mappedEvent, backupEvent);\n } catch (error) {\n InternalLog.log(\n `The event mapper crashed when mapping ${JSON.stringify(\n backupEvent\n )}: ${error}`,\n SdkVerbosity.WARN\n );\n DdSdk.telemetryDebug('Error while running the event mapper');\n return this.formatMapperEventForNative(backupEvent, backupEvent);\n }\n };\n}\n"]}
|
|
@@ -6,11 +6,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
6
6
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
7
|
*/
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { bufferNativeCallReturningId, bufferNativeCallWithId } from './sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
9
|
+
import { InternalLog } from '../InternalLog';
|
|
10
|
+
import { SdkVerbosity } from '../SdkVerbosity';
|
|
11
|
+
import { TimeProvider } from '../TimeProvider';
|
|
12
|
+
import { bufferNativeCallReturningId, bufferNativeCallWithId } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
14
13
|
const timeProvider = new TimeProvider();
|
|
15
14
|
|
|
16
15
|
class DdTraceWrapper {
|
|
@@ -19,19 +18,18 @@ class DdTraceWrapper {
|
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
startSpan(operation, context = {}, timestampMs = timeProvider.now()) {
|
|
22
|
-
|
|
23
|
-
InternalLog.log(
|
|
21
|
+
const spanId = bufferNativeCallReturningId(() => this.nativeTrace.startSpan(operation, context, timestampMs));
|
|
22
|
+
InternalLog.log(`Starting span “${operation}” #${spanId}`, SdkVerbosity.DEBUG);
|
|
24
23
|
return spanId;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
finishSpan(spanId, context = {}, timestampMs = timeProvider.now()) {
|
|
28
|
-
InternalLog.log(
|
|
27
|
+
InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);
|
|
29
28
|
return bufferNativeCallWithId(id => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const DdSdk = NativeModules.DdSdk;
|
|
35
33
|
const DdTrace = new DdTraceWrapper();
|
|
36
|
-
export {
|
|
37
|
-
//# sourceMappingURL=
|
|
34
|
+
export { DdTrace };
|
|
35
|
+
//# sourceMappingURL=DdTrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DdTrace.ts"],"names":["NativeModules","InternalLog","SdkVerbosity","TimeProvider","bufferNativeCallReturningId","bufferNativeCallWithId","timeProvider","DdTraceWrapper","DdTrace","startSpan","operation","context","timestampMs","now","spanId","nativeTrace","log","DEBUG","finishSpan","id"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AAEA,SAASC,WAAT,QAA4B,gBAA5B;AACA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA,SACIC,2BADJ,EAEIC,sBAFJ,QAGO,gDAHP;AAMA,MAAMC,YAAY,GAAG,IAAIH,YAAJ,EAArB;;AAEA,MAAMI,cAAN,CAA4C;AAAA;AAAA,yCACCP,aAAa,CAACQ,OADf;AAAA;;AAGxCC,EAAAA,SAAS,CACLC,SADK,EAELC,OAAe,GAAG,EAFb,EAGLC,WAAmB,GAAGN,YAAY,CAACO,GAAb,EAHjB,EAIU;AACf,UAAMC,MAAM,GAAGV,2BAA2B,CAAC,MACvC,KAAKW,WAAL,CAAiBN,SAAjB,CAA2BC,SAA3B,EAAsCC,OAAtC,EAA+CC,WAA/C,CADsC,CAA1C;AAGAX,IAAAA,WAAW,CAACe,GAAZ,CACK,kBAAiBN,SAAU,MAAKI,MAAO,EAD5C,EAEIZ,YAAY,CAACe,KAFjB;AAIA,WAAOH,MAAP;AACH;;AAEDI,EAAAA,UAAU,CACNJ,MADM,EAENH,OAAe,GAAG,EAFZ,EAGNC,WAAmB,GAAGN,YAAY,CAACO,GAAb,EAHhB,EAIO;AACbZ,IAAAA,WAAW,CAACe,GAAZ,CAAiB,mBAAkBF,MAAO,EAA1C,EAA6CZ,YAAY,CAACe,KAA1D;AACA,WAAOZ,sBAAsB,CACzBc,EAAE,IAAI,KAAKJ,WAAL,CAAiBG,UAAjB,CAA4BC,EAA5B,EAAgCR,OAAhC,EAAyCC,WAAzC,CADmB,EAEzBE,MAFyB,CAA7B;AAIH;;AA5BuC;;AA+B5C,MAAMN,OAAoB,GAAG,IAAID,cAAJ,EAA7B;AAEA,SAASC,OAAT","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';\n\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport { TimeProvider } from '../TimeProvider';\nimport type { DdNativeTraceType } from '../nativeModulesTypes';\nimport {\n bufferNativeCallReturningId,\n bufferNativeCallWithId\n} from '../sdk/DatadogProvider/Buffer/bufferNativeCall';\nimport type { DdTraceType } from '../types';\n\nconst timeProvider = new TimeProvider();\n\nclass DdTraceWrapper implements DdTraceType {\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(\n operation: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<string> {\n const spanId = bufferNativeCallReturningId(() =>\n this.nativeTrace.startSpan(operation, context, timestampMs)\n );\n InternalLog.log(\n `Starting span “${operation}” #${spanId}`,\n SdkVerbosity.DEBUG\n );\n return spanId;\n }\n\n finishSpan(\n spanId: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId(\n id => this.nativeTrace.finishSpan(id, context, timestampMs),\n spanId\n );\n }\n}\n\nconst DdTrace: DdTraceType = new DdTraceWrapper();\n\nexport { DdTrace };\n"]}
|
package/lib/module/types.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* A configuration object to initialize Datadog's features.
|
|
9
9
|
*/
|
|
10
10
|
export class DdSdkConfiguration {
|
|
11
|
-
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate, vitalsUpdateFrequency, configurationForTelemetry) {
|
|
11
|
+
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate, vitalsUpdateFrequency, trackFrustrations, configurationForTelemetry) {
|
|
12
12
|
this.clientToken = clientToken;
|
|
13
13
|
this.env = env;
|
|
14
14
|
this.applicationId = applicationId;
|
|
@@ -21,6 +21,7 @@ export class DdSdkConfiguration {
|
|
|
21
21
|
this.additionalConfig = additionalConfig;
|
|
22
22
|
this.telemetrySampleRate = telemetrySampleRate;
|
|
23
23
|
this.vitalsUpdateFrequency = vitalsUpdateFrequency;
|
|
24
|
+
this.trackFrustrations = trackFrustrations;
|
|
24
25
|
this.configurationForTelemetry = configurationForTelemetry;
|
|
25
26
|
}
|
|
26
27
|
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,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,
|
|
1
|
+
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","trackFrustrations","configurationForTelemetry"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,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,iBAbF,EAcEC,yBAdF,EAoBT;AAAA,SAnBWb,WAmBX,GAnBWA,WAmBX;AAAA,SAlBWC,GAkBX,GAlBWA,GAkBX;AAAA,SAjBWC,aAiBX,GAjBWA,aAiBX;AAAA,SAhBWC,wBAgBX,GAhBWA,wBAgBX;AAAA,SAfWC,yBAeX,GAfWA,yBAeX;AAAA,SAdWC,mBAcX,GAdWA,mBAcX;AAAA,SAbWC,UAaX,GAbWA,UAaX;AAAA,SAZWC,IAYX,GAZWA,IAYX;AAAA,SAXWC,eAWX,GAXWA,eAWX;AAAA,SAVWC,gBAUX,GAVWA,gBAUX;AAAA,SATWC,mBASX,GATWA,mBASX;AAAA,SARWC,qBAQX,GARWA,qBAQX;AAAA,SAPWC,iBAOX,GAPWA,iBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AArBwB;AAwBhC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\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 trackFrustrations: boolean,\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 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"]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.5.1';\n"]}
|
|
@@ -126,6 +126,10 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
126
126
|
* Sets the preferred frequency for collecting mobile vitals.
|
|
127
127
|
*/
|
|
128
128
|
vitalsUpdateFrequency: VitalsUpdateFrequency;
|
|
129
|
+
/**
|
|
130
|
+
* Enables tracking of frustration signals (error taps). Defaults to `true`.
|
|
131
|
+
*/
|
|
132
|
+
trackFrustrations: boolean;
|
|
129
133
|
logEventMapper: LogEventMapper | null;
|
|
130
134
|
errorEventMapper: ErrorEventMapper | null;
|
|
131
135
|
resourceEventMapper: ResourceEventMapper | null;
|
|
@@ -191,6 +195,7 @@ export declare type PartialInitializationConfiguration = {
|
|
|
191
195
|
readonly nativeCrashReportEnabled?: boolean;
|
|
192
196
|
readonly telemetrySampleRate?: number;
|
|
193
197
|
readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
198
|
+
readonly trackFrustrations?: boolean;
|
|
194
199
|
};
|
|
195
200
|
export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
|
|
196
201
|
export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
|
|
@@ -4,9 +4,9 @@ import { InternalLog } from './InternalLog';
|
|
|
4
4
|
import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
|
|
5
5
|
import { SdkVerbosity } from './SdkVerbosity';
|
|
6
6
|
import { TrackingConsent } from './TrackingConsent';
|
|
7
|
-
import { DdTrace } from './foundation';
|
|
8
7
|
import { DdLogs } from './logs/DdLogs';
|
|
9
8
|
import { DdRum } from './rum/DdRum';
|
|
10
9
|
import { RumActionType, ErrorSource, PropagatorType } from './rum/types';
|
|
11
10
|
import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
|
|
11
|
+
import { DdTrace } from './trace/DdTrace';
|
|
12
12
|
export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity, VitalsUpdateFrequency, PropagatorType };
|
|
@@ -48,6 +48,11 @@ export declare type DdNativeSdkType = {
|
|
|
48
48
|
* @param kind error kind
|
|
49
49
|
*/
|
|
50
50
|
telemetryError(message: string, stack: string, kind: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Send webview telemetry logs
|
|
53
|
+
* @param message event description
|
|
54
|
+
*/
|
|
55
|
+
consumeWebviewEvent(message: string): Promise<void>;
|
|
51
56
|
};
|
|
52
57
|
/**
|
|
53
58
|
* The entry point to use Datadog's Logs feature.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropagatorType } from '../../../types';
|
|
2
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
2
3
|
import type { Hostname } from './firstPartyHosts';
|
|
3
|
-
import type { RegexMap } from './interfaces/RequestProxy';
|
|
4
4
|
export declare type DdRumResourceTracingAttributes = {
|
|
5
5
|
tracingStrategy: 'KEEP';
|
|
6
6
|
traceId: TraceId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FirstPartyHost, PropagatorType } from '../../../types';
|
|
2
|
-
import type { RegexMap } from '
|
|
2
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
3
3
|
export declare type Hostname = {
|
|
4
4
|
_type: 'Hostname';
|
|
5
5
|
} & string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RUMResource } from '../../
|
|
1
|
+
import type { RUMResource } from '../../interfaces/RumResource';
|
|
2
2
|
declare type ResourceMapper = (resource: RUMResource) => RUMResource | null;
|
|
3
3
|
export declare class ResourceReporter {
|
|
4
4
|
private mappers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RequestProxyOptions } from '../
|
|
2
|
-
import { RequestProxy } from '../
|
|
1
|
+
import type { RequestProxyOptions } from '../interfaces/RequestProxy';
|
|
2
|
+
import { RequestProxy } from '../interfaces/RequestProxy';
|
|
3
3
|
import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
|
|
4
4
|
interface XHRProxyProviders {
|
|
5
5
|
xhrType: typeof XMLHttpRequest;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResourceKind } from '../../../../types';
|
|
2
|
-
import type { DdRumResourceTracingAttributes } from '
|
|
2
|
+
import type { DdRumResourceTracingAttributes } from '../../distributedTracing/distributedTracing';
|
|
3
3
|
export interface RUMResource {
|
|
4
4
|
key: string;
|
|
5
5
|
request: {
|
|
@@ -14,13 +14,14 @@ export declare class DdSdkConfiguration {
|
|
|
14
14
|
readonly additionalConfig: object;
|
|
15
15
|
readonly telemetrySampleRate: number;
|
|
16
16
|
readonly vitalsUpdateFrequency: string;
|
|
17
|
+
readonly trackFrustrations: boolean;
|
|
17
18
|
readonly configurationForTelemetry: {
|
|
18
19
|
initializationType: string;
|
|
19
20
|
trackErrors: boolean;
|
|
20
21
|
trackInteractions: boolean;
|
|
21
22
|
trackNetworkRequests: boolean;
|
|
22
23
|
};
|
|
23
|
-
constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, configurationForTelemetry: {
|
|
24
|
+
constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, trackFrustrations: boolean, configurationForTelemetry: {
|
|
24
25
|
initializationType: string;
|
|
25
26
|
trackErrors: boolean;
|
|
26
27
|
trackInteractions: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.5.1";
|
package/package.json
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
],
|
|
11
|
-
"author": "Datadog (https://github.com/DataDog)",
|
|
12
|
-
"homepage": "https://github.com/DataDog/dd-sdk-reactnative#readme",
|
|
13
|
-
"repository": "https://github.com/DataDog/dd-sdk-reactnative",
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/DataDog/dd-sdk-reactnative/issues"
|
|
16
|
-
},
|
|
17
|
-
"license": "Apache-2.0",
|
|
18
|
-
"main": "lib/commonjs/index",
|
|
19
|
-
"files": [
|
|
20
|
-
"src",
|
|
21
|
-
"lib",
|
|
22
|
-
"scripts",
|
|
23
|
-
"android/build.gradle",
|
|
24
|
-
"android/detekt.yml",
|
|
25
|
-
"android/gradle.properties",
|
|
26
|
-
"android/src",
|
|
27
|
-
"ios/Sources",
|
|
28
|
-
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/xcsharedata",
|
|
29
|
-
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/*.xcworkspacedata",
|
|
30
|
-
"ios/DdSdkReactNative.xcodeproj/*.pbxproj",
|
|
31
|
-
"jest",
|
|
32
|
-
"DatadogSDKReactNative.podspec",
|
|
33
|
-
"datadog-sourcemaps.gradle"
|
|
34
|
-
],
|
|
35
|
-
"types": "lib/typescript/index.d.ts",
|
|
36
|
-
"react-native": "src/index",
|
|
37
|
-
"source": "src",
|
|
38
|
-
"module": "lib/module/index",
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"test": "jest",
|
|
44
|
-
"lint": "eslint .",
|
|
45
|
-
"prepare": "rm -rf lib && yarn bob build",
|
|
46
|
-
"postinstall": "node scripts/replace-react-require.js # Use node to execute the script for Windows, see https://github.com/DataDog/dd-sdk-reactnative/issues/358"
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"react": ">=16.13.1",
|
|
50
|
-
"react-native": ">=0.63.4 <1.0"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@testing-library/react-native": "7.0.2"
|
|
54
|
-
},
|
|
55
|
-
"jest": {
|
|
56
|
-
"preset": "react-native",
|
|
57
|
-
"modulePathIgnorePatterns": [
|
|
58
|
-
"<rootDir>/lib/"
|
|
2
|
+
"name": "@datadog/mobile-react-native",
|
|
3
|
+
"version": "1.5.1",
|
|
4
|
+
"description": "A client-side React Native module to interact with Datadog",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"datadog",
|
|
7
|
+
"react-native",
|
|
8
|
+
"ios",
|
|
9
|
+
"android"
|
|
59
10
|
],
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
11
|
+
"author": "Datadog (https://github.com/DataDog)",
|
|
12
|
+
"homepage": "https://github.com/DataDog/dd-sdk-reactnative#readme",
|
|
13
|
+
"repository": "https://github.com/DataDog/dd-sdk-reactnative",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/DataDog/dd-sdk-reactnative/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"main": "lib/commonjs/index",
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"lib",
|
|
22
|
+
"scripts",
|
|
23
|
+
"android/build.gradle",
|
|
24
|
+
"android/detekt.yml",
|
|
25
|
+
"android/gradle.properties",
|
|
26
|
+
"android/src",
|
|
27
|
+
"ios/Sources",
|
|
28
|
+
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/xcsharedata",
|
|
29
|
+
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/*.xcworkspacedata",
|
|
30
|
+
"ios/DdSdkReactNative.xcodeproj/*.pbxproj",
|
|
31
|
+
"jest",
|
|
32
|
+
"DatadogSDKReactNative.podspec",
|
|
33
|
+
"datadog-sourcemaps.gradle"
|
|
63
34
|
],
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
"react-native-builder-bob": {
|
|
35
|
+
"types": "lib/typescript/index.d.ts",
|
|
36
|
+
"react-native": "src/index",
|
|
67
37
|
"source": "src",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
38
|
+
"module": "lib/module/index",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"prepare": "rm -rf lib && yarn bob build",
|
|
46
|
+
"postinstall": "node scripts/replace-react-require.js # Use node to execute the script for Windows, see https://github.com/DataDog/dd-sdk-reactnative/issues/358"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": ">=16.13.1",
|
|
50
|
+
"react-native": ">=0.63.4 <1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@testing-library/react-native": "7.0.2"
|
|
54
|
+
},
|
|
55
|
+
"jest": {
|
|
56
|
+
"preset": "react-native",
|
|
57
|
+
"modulePathIgnorePatterns": [
|
|
58
|
+
"<rootDir>/lib/"
|
|
59
|
+
],
|
|
60
|
+
"setupFiles": [
|
|
61
|
+
"./../../node_modules/react-native-gesture-handler/jestSetup.js",
|
|
62
|
+
"./../../jest.setup.js"
|
|
63
|
+
],
|
|
64
|
+
"transformIgnorePatterns": []
|
|
65
|
+
},
|
|
66
|
+
"react-native-builder-bob": {
|
|
67
|
+
"source": "src",
|
|
68
|
+
"output": "lib",
|
|
69
|
+
"targets": [
|
|
70
|
+
"commonjs",
|
|
71
|
+
"module",
|
|
72
|
+
[
|
|
73
|
+
"typescript",
|
|
74
|
+
{
|
|
75
|
+
"tsc": "./../../node_modules/.bin/tsc"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"gitHead": "429c794a983fa4e3a369091f892792d8bc23812b"
|
|
81
81
|
}
|
package/src/DdSdkReactNative.tsx
CHANGED
|
@@ -24,7 +24,6 @@ import { InternalLog } from './InternalLog';
|
|
|
24
24
|
import { ProxyType } from './ProxyConfiguration';
|
|
25
25
|
import { SdkVerbosity } from './SdkVerbosity';
|
|
26
26
|
import type { TrackingConsent } from './TrackingConsent';
|
|
27
|
-
import { DdSdk } from './foundation';
|
|
28
27
|
import { DdLogs } from './logs/DdLogs';
|
|
29
28
|
import { adaptLongTaskThreshold } from './longTasksUtils';
|
|
30
29
|
import { DdRum } from './rum/DdRum';
|
|
@@ -34,6 +33,7 @@ import { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/Dd
|
|
|
34
33
|
import { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';
|
|
35
34
|
import type { Attributes } from './sdk/AttributesSingleton/types';
|
|
36
35
|
import { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
36
|
+
import { DdSdk } from './sdk/DdSdk';
|
|
37
37
|
import { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';
|
|
38
38
|
import type { UserInfo } from './sdk/UserInfoSingleton/types';
|
|
39
39
|
import { DdSdkConfiguration } from './types';
|
|
@@ -118,6 +118,7 @@ export class DdSdkReactNative {
|
|
|
118
118
|
configuration.additionalConfig,
|
|
119
119
|
configuration.telemetrySampleRate,
|
|
120
120
|
configuration.vitalsUpdateFrequency,
|
|
121
|
+
configuration.trackFrustrations,
|
|
121
122
|
{
|
|
122
123
|
initializationType: params.initializationModeForTelemetry,
|
|
123
124
|
trackErrors: configuration.trackErrors,
|
|
@@ -69,7 +69,8 @@ const DEFAULTS = {
|
|
|
69
69
|
logEventMapper: null,
|
|
70
70
|
errorEventMapper: null,
|
|
71
71
|
resourceEventMapper: null,
|
|
72
|
-
actionEventMapper: null
|
|
72
|
+
actionEventMapper: null,
|
|
73
|
+
trackFrustrations: true
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
/**
|
|
@@ -182,6 +183,11 @@ export class DdSdkReactNativeConfiguration {
|
|
|
182
183
|
public vitalsUpdateFrequency: VitalsUpdateFrequency =
|
|
183
184
|
DEFAULTS.vitalsUpdateFrequency;
|
|
184
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Enables tracking of frustration signals (error taps). Defaults to `true`.
|
|
188
|
+
*/
|
|
189
|
+
public trackFrustrations: boolean = DEFAULTS.trackFrustrations;
|
|
190
|
+
|
|
185
191
|
public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;
|
|
186
192
|
|
|
187
193
|
public errorEventMapper: ErrorEventMapper | null =
|
|
@@ -293,6 +299,7 @@ export type PartialInitializationConfiguration = {
|
|
|
293
299
|
readonly nativeCrashReportEnabled?: boolean;
|
|
294
300
|
readonly telemetrySampleRate?: number;
|
|
295
301
|
readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
302
|
+
readonly trackFrustrations?: boolean;
|
|
296
303
|
};
|
|
297
304
|
|
|
298
305
|
const setConfigurationAttribute = <
|
|
@@ -11,7 +11,6 @@ import { DdSdkReactNative } from '../DdSdkReactNative';
|
|
|
11
11
|
import { ProxyType } from '../ProxyConfiguration';
|
|
12
12
|
import { SdkVerbosity } from '../SdkVerbosity';
|
|
13
13
|
import { TrackingConsent } from '../TrackingConsent';
|
|
14
|
-
import { DdSdk } from '../foundation';
|
|
15
14
|
import { DdLogs } from '../logs/DdLogs';
|
|
16
15
|
import { DdRum } from '../rum/DdRum';
|
|
17
16
|
import { DdRumErrorTracking } from '../rum/instrumentation/DdRumErrorTracking';
|
|
@@ -19,6 +18,7 @@ import { DdRumUserInteractionTracking } from '../rum/instrumentation/interaction
|
|
|
19
18
|
import { DdRumResourceTracking } from '../rum/instrumentation/resourceTracking/DdRumResourceTracking';
|
|
20
19
|
import { ErrorSource, PropagatorType, RumActionType } from '../rum/types';
|
|
21
20
|
import { AttributesSingleton } from '../sdk/AttributesSingleton/AttributesSingleton';
|
|
21
|
+
import { DdSdk } from '../sdk/DdSdk';
|
|
22
22
|
import { UserInfoSingleton } from '../sdk/UserInfoSingleton/UserInfoSingleton';
|
|
23
23
|
import type { DdSdkConfiguration } from '../types';
|
|
24
24
|
import { version as sdkVersion } from '../version';
|