File tree Expand file tree Collapse file tree 14 files changed +52
-9
lines changed
main/kotlin/com/datadog/reactnative
sdk/DatadogProvider/__tests__ Expand file tree Collapse file tree 14 files changed +52
-9
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ dependencies {
146146 implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
147147 compileOnly " com.squareup.okhttp3:okhttp:3.12.13"
148148
149- implementation " com.datadoghq:dd-sdk-android:1.18.1 "
149+ implementation " com.datadoghq:dd-sdk-android:1.19.0 "
150150 testImplementation " org.junit.platform:junit-platform-launcher:1.6.2"
151151 testImplementation " org.junit.jupiter:junit-jupiter-api:5.6.2"
152152 testImplementation " org.junit.jupiter:junit-jupiter-engine:5.6.2"
Original file line number Diff line number Diff line change @@ -303,6 +303,10 @@ class DdSdk(
303303 configuration.configurationForTelemetry?.trackNetworkRequests
304304 event.telemetry.configuration.trackNetworkRequests =
305305 configuration.configurationForTelemetry?.trackNetworkRequests
306+ event.telemetry.configuration.reactVersion =
307+ configuration.configurationForTelemetry?.reactVersion
308+ event.telemetry.configuration.reactNativeVersion =
309+ configuration.configurationForTelemetry?.reactNativeVersion
306310
307311 return event
308312 }
Original file line number Diff line number Diff line change @@ -46,10 +46,14 @@ data class DdSdkConfiguration(
4646 * @param trackErrors Whether JS errors are tracked.
4747 * @param trackInteractions Whether interactions are tracked.
4848 * @param trackNetworkRequests Whether network requests are tracked.
49+ * @param reactVersion Version of react used in app.
50+ * @param reactNativeVersion Version of react-native used in app.
4951 */
5052data class ConfigurationForTelemetry (
5153 val initializationType : String? = null ,
5254 val trackErrors : Boolean? = null ,
5355 val trackInteractions : Boolean? = null ,
54- val trackNetworkRequests : Boolean? = null
56+ val trackNetworkRequests : Boolean? = null ,
57+ val reactVersion : String? = null ,
58+ val reactNativeVersion : String? = null
5559)
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ internal fun ReadableMap.asConfigurationForTelemetry(): ConfigurationForTelemetr
3838 trackErrors = getBoolean(" trackErrors" ),
3939 trackInteractions = getBoolean(" trackInteractions" ),
4040 trackNetworkRequests = getBoolean(" trackNetworkRequests" ),
41+ reactVersion = getString(" reactVersion" ),
42+ reactNativeVersion = getString(" reactNativeVersion" ),
4143 )
4244}
4345
@@ -78,5 +80,7 @@ internal fun ConfigurationForTelemetry.toReadableMap(): ReadableMap {
7880 trackErrors?.let { map.putBoolean(" trackErrors" , it) }
7981 trackInteractions?.let { map.putBoolean(" trackInteractions" , it) }
8082 trackNetworkRequests?.let { map.putBoolean(" trackNetworkRequests" , it) }
83+ reactVersion?.let { map.putString(" reactVersion" , it) }
84+ reactNativeVersion?.let { map.putString(" reactNativeVersion" , it) }
8185 return map
8286}
Original file line number Diff line number Diff line change @@ -1827,7 +1827,9 @@ internal class DdSdkTest {
18271827 @StringForgery initializationType : String ,
18281828 @BoolForgery trackInteractions : Boolean ,
18291829 @BoolForgery trackErrors : Boolean ,
1830- @BoolForgery trackNetworkRequests : Boolean
1830+ @BoolForgery trackNetworkRequests : Boolean ,
1831+ @StringForgery reactVersion : String ,
1832+ @StringForgery reactNativeVersion : String
18311833 ) {
18321834 // Given
18331835 val bridgeConfiguration = configuration.copy(
@@ -1838,7 +1840,9 @@ internal class DdSdkTest {
18381840 initializationType = initializationType,
18391841 trackErrors = trackErrors,
18401842 trackInteractions = trackInteractions,
1841- trackNetworkRequests = trackNetworkRequests
1843+ trackNetworkRequests = trackNetworkRequests,
1844+ reactVersion = reactVersion,
1845+ reactNativeVersion = reactNativeVersion
18421846 )
18431847 )
18441848 val configCaptor = argumentCaptor<Configuration >()
Original file line number Diff line number Diff line change @@ -73,5 +73,7 @@ internal fun ConfigurationForTelemetry.toReadableJavaOnlyMap(): ReadableMap {
7373 trackErrors?.let { map.put(" trackErrors" , it) }
7474 trackInteractions?.let { map.put(" trackInteractions" , it) }
7575 trackNetworkRequests?.let { map.put(" trackNetworkRequests" , it) }
76+ reactVersion?.let { map.put(" reactVersion" , it) }
77+ reactNativeVersion?.let { map.put(" reactNativeVersion" , it) }
7678 return map.toReadableMap()
7779}
Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ class DdSdkConfigurationForgeryFactory : ForgeryFactory<DdSdkConfiguration> {
4646 initializationType = forge.anAlphabeticalString(),
4747 trackErrors = forge.aBool(),
4848 trackInteractions = forge.aBool(),
49- trackNetworkRequests = forge.aBool()
49+ trackNetworkRequests = forge.aBool(),
50+ reactVersion = forge.aString(),
51+ reactNativeVersion = forge.aString(),
5052 ),
5153 trackFrustrations = forge.aNullable { aBool() },
5254 )
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ class RNDdSdk: NSObject {
136136 configuration. trackInteractions = rnConfiguration. configurationForTelemetry? . trackInteractions
137137 configuration. trackResources = rnConfiguration. configurationForTelemetry? . trackNetworkRequests
138138 configuration. trackNetworkRequests = rnConfiguration. configurationForTelemetry? . trackNetworkRequests
139+ configuration. reactVersion = rnConfiguration. configurationForTelemetry? . reactVersion as? String
140+ configuration. reactNativeVersion = rnConfiguration. configurationForTelemetry? . reactNativeVersion as? String
139141
140142 // trackCrossPlatformLongTasks will be deprecated for trackLongTask
141143 configuration. trackCrossPlatformLongTasks = rnConfiguration. longTaskThresholdMs != 0
Original file line number Diff line number Diff line change @@ -79,16 +79,22 @@ public class ConfigurationForTelemetry: NSObject {
7979 public var trackErrors : Bool ?
8080 public var trackInteractions : Bool ?
8181 public var trackNetworkRequests : Bool ?
82+ public var reactVersion : NSString ?
83+ public var reactNativeVersion : NSString ?
8284
8385 public init (
8486 initializationType: NSString ? ,
8587 trackErrors: Bool ? ,
8688 trackInteractions: Bool ? ,
87- trackNetworkRequests: Bool ?
89+ trackNetworkRequests: Bool ? ,
90+ reactVersion: NSString ? ,
91+ reactNativeVersion: NSString ?
8892 ) {
8993 self . initializationType = initializationType
9094 self . trackErrors = trackErrors
9195 self . trackInteractions = trackInteractions
9296 self . trackNetworkRequests = trackNetworkRequests
97+ self . reactVersion = reactVersion
98+ self . reactNativeVersion = reactNativeVersion
9399 }
94100}
Original file line number Diff line number Diff line change @@ -47,12 +47,16 @@ extension NSDictionary {
4747 let trackErrors = object ( forKey: " trackErrors " ) as? Bool
4848 let trackInteractions = object ( forKey: " trackInteractions " ) as? Bool
4949 let trackNetworkRequests = object ( forKey: " trackNetworkRequests " ) as? Bool
50+ let reactVersion = object ( forKey: " reactVersion " ) as? NSString
51+ let reactNativeVersion = object ( forKey: " reactNativeVersion " ) as? NSString
5052
5153 return ConfigurationForTelemetry (
5254 initializationType: initializationType,
5355 trackErrors: trackErrors,
5456 trackInteractions: trackInteractions,
55- trackNetworkRequests: trackNetworkRequests
57+ trackNetworkRequests: trackNetworkRequests,
58+ reactVersion: reactVersion,
59+ reactNativeVersion: reactNativeVersion
5660 )
5761 }
5862}
You can’t perform that action at this time.
0 commit comments