@datadog/mobile-react-native 1.3.1 → 1.5.0
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 +155 -92
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +16 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +293 -30
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +5 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +7 -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 +55 -7
- package/ios/Sources/DdSdk.m +4 -0
- package/ios/Sources/DdSdk.swift +19 -2
- package/ios/Sources/DdSdkConfiguration.swift +6 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +44 -0
- package/jest/mock.js +1 -1
- package/lib/commonjs/DdSdkReactNative.js +3 -3
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +34 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -5
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +101 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +136 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +39 -6
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +4 -4
- 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 +15 -24
- 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/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -0
- package/lib/commonjs/rum/types.js +19 -1
- package/lib/commonjs/rum/types.js.map +1 -1
- 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 +4 -4
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +30 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -6
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +93 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +115 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +37 -3
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +4 -4
- 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 +13 -18
- 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/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -0
- package/lib/module/rum/types.js +16 -0
- package/lib/module/rum/types.js.map +1 -1
- 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 +16 -3
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/nativeModulesTypes.d.ts +5 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +45 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +21 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +8 -0
- 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 -7
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +6 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/types.d.ts +17 -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 +9 -4
- package/src/DdSdkReactNativeConfiguration.tsx +44 -4
- package/src/__tests__/DdSdkReactNative.test.tsx +16 -4
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/index.tsx +6 -3
- package/src/nativeModulesTypes.ts +6 -0
- package/src/rum/__tests__/DdRum.test.ts +17 -1
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +10 -7
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +13 -2
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +71 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/firstPartyHosts.test.ts +34 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +131 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +141 -0
- package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts +42 -7
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.ts +6 -6
- 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 +13 -28
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/XHRProxy.test.ts +257 -79
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.ts +8 -1
- package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts +1 -1
- package/src/rum/types.ts +19 -0
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -0
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -1
- package/src/types.tsx +1 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js +0 -83
- 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/domain/interfaces/RequestProxy.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/rum/instrumentation/resourceTracking/domain/distributedTracing.js +0 -71
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.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/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +0 -19
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +0 -6
- package/src/rum/instrumentation/resourceTracking/domain/__tests__/distributedTracing.test.ts +0 -31
- package/src/rum/instrumentation/resourceTracking/domain/__tests__/firstPartyHosts.test.ts +0 -22
- package/src/rum/instrumentation/resourceTracking/domain/distributedTracing.tsx +0 -89
- /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/RumResource.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +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/RumResource.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +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/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
|
@@ -9,7 +9,7 @@ package com.datadog.reactnative
|
|
|
9
9
|
import android.content.pm.PackageInfo
|
|
10
10
|
import android.util.Log
|
|
11
11
|
import android.view.Choreographer
|
|
12
|
-
import com.datadog.android.
|
|
12
|
+
import com.datadog.android.DatadogSite
|
|
13
13
|
import com.datadog.android.core.configuration.BatchSize
|
|
14
14
|
import com.datadog.android.core.configuration.Configuration
|
|
15
15
|
import com.datadog.android.core.configuration.Credentials
|
|
@@ -31,10 +31,12 @@ import com.datadog.tools.unit.GenericAssert.Companion.assertThat
|
|
|
31
31
|
import com.datadog.tools.unit.forge.BaseConfigurator
|
|
32
32
|
import com.datadog.tools.unit.getStaticValue
|
|
33
33
|
import com.datadog.tools.unit.setStaticValue
|
|
34
|
+
import com.datadog.tools.unit.toReadableArray
|
|
34
35
|
import com.datadog.tools.unit.toReadableJavaOnlyMap
|
|
35
36
|
import com.datadog.tools.unit.toReadableMap
|
|
36
37
|
import com.facebook.react.bridge.Promise
|
|
37
38
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
39
|
+
import com.facebook.react.bridge.ReadableMap
|
|
38
40
|
import com.nhaarman.mockitokotlin2.any
|
|
39
41
|
import com.nhaarman.mockitokotlin2.argumentCaptor
|
|
40
42
|
import com.nhaarman.mockitokotlin2.doNothing
|
|
@@ -534,19 +536,19 @@ internal class DdSdkTest {
|
|
|
534
536
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
535
537
|
}
|
|
536
538
|
.hasField("logsConfig") {
|
|
537
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
539
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
538
540
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
539
541
|
}
|
|
540
542
|
.hasField("tracesConfig") {
|
|
541
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
543
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
542
544
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
543
545
|
}
|
|
544
546
|
.hasField("rumConfig") {
|
|
545
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
547
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
546
548
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
547
549
|
}
|
|
548
550
|
.hasField("crashReportConfig") {
|
|
549
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
551
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
550
552
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
551
553
|
}
|
|
552
554
|
.hasFieldEqualTo(
|
|
@@ -591,19 +593,19 @@ internal class DdSdkTest {
|
|
|
591
593
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
592
594
|
}
|
|
593
595
|
.hasField("logsConfig") {
|
|
594
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
596
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
595
597
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
596
598
|
}
|
|
597
599
|
.hasField("tracesConfig") {
|
|
598
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
600
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
599
601
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
600
602
|
}
|
|
601
603
|
.hasField("rumConfig") {
|
|
602
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
604
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
603
605
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
604
606
|
}
|
|
605
607
|
.hasField("crashReportConfig") {
|
|
606
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
608
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1.intakeEndpoint)
|
|
607
609
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
608
610
|
}
|
|
609
611
|
.hasFieldEqualTo(
|
|
@@ -648,19 +650,19 @@ internal class DdSdkTest {
|
|
|
648
650
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
649
651
|
}
|
|
650
652
|
.hasField("logsConfig") {
|
|
651
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
653
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US3.intakeEndpoint)
|
|
652
654
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
653
655
|
}
|
|
654
656
|
.hasField("tracesConfig") {
|
|
655
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
657
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US3.intakeEndpoint)
|
|
656
658
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
657
659
|
}
|
|
658
660
|
.hasField("rumConfig") {
|
|
659
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
661
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US3.intakeEndpoint)
|
|
660
662
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
661
663
|
}
|
|
662
664
|
.hasField("crashReportConfig") {
|
|
663
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
665
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US3.intakeEndpoint)
|
|
664
666
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
665
667
|
}
|
|
666
668
|
.hasFieldEqualTo(
|
|
@@ -705,19 +707,19 @@ internal class DdSdkTest {
|
|
|
705
707
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
706
708
|
}
|
|
707
709
|
.hasField("logsConfig") {
|
|
708
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
710
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US5.intakeEndpoint)
|
|
709
711
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
710
712
|
}
|
|
711
713
|
.hasField("tracesConfig") {
|
|
712
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
714
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US5.intakeEndpoint)
|
|
713
715
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
714
716
|
}
|
|
715
717
|
.hasField("rumConfig") {
|
|
716
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
718
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US5.intakeEndpoint)
|
|
717
719
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
718
720
|
}
|
|
719
721
|
.hasField("crashReportConfig") {
|
|
720
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
722
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US5.intakeEndpoint)
|
|
721
723
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
722
724
|
}
|
|
723
725
|
.hasFieldEqualTo(
|
|
@@ -762,19 +764,19 @@ internal class DdSdkTest {
|
|
|
762
764
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
763
765
|
}
|
|
764
766
|
.hasField("logsConfig") {
|
|
765
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
767
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1_FED.intakeEndpoint)
|
|
766
768
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
767
769
|
}
|
|
768
770
|
.hasField("tracesConfig") {
|
|
769
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
771
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1_FED.intakeEndpoint)
|
|
770
772
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
771
773
|
}
|
|
772
774
|
.hasField("rumConfig") {
|
|
773
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
775
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1_FED.intakeEndpoint)
|
|
774
776
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
775
777
|
}
|
|
776
778
|
.hasField("crashReportConfig") {
|
|
777
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
779
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.US1_FED.intakeEndpoint)
|
|
778
780
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
779
781
|
}
|
|
780
782
|
.hasFieldEqualTo(
|
|
@@ -819,19 +821,76 @@ internal class DdSdkTest {
|
|
|
819
821
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
820
822
|
}
|
|
821
823
|
.hasField("logsConfig") {
|
|
822
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
824
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.EU1.intakeEndpoint)
|
|
823
825
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
824
826
|
}
|
|
825
827
|
.hasField("tracesConfig") {
|
|
826
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
828
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.EU1.intakeEndpoint)
|
|
827
829
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
828
830
|
}
|
|
829
831
|
.hasField("rumConfig") {
|
|
830
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
832
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.EU1.intakeEndpoint)
|
|
831
833
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
832
834
|
}
|
|
833
835
|
.hasField("crashReportConfig") {
|
|
834
|
-
it.hasFieldEqualTo("endpointUrl",
|
|
836
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.EU1.intakeEndpoint)
|
|
837
|
+
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
838
|
+
}
|
|
839
|
+
.hasFieldEqualTo(
|
|
840
|
+
"additionalConfig",
|
|
841
|
+
fakeConfiguration.additionalConfig?.filterValues { it != null }.orEmpty()
|
|
842
|
+
)
|
|
843
|
+
val credentials = credentialCaptor.firstValue
|
|
844
|
+
assertThat(credentials.clientToken).isEqualTo(fakeConfiguration.clientToken)
|
|
845
|
+
assertThat(credentials.envName).isEqualTo(fakeConfiguration.env)
|
|
846
|
+
assertThat(credentials.rumApplicationId).isEqualTo(fakeConfiguration.applicationId)
|
|
847
|
+
assertThat(credentials.variant).isEqualTo("")
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
@Test
|
|
851
|
+
fun `𝕄 initialize native SDK 𝕎 initialize() {site=ap1}`(
|
|
852
|
+
forge: Forge
|
|
853
|
+
) {
|
|
854
|
+
// Given
|
|
855
|
+
val site = forge.randomizeCase("ap1")
|
|
856
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, nativeCrashReportEnabled = true)
|
|
857
|
+
val credentialCaptor = argumentCaptor<Credentials>()
|
|
858
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
859
|
+
|
|
860
|
+
// When
|
|
861
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
862
|
+
|
|
863
|
+
// Then
|
|
864
|
+
inOrder(mockDatadog) {
|
|
865
|
+
verify(mockDatadog).initialize(
|
|
866
|
+
same(mockContext),
|
|
867
|
+
credentialCaptor.capture(),
|
|
868
|
+
configCaptor.capture(),
|
|
869
|
+
any()
|
|
870
|
+
)
|
|
871
|
+
verify(mockDatadog).registerRumMonitor(any())
|
|
872
|
+
}
|
|
873
|
+
assertThat(configCaptor.firstValue)
|
|
874
|
+
.hasField("coreConfig") {
|
|
875
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
876
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
877
|
+
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
878
|
+
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
879
|
+
}
|
|
880
|
+
.hasField("logsConfig") {
|
|
881
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.AP1.intakeEndpoint)
|
|
882
|
+
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
883
|
+
}
|
|
884
|
+
.hasField("tracesConfig") {
|
|
885
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.AP1.intakeEndpoint)
|
|
886
|
+
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
887
|
+
}
|
|
888
|
+
.hasField("rumConfig") {
|
|
889
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.AP1.intakeEndpoint)
|
|
890
|
+
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
891
|
+
}
|
|
892
|
+
.hasField("crashReportConfig") {
|
|
893
|
+
it.hasFieldEqualTo("endpointUrl", DatadogSite.AP1.intakeEndpoint)
|
|
835
894
|
it.hasFieldEqualTo("plugins", emptyList<DatadogPlugin>())
|
|
836
895
|
}
|
|
837
896
|
.hasFieldEqualTo(
|
|
@@ -1075,6 +1134,72 @@ internal class DdSdkTest {
|
|
|
1075
1134
|
}
|
|
1076
1135
|
}
|
|
1077
1136
|
|
|
1137
|
+
@Test
|
|
1138
|
+
fun `𝕄 initialize native SDK 𝕎 initialize() {frustration tracking enabled}`(
|
|
1139
|
+
@Forgery configuration: DdSdkConfiguration
|
|
1140
|
+
) {
|
|
1141
|
+
// Given
|
|
1142
|
+
val bridgeConfiguration = configuration.copy(
|
|
1143
|
+
trackFrustrations = true
|
|
1144
|
+
)
|
|
1145
|
+
val credentialCaptor = argumentCaptor<Credentials>()
|
|
1146
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1147
|
+
|
|
1148
|
+
// When
|
|
1149
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1150
|
+
|
|
1151
|
+
// Then
|
|
1152
|
+
inOrder(mockDatadog) {
|
|
1153
|
+
verify(mockDatadog).initialize(
|
|
1154
|
+
same(mockContext),
|
|
1155
|
+
credentialCaptor.capture(),
|
|
1156
|
+
configCaptor.capture(),
|
|
1157
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1158
|
+
)
|
|
1159
|
+
verify(mockDatadog).registerRumMonitor(any())
|
|
1160
|
+
}
|
|
1161
|
+
assertThat(configCaptor.firstValue)
|
|
1162
|
+
.hasField("rumConfig") {
|
|
1163
|
+
it.hasFieldEqualTo(
|
|
1164
|
+
"trackFrustrations",
|
|
1165
|
+
true
|
|
1166
|
+
)
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
@Test
|
|
1171
|
+
fun `𝕄 initialize native SDK 𝕎 initialize() {frustration tracking disabled}`(
|
|
1172
|
+
@Forgery configuration: DdSdkConfiguration
|
|
1173
|
+
) {
|
|
1174
|
+
// Given
|
|
1175
|
+
val bridgeConfiguration = configuration.copy(
|
|
1176
|
+
trackFrustrations = false
|
|
1177
|
+
)
|
|
1178
|
+
val credentialCaptor = argumentCaptor<Credentials>()
|
|
1179
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1180
|
+
|
|
1181
|
+
// When
|
|
1182
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1183
|
+
|
|
1184
|
+
// Then
|
|
1185
|
+
inOrder(mockDatadog) {
|
|
1186
|
+
verify(mockDatadog).initialize(
|
|
1187
|
+
same(mockContext),
|
|
1188
|
+
credentialCaptor.capture(),
|
|
1189
|
+
configCaptor.capture(),
|
|
1190
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1191
|
+
)
|
|
1192
|
+
verify(mockDatadog).registerRumMonitor(any())
|
|
1193
|
+
}
|
|
1194
|
+
assertThat(configCaptor.firstValue)
|
|
1195
|
+
.hasField("rumConfig") {
|
|
1196
|
+
it.hasFieldEqualTo(
|
|
1197
|
+
"trackFrustrations",
|
|
1198
|
+
false
|
|
1199
|
+
)
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1078
1203
|
@Test
|
|
1079
1204
|
fun `𝕄 initialize native SDK 𝕎 initialize() {with user action tracking}`(
|
|
1080
1205
|
@Forgery configuration: DdSdkConfiguration
|
|
@@ -1288,12 +1413,152 @@ internal class DdSdkTest {
|
|
|
1288
1413
|
@Forgery configuration: DdSdkConfiguration,
|
|
1289
1414
|
forge: Forge
|
|
1290
1415
|
) {
|
|
1291
|
-
val
|
|
1416
|
+
val tracingHosts = forge.aMap {
|
|
1417
|
+
Pair(
|
|
1418
|
+
forge.aStringMatching("[a-z]+\\.[a-z]{3}"),
|
|
1419
|
+
forge.aSubSetOf(
|
|
1420
|
+
setOf(
|
|
1421
|
+
TracingHeaderType.DATADOG,
|
|
1422
|
+
TracingHeaderType.B3MULTI,
|
|
1423
|
+
TracingHeaderType.TRACECONTEXT,
|
|
1424
|
+
TracingHeaderType.B3
|
|
1425
|
+
),
|
|
1426
|
+
anInt(1, 4)
|
|
1427
|
+
)
|
|
1428
|
+
)
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
val firstPartyHosts = mutableListOf<ReadableMap>()
|
|
1432
|
+
tracingHosts.forEach { (match, headerTypes) ->
|
|
1433
|
+
firstPartyHosts.add(
|
|
1434
|
+
mapOf(
|
|
1435
|
+
"match" to match,
|
|
1436
|
+
"propagatorTypes" to headerTypes.map {
|
|
1437
|
+
it.name.lowercase()
|
|
1438
|
+
}.toReadableArray()
|
|
1439
|
+
).toReadableMap()
|
|
1440
|
+
)
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
// Given
|
|
1444
|
+
val bridgeConfiguration = configuration.copy(
|
|
1445
|
+
additionalConfig = mapOf(
|
|
1446
|
+
DdSdk.DD_FIRST_PARTY_HOSTS to firstPartyHosts.toReadableArray()
|
|
1447
|
+
)
|
|
1448
|
+
)
|
|
1449
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1450
|
+
|
|
1451
|
+
// When
|
|
1452
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1453
|
+
|
|
1454
|
+
// Then
|
|
1455
|
+
verify(mockDatadog).initialize(
|
|
1456
|
+
same(mockContext),
|
|
1457
|
+
any(),
|
|
1458
|
+
configCaptor.capture(),
|
|
1459
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1460
|
+
)
|
|
1461
|
+
assertThat(configCaptor.firstValue)
|
|
1462
|
+
.hasField("coreConfig") { coreConfig ->
|
|
1463
|
+
coreConfig.hasFieldEqualTo(
|
|
1464
|
+
"firstPartyHostsWithHeaderTypes",
|
|
1465
|
+
tracingHosts
|
|
1466
|
+
)
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
@Test
|
|
1471
|
+
fun `𝕄 set first party hosts 𝕎 initialize() {wrong first party hosts}`(
|
|
1472
|
+
@Forgery configuration: DdSdkConfiguration,
|
|
1473
|
+
forge: Forge
|
|
1474
|
+
) {
|
|
1475
|
+
val tracingHosts = forge.aMap {
|
|
1476
|
+
Pair(
|
|
1477
|
+
forge.aStringMatching("[a-z]+\\.[a-z]{3}"),
|
|
1478
|
+
setOf(
|
|
1479
|
+
TracingHeaderType.DATADOG,
|
|
1480
|
+
)
|
|
1481
|
+
)
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
val firstPartyHosts = mutableListOf<ReadableMap>()
|
|
1485
|
+
tracingHosts.forEach { (match) ->
|
|
1486
|
+
firstPartyHosts.add(
|
|
1487
|
+
mapOf(
|
|
1488
|
+
"match" to match,
|
|
1489
|
+
"propagatorTypes" to listOf(
|
|
1490
|
+
TracingHeaderType.DATADOG.name.lowercase(),
|
|
1491
|
+
forge.aString()
|
|
1492
|
+
).toReadableArray()
|
|
1493
|
+
).toReadableMap()
|
|
1494
|
+
)
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
// Given
|
|
1498
|
+
val bridgeConfiguration = configuration.copy(
|
|
1499
|
+
additionalConfig = mapOf(
|
|
1500
|
+
DdSdk.DD_FIRST_PARTY_HOSTS to firstPartyHosts.toReadableArray()
|
|
1501
|
+
)
|
|
1502
|
+
)
|
|
1503
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1504
|
+
|
|
1505
|
+
// When
|
|
1506
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1507
|
+
|
|
1508
|
+
// Then
|
|
1509
|
+
verify(mockDatadog).initialize(
|
|
1510
|
+
same(mockContext),
|
|
1511
|
+
any(),
|
|
1512
|
+
configCaptor.capture(),
|
|
1513
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1514
|
+
)
|
|
1515
|
+
assertThat(configCaptor.firstValue)
|
|
1516
|
+
.hasField("coreConfig") { coreConfig ->
|
|
1517
|
+
coreConfig.hasFieldEqualTo(
|
|
1518
|
+
"firstPartyHostsWithHeaderTypes",
|
|
1519
|
+
tracingHosts
|
|
1520
|
+
)
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
@Test
|
|
1525
|
+
fun `𝕄 set first party hosts 𝕎 initialize() {duplicated first party hosts}`(
|
|
1526
|
+
@Forgery configuration: DdSdkConfiguration,
|
|
1527
|
+
forge: Forge
|
|
1528
|
+
) {
|
|
1529
|
+
val host = forge.aStringMatching("[a-z]+\\.[a-z]{3}")
|
|
1530
|
+
val tracingHosts = mapOf(
|
|
1531
|
+
Pair(
|
|
1532
|
+
host,
|
|
1533
|
+
setOf(
|
|
1534
|
+
TracingHeaderType.DATADOG,
|
|
1535
|
+
TracingHeaderType.B3,
|
|
1536
|
+
)
|
|
1537
|
+
),
|
|
1538
|
+
)
|
|
1539
|
+
|
|
1540
|
+
val firstPartyHosts = mutableListOf<ReadableMap>()
|
|
1541
|
+
firstPartyHosts.add(
|
|
1542
|
+
mapOf(
|
|
1543
|
+
"match" to host,
|
|
1544
|
+
"propagatorTypes" to listOf(
|
|
1545
|
+
TracingHeaderType.DATADOG.name.lowercase(),
|
|
1546
|
+
).toReadableArray()
|
|
1547
|
+
).toReadableMap()
|
|
1548
|
+
)
|
|
1549
|
+
firstPartyHosts.add(
|
|
1550
|
+
mapOf(
|
|
1551
|
+
"match" to host,
|
|
1552
|
+
"propagatorTypes" to listOf(
|
|
1553
|
+
TracingHeaderType.B3.name.lowercase(),
|
|
1554
|
+
).toReadableArray()
|
|
1555
|
+
).toReadableMap()
|
|
1556
|
+
)
|
|
1292
1557
|
|
|
1293
1558
|
// Given
|
|
1294
1559
|
val bridgeConfiguration = configuration.copy(
|
|
1295
1560
|
additionalConfig = mapOf(
|
|
1296
|
-
DdSdk.DD_FIRST_PARTY_HOSTS to firstPartyHosts
|
|
1561
|
+
DdSdk.DD_FIRST_PARTY_HOSTS to firstPartyHosts.toReadableArray()
|
|
1297
1562
|
)
|
|
1298
1563
|
)
|
|
1299
1564
|
val configCaptor = argumentCaptor<Configuration>()
|
|
@@ -1312,9 +1577,7 @@ internal class DdSdkTest {
|
|
|
1312
1577
|
.hasField("coreConfig") { coreConfig ->
|
|
1313
1578
|
coreConfig.hasFieldEqualTo(
|
|
1314
1579
|
"firstPartyHostsWithHeaderTypes",
|
|
1315
|
-
|
|
1316
|
-
setOf(TracingHeaderType.DATADOG)
|
|
1317
|
-
}
|
|
1580
|
+
tracingHosts
|
|
1318
1581
|
)
|
|
1319
1582
|
}
|
|
1320
1583
|
}
|
|
@@ -55,6 +55,11 @@ fun DdSdkConfiguration.toReadableJavaOnlyMap(): ReadableMap {
|
|
|
55
55
|
// ReadableMap#getString which doesn't allow having null value
|
|
56
56
|
map["vitalsUpdateFrequency"] = VitalsUpdateFrequency.AVERAGE.toString()
|
|
57
57
|
}
|
|
58
|
+
map["trackFrustrations"] = if (trackFrustrations == null) {
|
|
59
|
+
false
|
|
60
|
+
} else {
|
|
61
|
+
trackFrustrations
|
|
62
|
+
}
|
|
58
63
|
additionalConfig?.let { map.put("additionalConfig", it.toReadableMap()) }
|
|
59
64
|
configurationForTelemetry?.let {
|
|
60
65
|
map.put("configurationForTelemetry", it.toReadableJavaOnlyMap())
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
package com.datadog.tools.unit
|
|
8
8
|
|
|
9
|
+
import com.facebook.react.bridge.JavaOnlyArray
|
|
9
10
|
import com.facebook.react.bridge.JavaOnlyMap
|
|
11
|
+
import com.facebook.react.bridge.ReadableArray
|
|
10
12
|
import com.facebook.react.bridge.ReadableMap
|
|
11
13
|
|
|
12
14
|
fun Map<*, *>.toReadableMap(): ReadableMap {
|
|
@@ -20,3 +22,8 @@ fun Map<*, *>.toReadableMap(): ReadableMap {
|
|
|
20
22
|
// this FB implementation is not backed by Android-specific .so library, so ok for unit tests
|
|
21
23
|
return JavaOnlyMap.of(*keysAndValues.toTypedArray())
|
|
22
24
|
}
|
|
25
|
+
|
|
26
|
+
fun List<*>.toReadableArray(): ReadableArray {
|
|
27
|
+
// this FB implementation is not backed by Android-specific .so library, so ok for unit tests
|
|
28
|
+
return JavaOnlyArray.from(this)
|
|
29
|
+
}
|
package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt
CHANGED
|
@@ -47,7 +47,8 @@ class DdSdkConfigurationForgeryFactory : ForgeryFactory<DdSdkConfiguration> {
|
|
|
47
47
|
trackErrors = forge.aBool(),
|
|
48
48
|
trackInteractions = forge.aBool(),
|
|
49
49
|
trackNetworkRequests = forge.aBool()
|
|
50
|
-
)
|
|
50
|
+
),
|
|
51
|
+
trackFrustrations = forge.aNullable { aBool() },
|
|
51
52
|
)
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -61,11 +61,21 @@ internal class TelemetryConfigurationEventForgeryFactory :
|
|
|
61
61
|
forge.aNullable { aBool() },
|
|
62
62
|
forge.aNullable { aString() },
|
|
63
63
|
forge.aNullable { aBool() },
|
|
64
|
+
forge.aNullable { aBool() },
|
|
65
|
+
forge.aNullable {
|
|
66
|
+
aList {
|
|
67
|
+
aValueFrom(
|
|
68
|
+
TelemetryConfigurationEvent.SelectedTracingPropagator::class.java
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
},
|
|
64
72
|
forge.aNullable { aString() },
|
|
65
73
|
forge.aNullable { aBool() },
|
|
66
74
|
forge.aNullable { aBool() },
|
|
67
75
|
forge.aNullable { aBool() },
|
|
68
76
|
forge.aNullable { aBool() },
|
|
77
|
+
forge.aNullable { aBool() },
|
|
78
|
+
|
|
69
79
|
forge.aNullable { aBool() },
|
|
70
80
|
forge.aNullable { aList { aString() } },
|
|
71
81
|
forge.aNullable { aList { aString() } },
|
|
@@ -56,8 +56,8 @@ afterEvaluate {
|
|
|
56
56
|
group = "datadog"
|
|
57
57
|
description = "Uploads sourcemaps to Datadog."
|
|
58
58
|
|
|
59
|
-
def execCommand = { jsBundleFile ->
|
|
60
|
-
|
|
59
|
+
def execCommand = { jsBundleFile, shouldUploadBundleFile ->
|
|
60
|
+
def command = [
|
|
61
61
|
"yarn",
|
|
62
62
|
"datadog-ci",
|
|
63
63
|
"react-native",
|
|
@@ -66,8 +66,6 @@ afterEvaluate {
|
|
|
66
66
|
"android",
|
|
67
67
|
"--service",
|
|
68
68
|
serviceName,
|
|
69
|
-
"--bundle",
|
|
70
|
-
jsBundleFile.absolutePath,
|
|
71
69
|
"--sourcemap",
|
|
72
70
|
jsOutputSourceMapFile.absolutePath,
|
|
73
71
|
"--release-version",
|
|
@@ -75,11 +73,18 @@ afterEvaluate {
|
|
|
75
73
|
"--build-version",
|
|
76
74
|
buildVersion
|
|
77
75
|
]
|
|
76
|
+
if (shouldUploadBundleFile) {
|
|
77
|
+
command.add("--bundle")
|
|
78
|
+
command.add(jsBundleFile.absolutePath)
|
|
79
|
+
}
|
|
80
|
+
return command
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
doFirst {
|
|
84
|
+
def shouldUploadBundleFile = getShouldUploadBundleFile(reactRoot)
|
|
85
|
+
|
|
81
86
|
def jsBundleFile = reactConfig.bundleFileResolver()
|
|
82
|
-
if (jsBundleFile == null) {
|
|
87
|
+
if (jsBundleFile == null && shouldUploadBundleFile) {
|
|
83
88
|
throw new GradleException("JS bundle file doesn't exist, aborting upload.")
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -87,7 +92,7 @@ afterEvaluate {
|
|
|
87
92
|
throw new GradleException("JS sourcemap file doesn't exist, aborting upload.")
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
runShellCommand(execCommand(jsBundleFile), reactRoot)
|
|
95
|
+
runShellCommand(execCommand(jsBundleFile, shouldUploadBundleFile), reactRoot)
|
|
91
96
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
@@ -179,6 +184,7 @@ private def runShellCommand(
|
|
|
179
184
|
result.rethrowFailure()
|
|
180
185
|
} else {
|
|
181
186
|
logger.lifecycle(outputStream.toString("UTF-8"))
|
|
187
|
+
return outputStream.toString("UTF-8")
|
|
182
188
|
}
|
|
183
189
|
} catch (Exception e) {
|
|
184
190
|
def errorStreamContent = errorStream.toString("UTF-8")
|
|
@@ -189,6 +195,48 @@ private def runShellCommand(
|
|
|
189
195
|
}
|
|
190
196
|
}
|
|
191
197
|
|
|
192
|
-
private
|
|
198
|
+
private def getShouldUploadBundleFile(File reactRoot) {
|
|
199
|
+
// Provide a way to override bundle upload
|
|
200
|
+
if (project.hasProperty("datadog")) {
|
|
201
|
+
if (project.datadog.containsKey("shouldUploadBundle")) {
|
|
202
|
+
return project.datadog.shouldUploadBundle
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
def datadogCiVersionCommand = [
|
|
207
|
+
"yarn",
|
|
208
|
+
"--silent",
|
|
209
|
+
"datadog-ci",
|
|
210
|
+
"version"
|
|
211
|
+
]
|
|
212
|
+
try {
|
|
213
|
+
def versionAsString = runShellCommand(datadogCiVersionCommand, reactRoot) // outputs: v2.5.1
|
|
214
|
+
// We remove the leading "v" in the version number output
|
|
215
|
+
List version = versionAsString.replace("v", "").tokenize('.').collect { it.toInteger() }
|
|
216
|
+
|
|
217
|
+
// First datadog-ci version allowing not uploading the bundle is 2.6.0
|
|
218
|
+
return !isVersionEqualOrAbove(version, [2, 6, 0])
|
|
219
|
+
} catch (Exception e) {
|
|
220
|
+
|
|
221
|
+
return true
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private static isVersionEqualOrAbove(List version, List targetVersion) {
|
|
226
|
+
if (version[0] != targetVersion[0]) {
|
|
227
|
+
return version[0] > targetVersion[0]
|
|
228
|
+
}
|
|
229
|
+
if (version [1] != targetVersion[1]) {
|
|
230
|
+
return version[1] > targetVersion[1]
|
|
231
|
+
}
|
|
232
|
+
return version[2] >= targetVersion[2]
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private def getServiceName(variant) {
|
|
236
|
+
if (project.hasProperty("datadog")) {
|
|
237
|
+
if (project.datadog.serviceName) {
|
|
238
|
+
return project.datadog.serviceName
|
|
239
|
+
}
|
|
240
|
+
}
|
|
193
241
|
return variant.applicationId
|
|
194
242
|
}
|
package/ios/Sources/DdSdk.m
CHANGED
|
@@ -33,5 +33,9 @@ RCT_EXTERN_METHOD(telemetryError:(NSString)message
|
|
|
33
33
|
withKind:(NSString)kind
|
|
34
34
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
35
35
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
36
|
+
|
|
37
|
+
RCT_EXTERN_METHOD(consumeWebviewEvent:(NSString)message
|
|
38
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
39
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
36
40
|
|
|
37
41
|
@end
|