@@ -136,48 +136,56 @@ public enum Datadog {
136136 /// `false` by default.
137137 public var backgroundTasksEnabled : Bool
138138
139+ /// Allows uploads on networks with "Low Data Mode" enabled.
140+ /// When set to `false`, uploads are deferred until the device is connected to an unconstrained network.
141+ ///
142+ /// Defaults to `true`.
143+ public var constrainedNetworkAccessEnabled : Bool
144+
139145 /// Creates a Datadog SDK Configuration object.
140146 ///
141147 /// - Parameters:
142- /// - clientToken: Either the RUM client token (which supports RUM, Logging and APM) or regular client token,
143- /// only for Logging and APM.
148+ /// - clientToken: Either the RUM client token (which supports RUM, Logging and APM) or regular client token,
149+ /// only for Logging and APM.
144150 ///
145- /// - env: The environment name which will be sent to Datadog. This can be used
146- /// To filter events on different environments (e.g. "staging" or "production").
151+ /// - env: The environment name which will be sent to Datadog. This can be used
152+ /// To filter events on different environments (e.g. "staging" or "production").
147153 ///
148- /// - site: Datadog site endpoint, default value is `.us1`.
154+ /// - site: Datadog site endpoint, default value is `.us1`.
149155 ///
150- /// - service: The service name associated with data send to Datadog.
151- /// Default value is set to application bundle identifier.
156+ /// - service: The service name associated with data send to Datadog.
157+ /// Default value is set to application bundle identifier.
152158 ///
153- /// - bundle: The bundle object that contains the current executable.
159+ /// - bundle: The bundle object that contains the current executable.
154160 ///
155- /// - batchSize: The preferred size of batched data uploaded to Datadog servers.
156- /// This value impacts the size and number of requests performed by the SDK.
157- /// `.medium` by default.
161+ /// - batchSize: The preferred size of batched data uploaded to Datadog servers.
162+ /// This value impacts the size and number of requests performed by the SDK.
163+ /// `.medium` by default.
158164 ///
159- /// - uploadFrequency: The preferred frequency of uploading data to Datadog servers.
160- /// This value impacts the frequency of performing network requests by the SDK.
161- /// `.average` by default.
165+ /// - uploadFrequency: The preferred frequency of uploading data to Datadog servers.
166+ /// This value impacts the frequency of performing network requests by the SDK.
167+ /// `.average` by default.
162168 ///
163- /// - proxyConfiguration: A proxy configuration attributes.
164- /// This can be used to a enable a custom proxy for uploading tracked data to Datadog's intake.
169+ /// - proxyConfiguration: A proxy configuration attributes.
170+ /// This can be used to a enable a custom proxy for uploading tracked data to Datadog's intake.
165171 ///
166- /// - encryption: Data encryption to use for on-disk data persistency by providing an object
167- /// complying with `DataEncryption` protocol.
172+ /// - encryption: Data encryption to use for on-disk data persistency by providing an object
173+ /// complying with `DataEncryption` protocol.
168174 ///
169- /// - serverDateProvider: A custom NTP synchronization interface.
170- /// By default, the Datadog SDK synchronizes with dedicated NTP pools provided by the
171- /// https://www.ntppool.org/ . Using different pools or setting a no-op `ServerDateProvider`
172- /// implementation will result in desynchronization of the SDK instance and the Datadog servers.
173- /// This can lead to significant time shift in RUM sessions or distributed traces.
174- /// - backgroundTasksEnabled: A flag that determines if `UIApplication` methods
175- /// `beginBackgroundTask(expirationHandler:)` and `endBackgroundTask:`
176- /// are used to perform background uploads.
177- /// It may extend the amount of time the app is operating in background by 30 seconds.
178- /// Tasks are normally stopped when there's nothing to upload or when encountering
179- /// any upload blocker such us no internet connection or low battery.
180- /// By default it's set to `false`.
175+ /// - serverDateProvider: A custom NTP synchronization interface.
176+ /// By default, the Datadog SDK synchronizes with dedicated NTP pools provided by the
177+ /// https://www.ntppool.org/ . Using different pools or setting a no-op `ServerDateProvider`
178+ /// implementation will result in desynchronization of the SDK instance and the Datadog servers.
179+ /// This can lead to significant time shift in RUM sessions or distributed traces.
180+ /// - backgroundTasksEnabled: A flag that determines if `UIApplication` methods
181+ /// `beginBackgroundTask(expirationHandler:)` and `endBackgroundTask:`
182+ /// are used to perform background uploads.
183+ /// It may extend the amount of time the app is operating in background by 30 seconds.
184+ /// Tasks are normally stopped when there's nothing to upload or when encountering
185+ /// any upload blocker such us no internet connection or low battery.
186+ /// By default it's set to `false`.
187+ /// - constrainedNetworkAccessEnabled: A flag that determines if uploads should be enabled on networks with "Low Data Mode" enabled.
188+ /// By default it's set to `true`.
181189 public init (
182190 clientToken: String ,
183191 env: String ,
@@ -190,7 +198,8 @@ public enum Datadog {
190198 encryption: DataEncryption ? = nil ,
191199 serverDateProvider: ServerDateProvider ? = nil ,
192200 batchProcessingLevel: BatchProcessingLevel = . medium,
193- backgroundTasksEnabled: Bool = false
201+ backgroundTasksEnabled: Bool = false ,
202+ constrainedNetworkAccessEnabled: Bool = true
194203 ) {
195204 self . clientToken = clientToken
196205 self . env = env
@@ -204,6 +213,7 @@ public enum Datadog {
204213 self . serverDateProvider = serverDateProvider ?? DatadogNTPDateProvider ( )
205214 self . batchProcessingLevel = batchProcessingLevel
206215 self . backgroundTasksEnabled = backgroundTasksEnabled
216+ self . constrainedNetworkAccessEnabled = constrainedNetworkAccessEnabled
207217 }
208218
209219 // MARK: - Internal
@@ -596,7 +606,8 @@ extension DatadogCore {
596606 batchSize: debug ? . small : configuration. batchSize,
597607 uploadFrequency: debug ? . frequent : configuration. uploadFrequency,
598608 bundleType: bundleType,
599- batchProcessingLevel: configuration. batchProcessingLevel
609+ batchProcessingLevel: configuration. batchProcessingLevel,
610+ constrainedNetworkAccessEnabled: configuration. constrainedNetworkAccessEnabled
600611 )
601612 let isRunFromExtension = bundleType == . iOSAppExtension
602613
0 commit comments