@datadog/mobile-react-native 3.1.0 → 3.1.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.
Files changed (32) hide show
  1. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +3 -3
  2. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +18 -18
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +3 -2
  4. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  5. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +4 -2
  6. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +6 -3
  7. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +3 -4
  8. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +1 -1
  9. package/android/src/test/resources/input/complete-configuration.json +10 -10
  10. package/ios/Sources/DdSdkConfiguration.swift +4 -4
  11. package/ios/Sources/DdSdkNativeInitialization.swift +2 -2
  12. package/ios/Sources/RNDdSdkConfiguration.swift +9 -8
  13. package/ios/Sources/SdkVersion.swift +1 -1
  14. package/lib/commonjs/InternalLog.js +9 -7
  15. package/lib/commonjs/InternalLog.js.map +1 -1
  16. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js +10 -8
  17. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  18. package/lib/commonjs/version.js +1 -1
  19. package/lib/module/InternalLog.js +9 -6
  20. package/lib/module/InternalLog.js.map +1 -1
  21. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js +10 -7
  22. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  23. package/lib/module/version.js +1 -1
  24. package/lib/typescript/InternalLog.d.ts +6 -4
  25. package/lib/typescript/InternalLog.d.ts.map +1 -1
  26. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +7 -5
  27. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts.map +1 -1
  28. package/lib/typescript/version.d.ts +1 -1
  29. package/package.json +2 -2
  30. package/src/InternalLog.tsx +14 -6
  31. package/src/sdk/DatadogProvider/Buffer/BufferSingleton.ts +16 -7
  32. package/src/version.ts +1 -1
@@ -24,7 +24,6 @@ import java.net.Proxy
24
24
  * @param batchSize The preferred size for uploaded batches of data (can be 'SMALL', 'MEDIUM' (default), 'LARGE')
25
25
  * @param batchProcessingLevel The preferred number of batches of data that will be sent in a single upload (can be 'LOW', 'MEDIUM' (default), 'HIGH')
26
26
  * @param proxyConfiguration Configuration for proxying SDK data.
27
- * @param firstPartyHosts List of backend hosts to enable tracing with.
28
27
  * @param rumConfiguration Configuration for the RUM feature module, including RUM application ID and RUM-specific options.
29
28
  * @param logsConfiguration Configuration for the Logs feature module.
30
29
  * @param traceConfiguration Configuration for the Traces (APM) feature module.
@@ -42,7 +41,6 @@ data class DdSdkConfiguration(
42
41
  val batchSize: String? = null,
43
42
  val batchProcessingLevel: String? = null,
44
43
  val proxyConfiguration: Pair<Proxy, ProxyAuthenticator?>? = null,
45
- val firstPartyHosts: Map<String, Set<TracingHeaderType>>? = null,
46
44
  val rumConfiguration: RumConfiguration? = null,
47
45
  val logsConfiguration: LogsConfiguration? = null,
48
46
  val traceConfiguration: TraceConfiguration? = null,
@@ -63,6 +61,7 @@ data class DdSdkConfiguration(
63
61
  * @param nativeLongTaskThresholdMs The threshold for native long tasks reporting in milliseconds.
64
62
  * @param nativeViewTracking Enables/Disables tracking RUM Views on the native level.
65
63
  * @param nativeInteractionTracking Enables/Disables tracking RUM Actions on the native level.
64
+ * @param firstPartyHosts List of backend hosts to enable tracing with.
66
65
  * @param trackNonFatalAnrs Enables tracking of non-fatal ANRs on Android.
67
66
  * @param initialResourceThreshold The amount of time after a view starts where a Resource should be considered when calculating Time to Network-Settled (TNS).
68
67
  * @param telemetrySampleRate The sample rate (between 0 and 100) of telemetry events.
@@ -80,6 +79,7 @@ data class RumConfiguration(
80
79
  val nativeLongTaskThresholdMs: Double? = null,
81
80
  val nativeViewTracking: Boolean? = null,
82
81
  val nativeInteractionTracking: Boolean? = null,
82
+ val firstPartyHosts: Map<String, Set<TracingHeaderType>>? = null,
83
83
  val trackNonFatalAnrs: Boolean? = null,
84
84
  val initialResourceThreshold: Double? = null,
85
85
  val telemetrySampleRate: Double? = null,
@@ -127,7 +127,6 @@ internal data class JSONDdSdkConfiguration(
127
127
  val version: String? = null,
128
128
  val versionSuffix: String? = null,
129
129
  val site: String? = null,
130
- val firstPartyHosts: List<JSONFirstPartyHost>? = null,
131
130
  val rumConfiguration: JSONRumConfiguration? = null,
132
131
  val logsConfiguration: JSONLogsConfiguration? = null,
133
132
  val traceConfiguration: JSONTraceConfiguration? = null
@@ -140,6 +139,7 @@ internal data class JSONRumConfiguration(
140
139
  val trackResources: Boolean? = null,
141
140
  val trackErrors: Boolean? = null,
142
141
  val actionNameAttribute: String? = null,
142
+ val firstPartyHosts: List<JSONFirstPartyHost>? = null,
143
143
  val appHangThreshold: Double? = null,
144
144
  val initialResourceThreshold: Double? = null,
145
145
 
@@ -41,6 +41,7 @@ internal fun ReadableMap.asDdSdkConfiguration(): DdSdkConfiguration {
41
41
  nativeLongTaskThresholdMs = rm.getDoubleOrNull("nativeLongTaskThresholdMs"),
42
42
  nativeViewTracking = rm.getBooleanOrNull("nativeViewTracking"),
43
43
  nativeInteractionTracking = rm.getBooleanOrNull("nativeInteractionTracking"),
44
+ firstPartyHosts = rm.getArray("firstPartyHosts")?.asFirstPartyHosts(),
44
45
  trackNonFatalAnrs = rm.getBooleanOrNull("trackNonFatalAnrs"),
45
46
  initialResourceThreshold = rm.getDoubleOrNull("initialResourceThreshold"),
46
47
  telemetrySampleRate = rm.getDoubleOrNull("telemetrySampleRate"),
@@ -77,7 +78,6 @@ internal fun ReadableMap.asDdSdkConfiguration(): DdSdkConfiguration {
77
78
  batchSize = getString("batchSize"),
78
79
  batchProcessingLevel = getString("batchProcessingLevel"),
79
80
  proxyConfiguration = getMap("proxyConfiguration")?.asProxyConfig(),
80
- firstPartyHosts = getArray("firstPartyHosts")?.asFirstPartyHosts(),
81
81
  rumConfiguration = rumConfiguration,
82
82
  logsConfiguration = logsConfiguration,
83
83
  traceConfiguration = traceConfiguration,
@@ -182,6 +182,7 @@ internal fun JSONDdSdkConfiguration.asDdSdkConfiguration(): DdSdkConfiguration {
182
182
  nativeLongTaskThresholdMs = rum.nativeLongTaskThresholdMs ?: DefaultConfiguration.nativeLongTaskThresholdMs,
183
183
  nativeViewTracking = rum.nativeViewTracking ?: DefaultConfiguration.nativeViewTracking,
184
184
  nativeInteractionTracking = rum.nativeInteractionTracking ?: DefaultConfiguration.nativeInteractionTracking,
185
+ firstPartyHosts = rum.firstPartyHosts?.asFirstPartyHosts(),
185
186
  trackNonFatalAnrs = rum.trackNonFatalAnrs,
186
187
  initialResourceThreshold = rum.initialResourceThreshold ?: DefaultConfiguration.initialResourceThreshold,
187
188
  telemetrySampleRate = rum.telemetrySampleRate?.toDouble()
@@ -220,7 +221,6 @@ internal fun JSONDdSdkConfiguration.asDdSdkConfiguration(): DdSdkConfiguration {
220
221
  batchSize = this.batchSize?: DefaultConfiguration.batchSize,
221
222
  batchProcessingLevel = this.batchProcessingLevel,
222
223
  proxyConfiguration = this.proxyConfiguration?.asProxyConfig(),
223
- firstPartyHosts = this.firstPartyHosts?.asFirstPartyHosts(),
224
224
  rumConfiguration = rumConfiguration,
225
225
  logsConfiguration = logsConfiguration,
226
226
  traceConfiguration = traceConfiguration,
@@ -269,7 +269,7 @@ internal fun List<String>.asTracingHeaderTypes(): Set<TracingHeaderType> {
269
269
  }.toSet()
270
270
  }
271
271
 
272
- @Suppress("LongMethod", "CyclomaticComplexMethod")
272
+ @Suppress("LongMethod", "CyclomaticComplexMethod", "NestedBlockDepth")
273
273
  internal fun DdSdkConfiguration.toReadableMap(): ReadableMap {
274
274
  val map = WritableNativeMap()
275
275
 
@@ -300,25 +300,11 @@ internal fun DdSdkConfiguration.toReadableMap(): ReadableMap {
300
300
  )
301
301
  map.putMap("proxyConfiguration", proxyMap)
302
302
  }
303
- firstPartyHosts?.let { hosts ->
304
- val hostsArray = WritableNativeArray()
305
- hosts.forEach { (match, types) ->
306
- val hostMap = WritableNativeMap()
307
- hostMap.putString("match", match)
308
- val propagatorsArray = WritableNativeArray()
309
- types.forEach { type ->
310
- propagatorsArray.pushString(type.toString())
311
- }
312
- hostMap.putArray("propagatorTypes", propagatorsArray)
313
- hostsArray.pushMap(hostMap)
314
- }
315
- map.putArray("firstPartyHosts", hostsArray)
316
- }
317
303
  rumConfiguration?.let { rum ->
318
304
  val rumMap = WritableNativeMap()
319
305
  rumMap.putString("applicationId", rum.applicationId)
320
306
  rum.trackFrustrations?.let { rumMap.putBoolean("trackFrustrations", it) }
321
- rum.longTaskThresholdMs?.let { map.putDouble("longTaskThresholdMs", it) }
307
+ rum.longTaskThresholdMs?.let { rumMap.putDouble("longTaskThresholdMs", it) }
322
308
  rum.sessionSampleRate?.let { rumMap.putDouble("sessionSampleRate", it) }
323
309
  rum.resourceTraceSampleRate?.let { rumMap.putDouble("resourceTraceSampleRate", it) }
324
310
  rum.vitalsUpdateFrequency?.let { rumMap.putString("vitalsUpdateFrequency", it) }
@@ -328,6 +314,20 @@ internal fun DdSdkConfiguration.toReadableMap(): ReadableMap {
328
314
  rum.nativeViewTracking?.let { rumMap.putBoolean("nativeViewTracking", it) }
329
315
  rum.nativeInteractionTracking?.let { rumMap.putBoolean("nativeInteractionTracking", it) }
330
316
  rum.trackNonFatalAnrs?.let { rumMap.putBoolean("trackNonFatalAnrs", it) }
317
+ rum.firstPartyHosts?.let { hosts ->
318
+ val hostsArray = WritableNativeArray()
319
+ hosts.forEach { (match, types) ->
320
+ val hostMap = WritableNativeMap()
321
+ hostMap.putString("match", match)
322
+ val propagatorsArray = WritableNativeArray()
323
+ types.forEach { type ->
324
+ propagatorsArray.pushString(type.toString())
325
+ }
326
+ hostMap.putArray("propagatorTypes", propagatorsArray)
327
+ hostsArray.pushMap(hostMap)
328
+ }
329
+ rumMap.putArray("firstPartyHosts", hostsArray)
330
+ }
331
331
  rum.initialResourceThreshold?.let { rumMap.putDouble("initialResourceThreshold", it) }
332
332
  rum.telemetrySampleRate?.let { rumMap.putDouble("telemetrySampleRate", it) }
333
333
  rum.customEndpoint?.let { rumMap.putString("customEndpoint", it) }
@@ -306,8 +306,9 @@ class DdSdkNativeInitialization internal constructor(
306
306
  configBuilder.setProxy(proxy, authenticator)
307
307
  }
308
308
 
309
- if (configuration.firstPartyHosts != null) {
310
- configBuilder.setFirstPartyHostsWithHeaderType(configuration.firstPartyHosts)
309
+ val firstPartyHosts = configuration.rumConfiguration?.firstPartyHosts
310
+ if (firstPartyHosts != null) {
311
+ configBuilder.setFirstPartyHostsWithHeaderType(firstPartyHosts)
311
312
  }
312
313
 
313
314
  configBuilder.setBatchProcessingLevel(buildBatchProcessingLevel(configuration.batchProcessingLevel))
@@ -7,4 +7,4 @@
7
7
  package com.datadog.reactnative
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- internal const val SDK_VERSION = "3.1.0"
10
+ internal const val SDK_VERSION = "3.1.1"
@@ -131,7 +131,8 @@ internal class DdSdkNativeInitializationTest {
131
131
  }
132
132
  assertThat(configuration.proxyConfiguration?.second?.username).isEqualTo("proxyusername")
133
133
  assertThat(configuration.proxyConfiguration?.second?.password).isEqualTo("proxypassword")
134
- assertThat(configuration.firstPartyHosts?.get("example.com").toString()).isEqualTo(
134
+ val firstPartyHosts = configuration.rumConfiguration?.firstPartyHosts?.get("example.com")
135
+ assertThat(firstPartyHosts.toString()).isEqualTo(
135
136
  "[B3MULTI, TRACECONTEXT]"
136
137
  )
137
138
  assertThat(configuration.rumConfiguration?.initialResourceThreshold).isEqualTo(0.5)
@@ -155,7 +156,7 @@ internal class DdSdkNativeInitializationTest {
155
156
  assertThat(configuration.verbosity).isNull()
156
157
  assertThat(configuration.service).isNull()
157
158
  assertThat(configuration.proxyConfiguration).isNull()
158
- assertThat(configuration.firstPartyHosts).isNull()
159
+
159
160
  assertThat(configuration.site).isEqualTo("US1")
160
161
  assertThat(configuration.uploadFrequency).isEqualTo("AVERAGE")
161
162
  assertThat(configuration.batchSize).isEqualTo("MEDIUM")
@@ -180,6 +181,7 @@ internal class DdSdkNativeInitializationTest {
180
181
  assertThat(configuration.rumConfiguration?.nativeLongTaskThresholdMs).isEqualTo(200.0)
181
182
  assertThat(configuration.rumConfiguration?.nativeViewTracking).isEqualTo(false)
182
183
  assertThat(configuration.rumConfiguration?.nativeInteractionTracking).isEqualTo(false)
184
+ assertThat(configuration.rumConfiguration?.firstPartyHosts).isNull()
183
185
  assertThat(configuration.logsConfiguration?.customEndpoint).isNull()
184
186
  assertThat(configuration.traceConfiguration?.customEndpoint).isNull()
185
187
  }
@@ -1772,9 +1772,10 @@ internal class DdSdkTest {
1772
1772
  }
1773
1773
 
1774
1774
  // Given
1775
- val bridgeConfiguration = configuration.copy(
1775
+ val rumConfiguration = configuration.rumConfiguration?.copy(
1776
1776
  firstPartyHosts = firstPartyHosts.toReadableArray().asFirstPartyHosts()
1777
1777
  )
1778
+ val bridgeConfiguration = configuration.copy(rumConfiguration = rumConfiguration)
1778
1779
  val sdkConfigCaptor = argumentCaptor<Configuration>()
1779
1780
  val rumConfigCaptor = argumentCaptor<RumConfiguration>()
1780
1781
  val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
@@ -1845,9 +1846,10 @@ internal class DdSdkTest {
1845
1846
  }
1846
1847
 
1847
1848
  // Given
1848
- val bridgeConfiguration = configuration.copy(
1849
+ val rumConfiguration = configuration.rumConfiguration?.copy(
1849
1850
  firstPartyHosts = firstPartyHosts.toReadableArray().asFirstPartyHosts()
1850
1851
  )
1852
+ val bridgeConfiguration = configuration.copy(rumConfiguration = rumConfiguration)
1851
1853
  val sdkConfigCaptor = argumentCaptor<Configuration>()
1852
1854
  val rumConfigCaptor = argumentCaptor<RumConfiguration>()
1853
1855
  val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
@@ -1925,9 +1927,10 @@ internal class DdSdkTest {
1925
1927
  )
1926
1928
 
1927
1929
  // Given
1928
- val bridgeConfiguration = configuration.copy(
1930
+ val rumConfiguration = configuration.rumConfiguration?.copy(
1929
1931
  firstPartyHosts = firstPartyHosts.toReadableArray().asFirstPartyHosts()
1930
1932
  )
1933
+ val bridgeConfiguration = configuration.copy(rumConfiguration = rumConfiguration)
1931
1934
  val sdkConfigCaptor = argumentCaptor<Configuration>()
1932
1935
  val rumConfigCaptor = argumentCaptor<RumConfiguration>()
1933
1936
  val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
@@ -40,10 +40,6 @@ fun DdSdkConfiguration.toReadableJavaOnlyMap(): ReadableMap {
40
40
  map["proxyConfiguration"] = proxyPair.toReadableMap()
41
41
  }
42
42
 
43
- firstPartyHosts?.let {
44
- map["firstPartyHosts"] = it.toFirstPartyHostsReadableArray()
45
- }
46
-
47
43
  additionalConfiguration?.let {
48
44
  map["additionalConfiguration"] = it.toReadableMap()
49
45
  }
@@ -65,6 +61,9 @@ fun DdSdkConfiguration.toReadableJavaOnlyMap(): ReadableMap {
65
61
  rum?.nativeViewTracking?.let { rumMap["nativeViewTracking"] = it }
66
62
  rum?.nativeInteractionTracking?.let { rumMap["nativeInteractionTracking"] = it }
67
63
  rum?.trackNonFatalAnrs?.let { rumMap["trackNonFatalAnrs"] = it }
64
+ rum?.firstPartyHosts?.let {
65
+ rumMap["firstPartyHosts"] = it.toFirstPartyHostsReadableArray()
66
+ }
68
67
  rumMap["initialResourceThreshold"] = rum?.initialResourceThreshold ?: 0.1
69
68
  rumMap["telemetrySampleRate"] = rum?.telemetrySampleRate ?: 20.0
70
69
  rum?.customEndpoint?.let { rumMap["customEndpoint"] = it }
@@ -56,7 +56,6 @@ class DdSdkConfigurationForgeryFactory : ForgeryFactory<DdSdkConfiguration> {
56
56
  )
57
57
  },
58
58
  proxyConfiguration = null,
59
- firstPartyHosts = null,
60
59
  rumConfiguration = RumConfiguration(
61
60
  applicationId = forge.getForgery<UUID>().toString(),
62
61
  trackFrustrations = forge.aNullable { aBool() },
@@ -71,6 +70,7 @@ class DdSdkConfigurationForgeryFactory : ForgeryFactory<DdSdkConfiguration> {
71
70
  nativeLongTaskThresholdMs = forge.aNullable { aDouble(100.0, 5000.0) },
72
71
  nativeViewTracking = forge.aNullable { aBool() },
73
72
  nativeInteractionTracking = forge.aNullable { aBool() },
73
+ firstPartyHosts = null,
74
74
  trackNonFatalAnrs = forge.aNullable { aBool() },
75
75
  initialResourceThreshold = forge.aNullable { aDouble(0.0, 2.0) },
76
76
  telemetrySampleRate = forge.aNullable { aDouble(0.0, 100.0) },
@@ -29,7 +29,16 @@
29
29
  "sessionSampleRate": 80,
30
30
  "resourceTraceSampleRate": 33,
31
31
  "trackBackgroundEvents": true,
32
- "trackFrustrations": false
32
+ "trackFrustrations": false,
33
+ "firstPartyHosts": [
34
+ {
35
+ "match": "example.com",
36
+ "propagatorTypes": [
37
+ "B3MULTI",
38
+ "TRACECONTEXT"
39
+ ]
40
+ }
41
+ ]
33
42
  },
34
43
  "logsConfiguration": {
35
44
  "customEndpoint": "https://logs.example.com"
@@ -37,15 +46,6 @@
37
46
  "traceConfiguration": {
38
47
  "customEndpoint": "https://trace.example.com"
39
48
  },
40
- "firstPartyHosts": [
41
- {
42
- "match": "example.com",
43
- "propagatorTypes": [
44
- "B3MULTI",
45
- "TRACECONTEXT"
46
- ]
47
- }
48
- ],
49
49
  "proxyConfiguration": {
50
50
  "address": "1.1.1.1",
51
51
  "port": 4444,
@@ -23,7 +23,6 @@ import Foundation
23
23
  /// - batchSize: The preferred size of batches sent to Datadog.
24
24
  /// - batchProcessingLevel: Maximum number of batches processed sequentially before applying a delay.
25
25
  /// - proxyConfiguration: Configuration for proxying SDK data (proxy type, address, port, etc.).
26
- /// - firstPartyHosts: List of backend hosts considered first-party for network tracing.
27
26
  /// - rumConfiguration: Configuration for the RUM feature module.
28
27
  /// - logsConfiguration: Configuration for the Logs feature module.
29
28
  /// - traceConfiguration: Configuration for the Traces feature module.
@@ -41,7 +40,6 @@ public class DdSdkConfiguration: NSObject {
41
40
  public var batchSize: Datadog.Configuration.BatchSize
42
41
  public var batchProcessingLevel: Datadog.Configuration.BatchProcessingLevel
43
42
  public var proxyConfiguration: [AnyHashable: Any]? = nil
44
- public var firstPartyHosts: [String: Set<TracingHeaderType>]? = nil
45
43
  public var rumConfiguration: RumConfiguration? = nil
46
44
  public var logsConfiguration: LogsConfiguration? = nil
47
45
  public var traceConfiguration: TraceConfiguration? = nil
@@ -59,7 +57,6 @@ public class DdSdkConfiguration: NSObject {
59
57
  batchSize: Datadog.Configuration.BatchSize,
60
58
  batchProcessingLevel: Datadog.Configuration.BatchProcessingLevel,
61
59
  proxyConfiguration: [AnyHashable: Any]?,
62
- firstPartyHosts: [String: Set<TracingHeaderType>]?,
63
60
  rumConfiguration: RumConfiguration?,
64
61
  logsConfiguration: LogsConfiguration?,
65
62
  traceConfiguration: TraceConfiguration?,
@@ -76,7 +73,6 @@ public class DdSdkConfiguration: NSObject {
76
73
  self.batchSize = batchSize
77
74
  self.batchProcessingLevel = batchProcessingLevel
78
75
  self.proxyConfiguration = proxyConfiguration
79
- self.firstPartyHosts = firstPartyHosts
80
76
  self.rumConfiguration = rumConfiguration
81
77
  self.logsConfiguration = logsConfiguration
82
78
  self.traceConfiguration = traceConfiguration
@@ -99,6 +95,7 @@ public class DdSdkConfiguration: NSObject {
99
95
  /// - nativeLongTaskThresholdMs: The threshold for reporting native long tasks in milliseconds.
100
96
  /// - nativeViewTracking: Enables tracking of native iOS/Android UI views.
101
97
  /// - nativeInteractionTracking: Enables tracking of native UI interactions.
98
+ /// - firstPartyHosts: List of backend hosts considered first-party for network tracing.
102
99
  /// - appHangThreshold: Threshold in seconds for reporting non-fatal app hangs (iOS only).
103
100
  /// - trackWatchdogTerminations: Whether the SDK should track application terminations
104
101
  /// caused by the iOS watchdog.
@@ -118,6 +115,7 @@ public class RumConfiguration: NSObject {
118
115
  public var nativeLongTaskThresholdMs: Double? = nil
119
116
  public var nativeViewTracking: Bool? = nil
120
117
  public var nativeInteractionTracking: Bool? = nil
118
+ public var firstPartyHosts: [String: Set<TracingHeaderType>]? = nil
121
119
  public var appHangThreshold: Double? = nil
122
120
  public var trackWatchdogTerminations: Bool
123
121
  public var initialResourceThreshold: Double? = nil
@@ -137,6 +135,7 @@ public class RumConfiguration: NSObject {
137
135
  nativeLongTaskThresholdMs: Double? = nil,
138
136
  nativeViewTracking: Bool?,
139
137
  nativeInteractionTracking: Bool?,
138
+ firstPartyHosts: [String: Set<TracingHeaderType>]?,
140
139
  appHangThreshold: Double?,
141
140
  trackWatchdogTerminations: Bool,
142
141
  initialResourceThreshold: Double?,
@@ -155,6 +154,7 @@ public class RumConfiguration: NSObject {
155
154
  self.nativeLongTaskThresholdMs = nativeLongTaskThresholdMs
156
155
  self.nativeViewTracking = nativeViewTracking
157
156
  self.nativeInteractionTracking = nativeInteractionTracking
157
+ self.firstPartyHosts = firstPartyHosts
158
158
  self.appHangThreshold = appHangThreshold
159
159
  self.trackWatchdogTerminations = trackWatchdogTerminations
160
160
  self.initialResourceThreshold = initialResourceThreshold
@@ -162,7 +162,7 @@ public class DdSdkNativeInitialization: NSObject {
162
162
  }
163
163
 
164
164
  var urlSessionTracking: RUM.Configuration.URLSessionTracking? = nil
165
- if let firstPartyHosts = configuration.firstPartyHosts {
165
+ if let firstPartyHosts = rumConfig.firstPartyHosts {
166
166
  urlSessionTracking = RUM.Configuration.URLSessionTracking(
167
167
  firstPartyHostsTracing: .traceWithHeaders(
168
168
  hostsWithHeaders: firstPartyHosts,
@@ -272,4 +272,4 @@ public class DdSdkNativeInitialization: NSObject {
272
272
  Datadog.verbosityLevel = nil
273
273
  }
274
274
  }
275
- }
275
+ }
@@ -39,8 +39,6 @@ extension NSDictionary {
39
39
  let proxyConfigurationDict = self["proxyConfiguration"] as? NSDictionary
40
40
  let proxyConfiguration = proxyConfigurationDict?.asProxyConfiguration()
41
41
 
42
- let firstPartyHostsArray = self["firstPartyHosts"] as? NSArray
43
- let firstPartyHosts = firstPartyHostsArray?.asFirstPartyHosts()
44
42
 
45
43
  // MARK: - RUM configuration
46
44
 
@@ -62,6 +60,9 @@ extension NSDictionary {
62
60
  let nativeLongTaskThresholdMs = rumDict["nativeLongTaskThresholdMs"] as? Double
63
61
  let nativeViewTracking = rumDict["nativeViewTracking"] as? Bool
64
62
  let nativeInteractionTracking = rumDict["nativeInteractionTracking"] as? Bool
63
+
64
+ let firstPartyHostsArray = rumDict["firstPartyHosts"] as? NSArray
65
+ let firstPartyHosts = firstPartyHostsArray?.asFirstPartyHosts()
65
66
 
66
67
  let appHangThreshold = rumDict["appHangThreshold"] as? Double
67
68
  let trackWatchdogTerminations = rumDict["trackWatchdogTerminations"] as? Bool
@@ -88,6 +89,7 @@ extension NSDictionary {
88
89
  nativeViewTracking: nativeViewTracking ?? DefaultConfiguration.nativeViewTracking,
89
90
  nativeInteractionTracking: nativeInteractionTracking
90
91
  ?? DefaultConfiguration.nativeInteractionTracking,
92
+ firstPartyHosts: firstPartyHosts,
91
93
  appHangThreshold: appHangThreshold,
92
94
  trackWatchdogTerminations: trackWatchdogTerminations
93
95
  ?? DefaultConfiguration.trackWatchdogTerminations,
@@ -154,7 +156,6 @@ extension NSDictionary {
154
156
  batchSize: batchSize,
155
157
  batchProcessingLevel: batchProcessingLevel,
156
158
  proxyConfiguration: proxyConfiguration,
157
- firstPartyHosts: firstPartyHosts,
158
159
  rumConfiguration: rumConfiguration,
159
160
  logsConfiguration: logsConfiguration,
160
161
  traceConfiguration: traceConfiguration,
@@ -317,10 +318,6 @@ extension Dictionary where Key == String, Value == AnyObject {
317
318
  let proxyDict = configuration["proxyConfiguration"] as? NSDictionary
318
319
  let proxyConfiguration = proxyDict?.asProxyConfiguration()
319
320
 
320
- let firstPartyHostsArray = configuration["firstPartyHosts"] as? NSArray
321
- let firstPartyHosts =
322
- firstPartyHostsArray?.asFirstPartyHosts() ?? DefaultConfiguration.firstPartyHosts
323
-
324
321
  // MARK: - RUM configuration
325
322
 
326
323
  let rumDict = configuration["rumConfiguration"] as? [String: Any?]
@@ -355,6 +352,10 @@ extension Dictionary where Key == String, Value == AnyObject {
355
352
  if let v = nativeLongTaskRaw as? Int { return Double(v) }
356
353
  return nil
357
354
  }()
355
+
356
+ let firstPartyHostsArray = rum["firstPartyHosts"] as? NSArray
357
+ let firstPartyHosts =
358
+ firstPartyHostsArray?.asFirstPartyHosts() ?? DefaultConfiguration.firstPartyHosts
358
359
 
359
360
  rumConfiguration = RumConfiguration(
360
361
  applicationId: applicationId,
@@ -377,6 +378,7 @@ extension Dictionary where Key == String, Value == AnyObject {
377
378
  ?? DefaultConfiguration.nativeViewTracking,
378
379
  nativeInteractionTracking: rum["nativeInteractionTracking"] as? Bool
379
380
  ?? DefaultConfiguration.nativeInteractionTracking,
381
+ firstPartyHosts: firstPartyHosts,
380
382
  appHangThreshold: rum["appHangThreshold"] as? Double,
381
383
  trackWatchdogTerminations: rum["trackWatchdogTerminations"] as? Bool
382
384
  ?? DefaultConfiguration.trackWatchdogTerminations,
@@ -438,7 +440,6 @@ extension Dictionary where Key == String, Value == AnyObject {
438
440
  batchSize: batchSize,
439
441
  batchProcessingLevel: batchProcessingLevel,
440
442
  proxyConfiguration: proxyConfiguration,
441
- firstPartyHosts: firstPartyHosts,
442
443
  rumConfiguration: rumConfiguration,
443
444
  logsConfiguration: logsConfiguration,
444
445
  traceConfiguration: traceConfiguration,
@@ -7,4 +7,4 @@
7
7
  import Foundation
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- let SdkVersion = "3.1.0"
10
+ let SdkVersion = "3.1.1"
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.InternalLog = exports.DATADOG_MESSAGE_PREFIX = void 0;
7
7
  var _SdkVerbosity = require("./config/types/SdkVerbosity");
8
+ var _singletonUtils = require("./utils/singletonUtils");
8
9
  /*
9
10
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
10
11
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
@@ -12,21 +13,22 @@ var _SdkVerbosity = require("./config/types/SdkVerbosity");
12
13
  */
13
14
 
14
15
  const DATADOG_MESSAGE_PREFIX = exports.DATADOG_MESSAGE_PREFIX = 'DATADOG:';
16
+ const INTERNAL_LOG_MODULE = 'com.datadog.reactnative.internal_log';
15
17
 
16
18
  /**
17
19
  * /!\ DO NOT USE THIS IN YOUR APP /!\\
18
20
  *
19
21
  * This logger is only for debugging the Datadog SDK.
20
22
  */
21
- class InternalLog {
22
- static levelMap = new Map([[_SdkVerbosity.SdkVerbosity.DEBUG, 1], [_SdkVerbosity.SdkVerbosity.INFO, 2], [_SdkVerbosity.SdkVerbosity.WARN, 3], [_SdkVerbosity.SdkVerbosity.ERROR, 4]]);
23
- static verbosity = undefined;
24
- static log(message, verbosity) {
25
- if (InternalLog.verbosity === undefined) {
23
+ class _InternalLog {
24
+ levelMap = new Map([[_SdkVerbosity.SdkVerbosity.DEBUG, 1], [_SdkVerbosity.SdkVerbosity.INFO, 2], [_SdkVerbosity.SdkVerbosity.WARN, 3], [_SdkVerbosity.SdkVerbosity.ERROR, 4]]);
25
+ verbosity = undefined;
26
+ log(message, verbosity) {
27
+ if (this.verbosity === undefined) {
26
28
  return;
27
29
  }
28
30
  const requiredLevel = InternalLog.levelMap.get(verbosity);
29
- const allowedLevel = InternalLog.levelMap.get(InternalLog.verbosity);
31
+ const allowedLevel = InternalLog.levelMap.get(this.verbosity);
30
32
  if (allowedLevel === undefined || requiredLevel === undefined) {
31
33
  return;
32
34
  }
@@ -45,5 +47,5 @@ class InternalLog {
45
47
  }
46
48
  }
47
49
  }
48
- exports.InternalLog = InternalLog;
50
+ const InternalLog = exports.InternalLog = (0, _singletonUtils.getGlobalInstance)(INTERNAL_LOG_MODULE, () => new _InternalLog());
49
51
  //# sourceMappingURL=InternalLog.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_SdkVerbosity","require","DATADOG_MESSAGE_PREFIX","exports","InternalLog","levelMap","Map","SdkVerbosity","DEBUG","INFO","WARN","ERROR","verbosity","undefined","log","message","requiredLevel","get","allowedLevel","prefixedMessage","console","error","warn","info","debug"],"sourceRoot":"../../src","sources":["InternalLog.tsx"],"mappings":";;;;;;AAMA,IAAAA,aAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,UAAU;;AAEhD;AACA;AACA;AACA;AACA;AACO,MAAME,WAAW,CAAC;EACrB,OAAeC,QAAQ,GAAG,IAAIC,GAAG,CAAuB,CACpD,CAACC,0BAAY,CAACC,KAAK,EAAE,CAAC,CAAC,EACvB,CAACD,0BAAY,CAACE,IAAI,EAAE,CAAC,CAAC,EACtB,CAACF,0BAAY,CAACG,IAAI,EAAE,CAAC,CAAC,EACtB,CAACH,0BAAY,CAACI,KAAK,EAAE,CAAC,CAAC,CAC1B,CAAC;EAEF,OAAcC,SAAS,GAA6BC,SAAS;EAE7D,OAAcC,GAAGA,CAACC,OAAe,EAAEH,SAAuB,EAAQ;IAC9D,IAAIR,WAAW,CAACQ,SAAS,KAAKC,SAAS,EAAE;MACrC;IACJ;IACA,MAAMG,aAAa,GAAGZ,WAAW,CAACC,QAAQ,CAACY,GAAG,CAACL,SAAS,CAAC;IACzD,MAAMM,YAAY,GAAGd,WAAW,CAACC,QAAQ,CAACY,GAAG,CAACb,WAAW,CAACQ,SAAS,CAAC;IACpE,IAAIM,YAAY,KAAKL,SAAS,IAAIG,aAAa,KAAKH,SAAS,EAAE;MAC3D;IACJ;IACA,MAAMM,eAAe,GAAG,GAAGjB,sBAAsB,IAAIa,OAAO,EAAE;IAC9D,IAAIH,SAAS,KAAKL,0BAAY,CAACI,KAAK,IAAIK,aAAa,IAAIE,YAAY,EAAE;MACnEE,OAAO,CAACC,KAAK,CAACF,eAAe,CAAC;IAClC;IAEA,IAAIP,SAAS,KAAKL,0BAAY,CAACG,IAAI,IAAIM,aAAa,IAAIE,YAAY,EAAE;MAClEE,OAAO,CAACE,IAAI,CAACH,eAAe,CAAC;IACjC;IAEA,IAAIP,SAAS,KAAKL,0BAAY,CAACE,IAAI,IAAIO,aAAa,IAAIE,YAAY,EAAE;MAClEE,OAAO,CAACG,IAAI,CAACJ,eAAe,CAAC;IACjC;IAEA,IAAIP,SAAS,KAAKL,0BAAY,CAACC,KAAK,IAAIQ,aAAa,IAAIE,YAAY,EAAE;MACnEE,OAAO,CAACI,KAAK,CAACL,eAAe,CAAC;IAClC;EACJ;AACJ;AAAChB,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["_SdkVerbosity","require","_singletonUtils","DATADOG_MESSAGE_PREFIX","exports","INTERNAL_LOG_MODULE","_InternalLog","levelMap","Map","SdkVerbosity","DEBUG","INFO","WARN","ERROR","verbosity","undefined","log","message","requiredLevel","InternalLog","get","allowedLevel","prefixedMessage","console","error","warn","info","debug","getGlobalInstance"],"sourceRoot":"../../src","sources":["InternalLog.tsx"],"mappings":";;;;;;AAMA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAPA;AACA;AACA;AACA;AACA;;AAKO,MAAME,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,UAAU;AAEhD,MAAME,mBAAmB,GAAG,sCAAsC;;AAElE;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,CAAC;EACPC,QAAQ,GAAG,IAAIC,GAAG,CAAuB,CAC7C,CAACC,0BAAY,CAACC,KAAK,EAAE,CAAC,CAAC,EACvB,CAACD,0BAAY,CAACE,IAAI,EAAE,CAAC,CAAC,EACtB,CAACF,0BAAY,CAACG,IAAI,EAAE,CAAC,CAAC,EACtB,CAACH,0BAAY,CAACI,KAAK,EAAE,CAAC,CAAC,CAC1B,CAAC;EAEKC,SAAS,GAA6BC,SAAS;EAE/CC,GAAGA,CAACC,OAAe,EAAEH,SAAuB,EAAQ;IACvD,IAAI,IAAI,CAACA,SAAS,KAAKC,SAAS,EAAE;MAC9B;IACJ;IACA,MAAMG,aAAa,GAAGC,WAAW,CAACZ,QAAQ,CAACa,GAAG,CAACN,SAAS,CAAC;IACzD,MAAMO,YAAY,GAAGF,WAAW,CAACZ,QAAQ,CAACa,GAAG,CAAC,IAAI,CAACN,SAAS,CAAC;IAC7D,IAAIO,YAAY,KAAKN,SAAS,IAAIG,aAAa,KAAKH,SAAS,EAAE;MAC3D;IACJ;IACA,MAAMO,eAAe,GAAG,GAAGnB,sBAAsB,IAAIc,OAAO,EAAE;IAC9D,IAAIH,SAAS,KAAKL,0BAAY,CAACI,KAAK,IAAIK,aAAa,IAAIG,YAAY,EAAE;MACnEE,OAAO,CAACC,KAAK,CAACF,eAAe,CAAC;IAClC;IAEA,IAAIR,SAAS,KAAKL,0BAAY,CAACG,IAAI,IAAIM,aAAa,IAAIG,YAAY,EAAE;MAClEE,OAAO,CAACE,IAAI,CAACH,eAAe,CAAC;IACjC;IAEA,IAAIR,SAAS,KAAKL,0BAAY,CAACE,IAAI,IAAIO,aAAa,IAAIG,YAAY,EAAE;MAClEE,OAAO,CAACG,IAAI,CAACJ,eAAe,CAAC;IACjC;IAEA,IAAIR,SAAS,KAAKL,0BAAY,CAACC,KAAK,IAAIQ,aAAa,IAAIG,YAAY,EAAE;MACnEE,OAAO,CAACI,KAAK,CAACL,eAAe,CAAC;IAClC;EACJ;AACJ;AAEO,MAAMH,WAAW,GAAAf,OAAA,CAAAe,WAAA,GAAG,IAAAS,iCAAiB,EACxCvB,mBAAmB,EACnB,MAAM,IAAIC,YAAY,CAAC,CAC3B,CAAC","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BufferSingleton = void 0;
7
+ var _singletonUtils = require("../../../utils/singletonUtils");
7
8
  var _BoundedBuffer = require("./BoundedBuffer");
8
9
  var _PassThroughBuffer = require("./PassThroughBuffer");
9
10
  /*
@@ -12,18 +13,19 @@ var _PassThroughBuffer = require("./PassThroughBuffer");
12
13
  * Copyright 2016-Present Datadog, Inc.
13
14
  */
14
15
 
15
- class BufferSingleton {
16
- static bufferInstance = new _BoundedBuffer.BoundedBuffer();
17
- static getInstance = () => {
16
+ const BUFFER_SINGLETON_MODULE = 'com.datadog.reactnative.buffer_singleton';
17
+ class _BufferSingleton {
18
+ bufferInstance = new _BoundedBuffer.BoundedBuffer();
19
+ getInstance = () => {
18
20
  return BufferSingleton.bufferInstance;
19
21
  };
20
- static onInitialization = () => {
21
- BufferSingleton.bufferInstance.drain();
22
- BufferSingleton.bufferInstance = new _PassThroughBuffer.PassThroughBuffer();
22
+ onInitialization = () => {
23
+ this.bufferInstance.drain();
24
+ this.bufferInstance = new _PassThroughBuffer.PassThroughBuffer();
23
25
  };
24
- static reset = () => {
26
+ reset = () => {
25
27
  BufferSingleton.bufferInstance = new _BoundedBuffer.BoundedBuffer();
26
28
  };
27
29
  }
28
- exports.BufferSingleton = BufferSingleton;
30
+ const BufferSingleton = exports.BufferSingleton = (0, _singletonUtils.getGlobalInstance)(BUFFER_SINGLETON_MODULE, () => new _BufferSingleton());
29
31
  //# sourceMappingURL=BufferSingleton.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_BoundedBuffer","require","_PassThroughBuffer","BufferSingleton","bufferInstance","BoundedBuffer","getInstance","onInitialization","drain","PassThroughBuffer","reset","exports"],"sourceRoot":"../../../../../src","sources":["sdk/DatadogProvider/Buffer/BufferSingleton.ts"],"mappings":";;;;;;AAMA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AARA;AACA;AACA;AACA;AACA;;AAMO,MAAME,eAAe,CAAC;EACzB,OAAeC,cAAc,GAAkB,IAAIC,4BAAa,CAAC,CAAC;EAElE,OAAOC,WAAW,GAAGA,CAAA,KAAqB;IACtC,OAAOH,eAAe,CAACC,cAAc;EACzC,CAAC;EAED,OAAOG,gBAAgB,GAAGA,CAAA,KAAM;IAC5BJ,eAAe,CAACC,cAAc,CAACI,KAAK,CAAC,CAAC;IACtCL,eAAe,CAACC,cAAc,GAAG,IAAIK,oCAAiB,CAAC,CAAC;EAC5D,CAAC;EAED,OAAOC,KAAK,GAAGA,CAAA,KAAM;IACjBP,eAAe,CAACC,cAAc,GAAG,IAAIC,4BAAa,CAAC,CAAC;EACxD,CAAC;AACL;AAACM,OAAA,CAAAR,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_singletonUtils","require","_BoundedBuffer","_PassThroughBuffer","BUFFER_SINGLETON_MODULE","_BufferSingleton","bufferInstance","BoundedBuffer","getInstance","BufferSingleton","onInitialization","drain","PassThroughBuffer","reset","exports","getGlobalInstance"],"sourceRoot":"../../../../../src","sources":["sdk/DatadogProvider/Buffer/BufferSingleton.ts"],"mappings":";;;;;;AAMA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AAVA;AACA;AACA;AACA;AACA;;AAQA,MAAMG,uBAAuB,GAAG,0CAA0C;AAE1E,MAAMC,gBAAgB,CAAC;EACXC,cAAc,GAAkB,IAAIC,4BAAa,CAAC,CAAC;EAE3DC,WAAW,GAAGA,CAAA,KAAqB;IAC/B,OAAOC,eAAe,CAACH,cAAc;EACzC,CAAC;EAEDI,gBAAgB,GAAGA,CAAA,KAAM;IACrB,IAAI,CAACJ,cAAc,CAACK,KAAK,CAAC,CAAC;IAC3B,IAAI,CAACL,cAAc,GAAG,IAAIM,oCAAiB,CAAC,CAAC;EACjD,CAAC;EAEDC,KAAK,GAAGA,CAAA,KAAM;IACVJ,eAAe,CAACH,cAAc,GAAG,IAAIC,4BAAa,CAAC,CAAC;EACxD,CAAC;AACL;AAEO,MAAME,eAAe,GAAAK,OAAA,CAAAL,eAAA,GAAG,IAAAM,iCAAiB,EAC5CX,uBAAuB,EACvB,MAAM,IAAIC,gBAAgB,CAAC,CAC/B,CAAC","ignoreList":[]}
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = exports.version = '3.1.0';
8
+ const version = exports.version = '3.1.1';
9
9
  //# sourceMappingURL=version.js.map
@@ -5,22 +5,24 @@
5
5
  */
6
6
 
7
7
  import { SdkVerbosity } from './config/types/SdkVerbosity';
8
+ import { getGlobalInstance } from './utils/singletonUtils';
8
9
  export const DATADOG_MESSAGE_PREFIX = 'DATADOG:';
10
+ const INTERNAL_LOG_MODULE = 'com.datadog.reactnative.internal_log';
9
11
 
10
12
  /**
11
13
  * /!\ DO NOT USE THIS IN YOUR APP /!\\
12
14
  *
13
15
  * This logger is only for debugging the Datadog SDK.
14
16
  */
15
- export class InternalLog {
16
- static levelMap = new Map([[SdkVerbosity.DEBUG, 1], [SdkVerbosity.INFO, 2], [SdkVerbosity.WARN, 3], [SdkVerbosity.ERROR, 4]]);
17
- static verbosity = undefined;
18
- static log(message, verbosity) {
19
- if (InternalLog.verbosity === undefined) {
17
+ class _InternalLog {
18
+ levelMap = new Map([[SdkVerbosity.DEBUG, 1], [SdkVerbosity.INFO, 2], [SdkVerbosity.WARN, 3], [SdkVerbosity.ERROR, 4]]);
19
+ verbosity = undefined;
20
+ log(message, verbosity) {
21
+ if (this.verbosity === undefined) {
20
22
  return;
21
23
  }
22
24
  const requiredLevel = InternalLog.levelMap.get(verbosity);
23
- const allowedLevel = InternalLog.levelMap.get(InternalLog.verbosity);
25
+ const allowedLevel = InternalLog.levelMap.get(this.verbosity);
24
26
  if (allowedLevel === undefined || requiredLevel === undefined) {
25
27
  return;
26
28
  }
@@ -39,4 +41,5 @@ export class InternalLog {
39
41
  }
40
42
  }
41
43
  }
44
+ export const InternalLog = getGlobalInstance(INTERNAL_LOG_MODULE, () => new _InternalLog());
42
45
  //# sourceMappingURL=InternalLog.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SdkVerbosity","DATADOG_MESSAGE_PREFIX","InternalLog","levelMap","Map","DEBUG","INFO","WARN","ERROR","verbosity","undefined","log","message","requiredLevel","get","allowedLevel","prefixedMessage","console","error","warn","info","debug"],"sourceRoot":"../../src","sources":["InternalLog.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,6BAA6B;AAE1D,OAAO,MAAMC,sBAAsB,GAAG,UAAU;;AAEhD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EACrB,OAAeC,QAAQ,GAAG,IAAIC,GAAG,CAAuB,CACpD,CAACJ,YAAY,CAACK,KAAK,EAAE,CAAC,CAAC,EACvB,CAACL,YAAY,CAACM,IAAI,EAAE,CAAC,CAAC,EACtB,CAACN,YAAY,CAACO,IAAI,EAAE,CAAC,CAAC,EACtB,CAACP,YAAY,CAACQ,KAAK,EAAE,CAAC,CAAC,CAC1B,CAAC;EAEF,OAAcC,SAAS,GAA6BC,SAAS;EAE7D,OAAcC,GAAGA,CAACC,OAAe,EAAEH,SAAuB,EAAQ;IAC9D,IAAIP,WAAW,CAACO,SAAS,KAAKC,SAAS,EAAE;MACrC;IACJ;IACA,MAAMG,aAAa,GAAGX,WAAW,CAACC,QAAQ,CAACW,GAAG,CAACL,SAAS,CAAC;IACzD,MAAMM,YAAY,GAAGb,WAAW,CAACC,QAAQ,CAACW,GAAG,CAACZ,WAAW,CAACO,SAAS,CAAC;IACpE,IAAIM,YAAY,KAAKL,SAAS,IAAIG,aAAa,KAAKH,SAAS,EAAE;MAC3D;IACJ;IACA,MAAMM,eAAe,GAAG,GAAGf,sBAAsB,IAAIW,OAAO,EAAE;IAC9D,IAAIH,SAAS,KAAKT,YAAY,CAACQ,KAAK,IAAIK,aAAa,IAAIE,YAAY,EAAE;MACnEE,OAAO,CAACC,KAAK,CAACF,eAAe,CAAC;IAClC;IAEA,IAAIP,SAAS,KAAKT,YAAY,CAACO,IAAI,IAAIM,aAAa,IAAIE,YAAY,EAAE;MAClEE,OAAO,CAACE,IAAI,CAACH,eAAe,CAAC;IACjC;IAEA,IAAIP,SAAS,KAAKT,YAAY,CAACM,IAAI,IAAIO,aAAa,IAAIE,YAAY,EAAE;MAClEE,OAAO,CAACG,IAAI,CAACJ,eAAe,CAAC;IACjC;IAEA,IAAIP,SAAS,KAAKT,YAAY,CAACK,KAAK,IAAIQ,aAAa,IAAIE,YAAY,EAAE;MACnEE,OAAO,CAACI,KAAK,CAACL,eAAe,CAAC;IAClC;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["SdkVerbosity","getGlobalInstance","DATADOG_MESSAGE_PREFIX","INTERNAL_LOG_MODULE","_InternalLog","levelMap","Map","DEBUG","INFO","WARN","ERROR","verbosity","undefined","log","message","requiredLevel","InternalLog","get","allowedLevel","prefixedMessage","console","error","warn","info","debug"],"sourceRoot":"../../src","sources":["InternalLog.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,iBAAiB,QAAQ,wBAAwB;AAE1D,OAAO,MAAMC,sBAAsB,GAAG,UAAU;AAEhD,MAAMC,mBAAmB,GAAG,sCAAsC;;AAElE;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,CAAC;EACPC,QAAQ,GAAG,IAAIC,GAAG,CAAuB,CAC7C,CAACN,YAAY,CAACO,KAAK,EAAE,CAAC,CAAC,EACvB,CAACP,YAAY,CAACQ,IAAI,EAAE,CAAC,CAAC,EACtB,CAACR,YAAY,CAACS,IAAI,EAAE,CAAC,CAAC,EACtB,CAACT,YAAY,CAACU,KAAK,EAAE,CAAC,CAAC,CAC1B,CAAC;EAEKC,SAAS,GAA6BC,SAAS;EAE/CC,GAAGA,CAACC,OAAe,EAAEH,SAAuB,EAAQ;IACvD,IAAI,IAAI,CAACA,SAAS,KAAKC,SAAS,EAAE;MAC9B;IACJ;IACA,MAAMG,aAAa,GAAGC,WAAW,CAACX,QAAQ,CAACY,GAAG,CAACN,SAAS,CAAC;IACzD,MAAMO,YAAY,GAAGF,WAAW,CAACX,QAAQ,CAACY,GAAG,CAAC,IAAI,CAACN,SAAS,CAAC;IAC7D,IAAIO,YAAY,KAAKN,SAAS,IAAIG,aAAa,KAAKH,SAAS,EAAE;MAC3D;IACJ;IACA,MAAMO,eAAe,GAAG,GAAGjB,sBAAsB,IAAIY,OAAO,EAAE;IAC9D,IAAIH,SAAS,KAAKX,YAAY,CAACU,KAAK,IAAIK,aAAa,IAAIG,YAAY,EAAE;MACnEE,OAAO,CAACC,KAAK,CAACF,eAAe,CAAC;IAClC;IAEA,IAAIR,SAAS,KAAKX,YAAY,CAACS,IAAI,IAAIM,aAAa,IAAIG,YAAY,EAAE;MAClEE,OAAO,CAACE,IAAI,CAACH,eAAe,CAAC;IACjC;IAEA,IAAIR,SAAS,KAAKX,YAAY,CAACQ,IAAI,IAAIO,aAAa,IAAIG,YAAY,EAAE;MAClEE,OAAO,CAACG,IAAI,CAACJ,eAAe,CAAC;IACjC;IAEA,IAAIR,SAAS,KAAKX,YAAY,CAACO,KAAK,IAAIQ,aAAa,IAAIG,YAAY,EAAE;MACnEE,OAAO,CAACI,KAAK,CAACL,eAAe,CAAC;IAClC;EACJ;AACJ;AAEA,OAAO,MAAMH,WAAW,GAAGf,iBAAiB,CACxCE,mBAAmB,EACnB,MAAM,IAAIC,YAAY,CAAC,CAC3B,CAAC","ignoreList":[]}
@@ -4,19 +4,22 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
+ import { getGlobalInstance } from '../../../utils/singletonUtils';
7
8
  import { BoundedBuffer } from './BoundedBuffer';
8
9
  import { PassThroughBuffer } from './PassThroughBuffer';
9
- export class BufferSingleton {
10
- static bufferInstance = new BoundedBuffer();
11
- static getInstance = () => {
10
+ const BUFFER_SINGLETON_MODULE = 'com.datadog.reactnative.buffer_singleton';
11
+ class _BufferSingleton {
12
+ bufferInstance = new BoundedBuffer();
13
+ getInstance = () => {
12
14
  return BufferSingleton.bufferInstance;
13
15
  };
14
- static onInitialization = () => {
15
- BufferSingleton.bufferInstance.drain();
16
- BufferSingleton.bufferInstance = new PassThroughBuffer();
16
+ onInitialization = () => {
17
+ this.bufferInstance.drain();
18
+ this.bufferInstance = new PassThroughBuffer();
17
19
  };
18
- static reset = () => {
20
+ reset = () => {
19
21
  BufferSingleton.bufferInstance = new BoundedBuffer();
20
22
  };
21
23
  }
24
+ export const BufferSingleton = getGlobalInstance(BUFFER_SINGLETON_MODULE, () => new _BufferSingleton());
22
25
  //# sourceMappingURL=BufferSingleton.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BoundedBuffer","PassThroughBuffer","BufferSingleton","bufferInstance","getInstance","onInitialization","drain","reset"],"sourceRoot":"../../../../../src","sources":["sdk/DatadogProvider/Buffer/BufferSingleton.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,OAAO,MAAMC,eAAe,CAAC;EACzB,OAAeC,cAAc,GAAkB,IAAIH,aAAa,CAAC,CAAC;EAElE,OAAOI,WAAW,GAAGA,CAAA,KAAqB;IACtC,OAAOF,eAAe,CAACC,cAAc;EACzC,CAAC;EAED,OAAOE,gBAAgB,GAAGA,CAAA,KAAM;IAC5BH,eAAe,CAACC,cAAc,CAACG,KAAK,CAAC,CAAC;IACtCJ,eAAe,CAACC,cAAc,GAAG,IAAIF,iBAAiB,CAAC,CAAC;EAC5D,CAAC;EAED,OAAOM,KAAK,GAAGA,CAAA,KAAM;IACjBL,eAAe,CAACC,cAAc,GAAG,IAAIH,aAAa,CAAC,CAAC;EACxD,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["getGlobalInstance","BoundedBuffer","PassThroughBuffer","BUFFER_SINGLETON_MODULE","_BufferSingleton","bufferInstance","getInstance","BufferSingleton","onInitialization","drain","reset"],"sourceRoot":"../../../../../src","sources":["sdk/DatadogProvider/Buffer/BufferSingleton.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,+BAA+B;AAEjE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,MAAMC,uBAAuB,GAAG,0CAA0C;AAE1E,MAAMC,gBAAgB,CAAC;EACXC,cAAc,GAAkB,IAAIJ,aAAa,CAAC,CAAC;EAE3DK,WAAW,GAAGA,CAAA,KAAqB;IAC/B,OAAOC,eAAe,CAACF,cAAc;EACzC,CAAC;EAEDG,gBAAgB,GAAGA,CAAA,KAAM;IACrB,IAAI,CAACH,cAAc,CAACI,KAAK,CAAC,CAAC;IAC3B,IAAI,CAACJ,cAAc,GAAG,IAAIH,iBAAiB,CAAC,CAAC;EACjD,CAAC;EAEDQ,KAAK,GAAGA,CAAA,KAAM;IACVH,eAAe,CAACF,cAAc,GAAG,IAAIJ,aAAa,CAAC,CAAC;EACxD,CAAC;AACL;AAEA,OAAO,MAAMM,eAAe,GAAGP,iBAAiB,CAC5CG,uBAAuB,EACvB,MAAM,IAAIC,gBAAgB,CAAC,CAC/B,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '3.1.0';
2
+ export const version = '3.1.1';
3
3
  //# sourceMappingURL=version.js.map
@@ -5,9 +5,11 @@ export declare const DATADOG_MESSAGE_PREFIX = "DATADOG:";
5
5
  *
6
6
  * This logger is only for debugging the Datadog SDK.
7
7
  */
8
- export declare class InternalLog {
9
- private static levelMap;
10
- static verbosity: SdkVerbosity | undefined;
11
- static log(message: string, verbosity: SdkVerbosity): void;
8
+ declare class _InternalLog {
9
+ private levelMap;
10
+ verbosity: SdkVerbosity | undefined;
11
+ log(message: string, verbosity: SdkVerbosity): void;
12
12
  }
13
+ export declare const InternalLog: _InternalLog;
14
+ export {};
13
15
  //# sourceMappingURL=InternalLog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalLog.d.ts","sourceRoot":"","sources":["../../src/InternalLog.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAO,MAAM,sBAAsB,aAAa,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAKpB;IAEH,OAAc,SAAS,EAAE,YAAY,GAAG,SAAS,CAAa;WAEhD,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,IAAI;CA0BpE"}
1
+ {"version":3,"file":"InternalLog.d.ts","sourceRoot":"","sources":["../../src/InternalLog.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,eAAO,MAAM,sBAAsB,aAAa,CAAC;AAIjD;;;;GAIG;AACH,cAAM,YAAY;IACd,OAAO,CAAC,QAAQ,CAKb;IAEI,SAAS,EAAE,YAAY,GAAG,SAAS,CAAa;IAEhD,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,IAAI;CA0B7D;AAED,eAAO,MAAM,WAAW,cAGvB,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import type { DatadogBuffer } from './DatadogBuffer';
2
- export declare class BufferSingleton {
3
- private static bufferInstance;
4
- static getInstance: () => DatadogBuffer;
5
- static onInitialization: () => void;
6
- static reset: () => void;
2
+ declare class _BufferSingleton {
3
+ private bufferInstance;
4
+ getInstance: () => DatadogBuffer;
5
+ onInitialization: () => void;
6
+ reset: () => void;
7
7
  }
8
+ export declare const BufferSingleton: _BufferSingleton;
9
+ export {};
8
10
  //# sourceMappingURL=BufferSingleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BufferSingleton.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/DatadogProvider/Buffer/BufferSingleton.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,eAAe;IACxB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAsC;IAEnE,MAAM,CAAC,WAAW,QAAO,aAAa,CAEpC;IAEF,MAAM,CAAC,gBAAgB,aAGrB;IAEF,MAAM,CAAC,KAAK,aAEV;CACL"}
1
+ {"version":3,"file":"BufferSingleton.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/DatadogProvider/Buffer/BufferSingleton.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,cAAM,gBAAgB;IAClB,OAAO,CAAC,cAAc,CAAsC;IAE5D,WAAW,QAAO,aAAa,CAE7B;IAEF,gBAAgB,aAGd;IAEF,KAAK,aAEH;CACL;AAED,eAAO,MAAM,eAAe,kBAG3B,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const version = "3.1.0";
1
+ export declare const version = "3.1.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -118,5 +118,5 @@
118
118
  "dependencies": {
119
119
  "big-integer": "^1.6.52"
120
120
  },
121
- "gitHead": "fbb259da0575dba36fb1bb163aa21462d204940c"
121
+ "gitHead": "5d7701cabda497319391937073b2456dc83a0e62"
122
122
  }
@@ -5,30 +5,33 @@
5
5
  */
6
6
 
7
7
  import { SdkVerbosity } from './config/types/SdkVerbosity';
8
+ import { getGlobalInstance } from './utils/singletonUtils';
8
9
 
9
10
  export const DATADOG_MESSAGE_PREFIX = 'DATADOG:';
10
11
 
12
+ const INTERNAL_LOG_MODULE = 'com.datadog.reactnative.internal_log';
13
+
11
14
  /**
12
15
  * /!\ DO NOT USE THIS IN YOUR APP /!\\
13
16
  *
14
17
  * This logger is only for debugging the Datadog SDK.
15
18
  */
16
- export class InternalLog {
17
- private static levelMap = new Map<SdkVerbosity, number>([
19
+ class _InternalLog {
20
+ private levelMap = new Map<SdkVerbosity, number>([
18
21
  [SdkVerbosity.DEBUG, 1],
19
22
  [SdkVerbosity.INFO, 2],
20
23
  [SdkVerbosity.WARN, 3],
21
24
  [SdkVerbosity.ERROR, 4]
22
25
  ]);
23
26
 
24
- public static verbosity: SdkVerbosity | undefined = undefined;
27
+ public verbosity: SdkVerbosity | undefined = undefined;
25
28
 
26
- public static log(message: string, verbosity: SdkVerbosity): void {
27
- if (InternalLog.verbosity === undefined) {
29
+ public log(message: string, verbosity: SdkVerbosity): void {
30
+ if (this.verbosity === undefined) {
28
31
  return;
29
32
  }
30
33
  const requiredLevel = InternalLog.levelMap.get(verbosity);
31
- const allowedLevel = InternalLog.levelMap.get(InternalLog.verbosity);
34
+ const allowedLevel = InternalLog.levelMap.get(this.verbosity);
32
35
  if (allowedLevel === undefined || requiredLevel === undefined) {
33
36
  return;
34
37
  }
@@ -50,3 +53,8 @@ export class InternalLog {
50
53
  }
51
54
  }
52
55
  }
56
+
57
+ export const InternalLog = getGlobalInstance(
58
+ INTERNAL_LOG_MODULE,
59
+ () => new _InternalLog()
60
+ );
@@ -4,23 +4,32 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
+ import { getGlobalInstance } from '../../../utils/singletonUtils';
8
+
7
9
  import { BoundedBuffer } from './BoundedBuffer';
8
10
  import type { DatadogBuffer } from './DatadogBuffer';
9
11
  import { PassThroughBuffer } from './PassThroughBuffer';
10
12
 
11
- export class BufferSingleton {
12
- private static bufferInstance: DatadogBuffer = new BoundedBuffer();
13
+ const BUFFER_SINGLETON_MODULE = 'com.datadog.reactnative.buffer_singleton';
14
+
15
+ class _BufferSingleton {
16
+ private bufferInstance: DatadogBuffer = new BoundedBuffer();
13
17
 
14
- static getInstance = (): DatadogBuffer => {
18
+ getInstance = (): DatadogBuffer => {
15
19
  return BufferSingleton.bufferInstance;
16
20
  };
17
21
 
18
- static onInitialization = () => {
19
- BufferSingleton.bufferInstance.drain();
20
- BufferSingleton.bufferInstance = new PassThroughBuffer();
22
+ onInitialization = () => {
23
+ this.bufferInstance.drain();
24
+ this.bufferInstance = new PassThroughBuffer();
21
25
  };
22
26
 
23
- static reset = () => {
27
+ reset = () => {
24
28
  BufferSingleton.bufferInstance = new BoundedBuffer();
25
29
  };
26
30
  }
31
+
32
+ export const BufferSingleton = getGlobalInstance(
33
+ BUFFER_SINGLETON_MODULE,
34
+ () => new _BufferSingleton()
35
+ );
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '3.1.0';
2
+ export const version = '3.1.1';