@datadog/mobile-react-native 2.2.0 → 2.3.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.
Files changed (102) hide show
  1. package/DatadogSDKReactNative.podspec +2 -1
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +2 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +11 -1
  5. package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +5 -0
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +64 -1
  7. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +164 -4
  8. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +6 -354
  9. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +351 -0
  10. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +5 -3
  11. package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +10 -0
  12. package/android/src/main/kotlin/com/datadog/reactnative/JSONFileReader.kt +20 -0
  13. package/android/src/main/kotlin/com/datadog/reactnative/ProxyAuthenticator.kt +4 -1
  14. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +10 -0
  15. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +3 -2
  16. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +5 -2
  17. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +3 -2
  18. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkConfigurationTest.kt +196 -0
  19. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +181 -0
  20. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +12 -271
  21. package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +10 -0
  22. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +28 -1
  23. package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +24 -0
  24. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +9 -1
  25. package/android/src/test/resources/input/complete-configuration.json +48 -0
  26. package/android/src/test/resources/input/malformed-configuration.json +5 -0
  27. package/android/src/test/resources/input/minimal-configuration.json +8 -0
  28. package/datadog-configuration.gradle +57 -0
  29. package/datadog-configuration.schema.json +200 -0
  30. package/ios/Sources/DatadogSDKWrapper.swift +16 -13
  31. package/ios/Sources/DdLogsImplementation.swift +14 -0
  32. package/ios/Sources/DdSdk.h +2 -0
  33. package/ios/Sources/DdSdk.mm +6 -1
  34. package/ios/Sources/DdSdkConfiguration.swift +47 -56
  35. package/ios/Sources/DdSdkImplementation.swift +10 -279
  36. package/ios/Sources/DdSdkNativeInitialization.swift +218 -0
  37. package/ios/Sources/DdTraceImplementation.swift +3 -1
  38. package/ios/Sources/GlobalState.swift +1 -1
  39. package/ios/Sources/JSONFileReader.swift +28 -0
  40. package/ios/Sources/RNDdSdkConfiguration.swift +227 -9
  41. package/ios/Sources/SdkVersion.swift +10 -0
  42. package/lib/commonjs/DdSdkReactNative.js +24 -66
  43. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  44. package/lib/commonjs/DdSdkReactNativeConfiguration.js +24 -4
  45. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  46. package/lib/commonjs/ProxyConfiguration.js +15 -2
  47. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  48. package/lib/commonjs/index.js +8 -0
  49. package/lib/commonjs/index.js.map +1 -1
  50. package/lib/commonjs/nativeModulesTypes.js +2 -2
  51. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  52. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  53. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +214 -0
  54. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
  55. package/lib/commonjs/types.js +10 -2
  56. package/lib/commonjs/types.js.map +1 -1
  57. package/lib/commonjs/version.js +1 -1
  58. package/lib/commonjs/version.js.map +1 -1
  59. package/lib/module/DdSdkReactNative.js +23 -65
  60. package/lib/module/DdSdkReactNative.js.map +1 -1
  61. package/lib/module/DdSdkReactNativeConfiguration.js +22 -4
  62. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  63. package/lib/module/ProxyConfiguration.js +15 -2
  64. package/lib/module/ProxyConfiguration.js.map +1 -1
  65. package/lib/module/index.js +2 -1
  66. package/lib/module/index.js.map +1 -1
  67. package/lib/module/nativeModulesTypes.js +2 -2
  68. package/lib/module/nativeModulesTypes.js.map +1 -1
  69. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  70. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +197 -0
  71. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
  72. package/lib/module/types.js +10 -2
  73. package/lib/module/types.js.map +1 -1
  74. package/lib/module/version.js +1 -1
  75. package/lib/module/version.js.map +1 -1
  76. package/lib/typescript/DdSdkReactNative.d.ts +0 -9
  77. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +43 -3
  78. package/lib/typescript/ProxyConfiguration.d.ts +4 -12
  79. package/lib/typescript/index.d.ts +2 -1
  80. package/lib/typescript/nativeModulesTypes.d.ts +2 -2
  81. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +2 -1
  82. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +31 -0
  83. package/lib/typescript/types.d.ts +29 -3
  84. package/lib/typescript/version.d.ts +1 -1
  85. package/package.json +7 -4
  86. package/src/DdSdkReactNative.tsx +58 -101
  87. package/src/DdSdkReactNativeConfiguration.tsx +26 -7
  88. package/src/ProxyConfiguration.tsx +17 -3
  89. package/src/__tests__/DdSdkReactNative.test.tsx +134 -112
  90. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +19 -10
  91. package/src/__tests__/mock.test.ts +0 -9
  92. package/src/index.tsx +2 -0
  93. package/src/nativeModulesTypes.ts +1 -1
  94. package/src/sdk/DatadogProvider/DatadogProvider.tsx +3 -1
  95. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +12 -5
  96. package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -2
  97. package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +235 -0
  98. package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +245 -0
  99. package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +22 -0
  100. package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +5 -0
  101. package/src/types.tsx +21 -2
  102. package/src/version.ts +1 -1
@@ -0,0 +1,200 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/DataDog/dd-sdk-reactnative/blob/develop/datadog-configuration.schema.json",
4
+ "title": "Datadog React Native SDK Configuration",
5
+ "description": "Configuration for initializing the Datadog React Native SDK from the native layers.",
6
+ "type": "object",
7
+ "properties": {
8
+ "configuration": {
9
+ "description": "Configuration used for initializing the Datadog SDK.",
10
+ "type": "object",
11
+ "properties": {
12
+ "clientToken": {
13
+ "description": "A valid Datadog client token.",
14
+ "type": "string"
15
+ },
16
+ "env": {
17
+ "description": "The application’s environment, for example: prod, pre-prod, staging, etc.",
18
+ "type": "string"
19
+ },
20
+ "applicationId": {
21
+ "description": "The RUM application ID.",
22
+ "type": "string"
23
+ },
24
+ "nativeCrashReportEnabled": {
25
+ "description": "Enables crash reporting for native platforms (iOS, Android). Default `false`.",
26
+ "type": "boolean"
27
+ },
28
+ "nativeLongTaskThresholdMs": {
29
+ "description": "The threshold for native long tasks reporting in milliseconds.",
30
+ "type": "integer"
31
+ },
32
+ "longTaskThresholdMs": {
33
+ "description": "The threshold for javascript long tasks reporting in milliseconds.",
34
+ "type": "integer"
35
+ },
36
+ "sessionSamplingRate": {
37
+ "description": "Percentage of sampled RUM sessions. Range `0`-`100`.",
38
+ "type": "integer"
39
+ },
40
+ "site": {
41
+ "description": "The Datadog site of your organization (can be 'US1', 'US1_FED', 'US3', 'US5', 'AP1' or 'EU1', default is 'US1').",
42
+ "type": "string",
43
+ "enum": ["US1", "US1_FED", "US3", "US5", "EU1", "AP1"]
44
+ },
45
+ "trackingConsent": {
46
+ "description": "Consent, which can take one of the following values: 'PENDING', 'GRANTED', 'NOT_GRANTED'.",
47
+ "type": "string",
48
+ "enum": ["PENDING", "GRANTED", "NOT_GRANTED"]
49
+ },
50
+ "telemetrySampleRate": {
51
+ "description": "The sampling rate for Internal Telemetry (info related to the work of the SDK internals). Range `0`-`100`.",
52
+ "type": "integer"
53
+ },
54
+ "vitalsUpdateFrequency": {
55
+ "description": "Sets the preferred frequency for collecting mobile vitals.",
56
+ "type": "string",
57
+ "enum": ["NEVER", "RARE", "AVERAGE", "FREQUENT"]
58
+ },
59
+ "uploadFrequency": {
60
+ "description": "Sets the preferred frequency for uploading batches of data.",
61
+ "type": "string",
62
+ "enum": ["RARE", "AVERAGE", "FREQUENT"]
63
+ },
64
+ "batchSize": {
65
+ "description": "Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.",
66
+ "type": "string",
67
+ "enum": ["SMALL", "MEDIUM", "LARGE"]
68
+ },
69
+ "trackFrustrations": {
70
+ "description": "Enables tracking of frustration signals (error taps). Defaults to `true`.",
71
+ "type": "boolean"
72
+ },
73
+ "trackBackgroundEvents": {
74
+ "description": "Enables tracking of RUM event when no RUM View is active.",
75
+ "type": "boolean"
76
+ },
77
+ "customEndpoints": {
78
+ "type": "object",
79
+ "description": "Target a custom server for RUM, Logs and Traces features.",
80
+ "properties": {
81
+ "rum": {
82
+ "type": "string"
83
+ },
84
+ "logs": {
85
+ "type": "string"
86
+ },
87
+ "trace": {
88
+ "type": "string"
89
+ }
90
+ }
91
+ },
92
+ "nativeViewTracking": {
93
+ "description": "Enables native views tracking.",
94
+ "type": "boolean"
95
+ },
96
+ "nativeInteractionTracking": {
97
+ "description": "Enables native interaction tracking.",
98
+ "type": "boolean"
99
+ },
100
+ "verbosity": {
101
+ "description": "Verbosity for internal SDK logging.",
102
+ "type": "string",
103
+ "enum": ["DEBUG", "INFO", "WARN", "ERROR"]
104
+ },
105
+ "proxy": {
106
+ "type": "object",
107
+ "description": "Configuration for proxying SDK data.",
108
+ "properties": {
109
+ "type": {
110
+ "description": "Proxy type.",
111
+ "type": "string",
112
+ "enum": ["HTTP", "HTTPS", "SOCKS"]
113
+ },
114
+ "address": {
115
+ "description": "Proxy address. Can be either in the IP address format, ex. '1.1.1.1', or hostname, ex. 'example.com'.",
116
+ "type": "string"
117
+ },
118
+ "port": {
119
+ "description": "Proxy port.",
120
+ "type": "integer"
121
+ },
122
+ "username": {
123
+ "description": "Username for Basic authentication scheme. Note: SOCKS + authentication scheme is not supported.",
124
+ "type": "string"
125
+ },
126
+ "password": {
127
+ "description": "Password for Basic authentication scheme.",
128
+ "type": "string"
129
+ }
130
+ },
131
+ "required": ["type", "port", "address"]
132
+ },
133
+ "serviceName": {
134
+ "description": "Custom service name.",
135
+ "type": "string"
136
+ },
137
+ "version": {
138
+ "description": "Overrides the reported version of the app.",
139
+ "type": "string"
140
+ },
141
+ "firstPartyHosts": {
142
+ "description": "List of your backends hosts to enable tracing with.",
143
+ "type": "array",
144
+ "items": {
145
+ "type": "object",
146
+ "properties": {
147
+ "match": {
148
+ "description": "Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`. Regular expressions are NOT supported.",
149
+ "type": "string"
150
+ },
151
+ "propagatorTypes": {
152
+ "description": "Types of instrumentation on the host.",
153
+ "type": "array",
154
+ "items": {
155
+ "description": "Type of instrumentation on the host.",
156
+ "type": "string",
157
+ "enum": [
158
+ "DATADOG",
159
+ "B3",
160
+ "B3MULTI",
161
+ "TRACECONTEXT"
162
+ ]
163
+ }
164
+ }
165
+ }
166
+ }
167
+ },
168
+ "trackInteractions": {
169
+ "description": "Track React Native components interactions.",
170
+ "type": "boolean"
171
+ },
172
+ "trackResources": {
173
+ "description": "Track React Native resources.",
174
+ "type": "boolean"
175
+ },
176
+ "trackErrors": {
177
+ "description": "Track React Native errors.",
178
+ "type": "boolean"
179
+ },
180
+ "actionNameAttribute": {
181
+ "description": "Specifies a custom prop to name RUM actions on elements having an `onPress` prop.",
182
+ "type": "string"
183
+ },
184
+ "resourceTracingSamplingRate": {
185
+ "description": "Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.",
186
+ "type": "number"
187
+ },
188
+ "bundleLogsWithRum": {
189
+ "description": "Enables RUM correlation with logs.",
190
+ "type": "boolean"
191
+ },
192
+ "bundleLogsWithTraces": {
193
+ "description": "Enables Traces correlation with logs.",
194
+ "type": "boolean"
195
+ }
196
+ },
197
+ "required": ["clientToken", "env", "applicationId"]
198
+ }
199
+ }
200
+ }
@@ -21,18 +21,18 @@ public class DatadogSDKWrapper {
21
21
  // Singleton
22
22
  public static var shared = DatadogSDKWrapper()
23
23
 
24
- private init() {}
25
-
26
24
  // Initialization callbacks
27
25
  internal var onCoreInitializedListeners: [OnCoreInitializedListener] = []
28
-
26
+ internal var loggerConfiguration = Logger.Configuration()
27
+ // Core instance
28
+ private var coreInstance: DatadogCoreProtocol? = nil
29
+
30
+ private init() { }
31
+
29
32
  public func addOnCoreInitializedListener(listener:@escaping OnCoreInitializedListener) {
30
33
  onCoreInitializedListeners.append(listener)
31
34
  }
32
35
 
33
- // Core instance
34
- private var coreInstance: DatadogCoreProtocol? = nil
35
-
36
36
  /// This is intended for internal testing only.
37
37
  public func setCoreInstance(core: DatadogCoreProtocol?) {
38
38
  self.coreInstance = core
@@ -45,14 +45,17 @@ public class DatadogSDKWrapper {
45
45
 
46
46
  // SDK Wrapper
47
47
  internal func initialize(
48
- with configuration: Datadog.Configuration,
48
+ coreConfiguration: Datadog.Configuration,
49
+ loggerConfiguration: Logger.Configuration,
49
50
  trackingConsent: TrackingConsent
50
51
  ) -> Void {
51
- let core = Datadog.initialize(with: configuration, trackingConsent: trackingConsent)
52
+ let core = Datadog.initialize(with: coreConfiguration, trackingConsent: trackingConsent)
52
53
  setCoreInstance(core: core)
53
54
  for listener in onCoreInitializedListeners {
54
55
  listener(core)
55
56
  }
57
+
58
+ self.loggerConfiguration = loggerConfiguration
56
59
  }
57
60
 
58
61
  internal func isInitialized() -> Bool {
@@ -101,12 +104,12 @@ public class DatadogSDKWrapper {
101
104
  }
102
105
 
103
106
  internal func createLogger() -> LoggerProtocol {
104
- if let core = coreInstance {
105
- return Logger.create(with: Logger.Configuration(networkInfoEnabled: true, consoleLogFormat: .short), in: core)
106
- } else {
107
+ let core = coreInstance ?? {
107
108
  consolePrint("Core instance was not found when creating Logger.", .critical)
108
- return Logger.create(with: Logger.Configuration(networkInfoEnabled: true, consoleLogFormat: .short))
109
- }
109
+ return CoreRegistry.default
110
+ }()
111
+
112
+ return Logger.create(with: loggerConfiguration, in: core)
110
113
  }
111
114
 
112
115
  // Telemetry
@@ -111,3 +111,17 @@ public class DdLogsImplementation: NSObject {
111
111
  resolve(nil)
112
112
  }
113
113
  }
114
+
115
+ internal extension Logger.Configuration {
116
+ /// Creates a Logger configuration from briged configuration dictionary.
117
+ ///
118
+ /// - Parameter dictionnary: The configuration from the bridge.
119
+ init(_ sdkConfiguration: DdSdkConfiguration) {
120
+ self.init(
121
+ networkInfoEnabled: true,
122
+ bundleWithRumEnabled: sdkConfiguration.bundleLogsWithRum ?? true,
123
+ bundleWithTraceEnabled: sdkConfiguration.bundleLogsWithTraces ?? true,
124
+ consoleLogFormat: .short
125
+ )
126
+ }
127
+ }
@@ -21,4 +21,6 @@
21
21
 
22
22
  @property (nonatomic, strong) DdSdkImplementation* ddSdkImplementation;
23
23
 
24
+ + (void)initFromNative;
25
+
24
26
  @end
@@ -10,7 +10,7 @@
10
10
  #import <DatadogSDKReactNative/DatadogSDKReactNative-Swift.h>
11
11
  #endif
12
12
  #import "DdSdk.h"
13
- #import <React/RCTBridge+Private.h>
13
+ #import <React/RCTBridge.h>
14
14
 
15
15
  @implementation DdSdk
16
16
 
@@ -96,6 +96,11 @@ RCT_REMAP_METHOD(clearAllData, withResolver:(RCTPromiseResolveBlock)resolve
96
96
  return NO;
97
97
  }
98
98
 
99
+ + (void)initFromNative {
100
+ DdSdkNativeInitialization *nativeInitialization = [[DdSdkNativeInitialization alloc] init];
101
+ [nativeInitialization initializeFromNative];
102
+ }
103
+
99
104
  - (dispatch_queue_t)methodQueue {
100
105
  return [RNQueue getSharedQueue];
101
106
  }
@@ -7,6 +7,7 @@
7
7
  import Foundation
8
8
  import DatadogCore
9
9
  import DatadogInternal
10
+ import DatadogRUM
10
11
 
11
12
  /**
12
13
  A configuration object to initialize Datadog's features.
@@ -29,6 +30,14 @@ import DatadogInternal
29
30
  - customEndpoints: Custom endpoints for RUM/Logs/Trace features.
30
31
  - additionalConfig: Additional configuration parameters.
31
32
  - configurationForTelemetry: Additional configuration paramters only used for telemetry purposes.
33
+ - nativeViewTracking: Enables/Disables tracking RUM Views on the native level.
34
+ - nativeInteractionTracking: Enables/Disables tracking RUM Actions on the native level.
35
+ - verbosity: Verbosity level of the SDK.
36
+ - proxyConfig: Configuration for proxying SDK data.
37
+ - serviceName: Custom service name.
38
+ - firstPartyHosts: List of backend hosts to enable tracing with.
39
+ - bundleLogsWithRum: Correlates logs with RUM.
40
+ - bundleLogsWithTraces: Correlates logs with traces.
32
41
  */
33
42
  @objc(DdSdkConfiguration)
34
43
  public class DdSdkConfiguration: NSObject {
@@ -40,9 +49,9 @@ public class DdSdkConfiguration: NSObject {
40
49
  public var longTaskThresholdMs: Double = 0.0
41
50
  public var sampleRate: Double? = nil
42
51
  public var site: DatadogSite
43
- public var trackingConsent: NSString? = nil
52
+ public var trackingConsent: TrackingConsent
44
53
  public var telemetrySampleRate: Double? = nil
45
- public var vitalsUpdateFrequency: NSString? = nil
54
+ public var vitalsUpdateFrequency: RUM.Configuration.VitalsFrequency? = nil
46
55
  public var trackFrustrations: Bool? = nil
47
56
  public var uploadFrequency: Datadog.Configuration.UploadFrequency
48
57
  public var batchSize: Datadog.Configuration.BatchSize
@@ -50,6 +59,15 @@ public class DdSdkConfiguration: NSObject {
50
59
  public var customEndpoints: CustomEndpoints? = nil
51
60
  public var additionalConfig: NSDictionary? = nil
52
61
  public var configurationForTelemetry: ConfigurationForTelemetry? = nil
62
+ public var nativeViewTracking: Bool? = nil
63
+ public var nativeInteractionTracking: Bool? = nil
64
+ public var verbosity: NSString? = nil
65
+ public var proxyConfig: [AnyHashable: Any]? = nil
66
+ public var serviceName: NSString? = nil
67
+ public var firstPartyHosts: [String: Set<TracingHeaderType>]? = nil
68
+ public var resourceTracingSamplingRate: Double? = nil
69
+ public var bundleLogsWithRum: Bool
70
+ public var bundleLogsWithTraces: Bool
53
71
 
54
72
  public init(
55
73
  clientToken: String,
@@ -59,17 +77,26 @@ public class DdSdkConfiguration: NSObject {
59
77
  nativeLongTaskThresholdMs: Double?,
60
78
  longTaskThresholdMs: Double,
61
79
  sampleRate: Double?,
62
- site: NSString?,
63
- trackingConsent: NSString?,
80
+ site: DatadogSite,
81
+ trackingConsent: TrackingConsent,
64
82
  telemetrySampleRate: Double?,
65
- vitalsUpdateFrequency: NSString?,
83
+ vitalsUpdateFrequency: RUM.Configuration.VitalsFrequency?,
66
84
  trackFrustrations: Bool?,
67
- uploadFrequency: NSString?,
68
- batchSize: NSString?,
85
+ uploadFrequency: Datadog.Configuration.UploadFrequency,
86
+ batchSize: Datadog.Configuration.BatchSize,
69
87
  trackBackgroundEvents: Bool?,
70
88
  customEndpoints: CustomEndpoints?,
71
89
  additionalConfig: NSDictionary?,
72
- configurationForTelemetry: ConfigurationForTelemetry?
90
+ configurationForTelemetry: ConfigurationForTelemetry?,
91
+ nativeViewTracking: Bool?,
92
+ nativeInteractionTracking: Bool?,
93
+ verbosity: NSString?,
94
+ proxyConfig: [AnyHashable: Any]?,
95
+ serviceName: NSString?,
96
+ firstPartyHosts: [String: Set<TracingHeaderType>]?,
97
+ resourceTracingSamplingRate: Double?,
98
+ bundleLogsWithRum: Bool,
99
+ bundleLogsWithTraces: Bool
73
100
  ) {
74
101
  self.clientToken = clientToken
75
102
  self.env = env
@@ -78,62 +105,26 @@ public class DdSdkConfiguration: NSObject {
78
105
  self.nativeLongTaskThresholdMs = nativeLongTaskThresholdMs
79
106
  self.longTaskThresholdMs = longTaskThresholdMs
80
107
  self.sampleRate = sampleRate
81
- self.site = DdSdkConfiguration.buildSite(site: site)
108
+ self.site = site
82
109
  self.trackingConsent = trackingConsent
83
110
  self.telemetrySampleRate = telemetrySampleRate
84
111
  self.vitalsUpdateFrequency = vitalsUpdateFrequency
85
112
  self.trackFrustrations = trackFrustrations
86
- self.uploadFrequency = DdSdkConfiguration.buildUploadFrequency(uploadFrequency: uploadFrequency)
87
- self.batchSize = DdSdkConfiguration.buildBatchSize(batchSize: batchSize)
113
+ self.uploadFrequency = uploadFrequency
114
+ self.batchSize = batchSize
88
115
  self.trackBackgroundEvents = trackBackgroundEvents
89
116
  self.customEndpoints = customEndpoints
90
117
  self.additionalConfig = additionalConfig
91
118
  self.configurationForTelemetry = configurationForTelemetry
92
- }
93
-
94
- static func buildSite(site: NSString?) -> DatadogSite {
95
- switch site?.lowercased ?? "us" {
96
- case "us1", "us":
97
- return .us1
98
- case "eu1", "eu":
99
- return .eu1
100
- case "us3":
101
- return .us3
102
- case "us5":
103
- return .us5
104
- case "us1_fed", "gov":
105
- return .us1_fed
106
- case "ap1":
107
- return .ap1
108
- default:
109
- return .us1
110
- }
111
- }
112
-
113
- static func buildBatchSize(batchSize: NSString?) -> Datadog.Configuration.BatchSize {
114
- switch batchSize?.lowercased ?? "" {
115
- case "small":
116
- return .small
117
- case "medium":
118
- return .medium
119
- case "large":
120
- return .large
121
- default:
122
- return .medium
123
- }
124
- }
125
-
126
- static func buildUploadFrequency(uploadFrequency: NSString?) -> Datadog.Configuration.UploadFrequency {
127
- switch uploadFrequency?.lowercased ?? "" {
128
- case "rare":
129
- return .rare
130
- case "average":
131
- return .average
132
- case "frequent":
133
- return .frequent
134
- default:
135
- return .average
136
- }
119
+ self.nativeViewTracking = nativeViewTracking
120
+ self.nativeInteractionTracking = nativeInteractionTracking
121
+ self.verbosity = verbosity
122
+ self.proxyConfig = proxyConfig
123
+ self.serviceName = serviceName
124
+ self.firstPartyHosts = firstPartyHosts
125
+ self.resourceTracingSamplingRate = resourceTracingSamplingRate
126
+ self.bundleLogsWithRum = bundleLogsWithRum
127
+ self.bundleLogsWithTraces = bundleLogsWithTraces
137
128
  }
138
129
  }
139
130