Skip to content

Commit e49a8df

Browse files
authored
Merge pull request #2157 from DataDog/release/2.22.0
Release `2.22.0`
2 parents f61d258 + ae7e789 commit e49a8df

File tree

135 files changed

+2234
-707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+2234
-707
lines changed

.gitlab-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ Publish CP podspecs (dependent):
359359
- !reference [.release-pipeline-20m-delayed-job, rules]
360360
before_script:
361361
- *export_MAKE_release_params
362-
needs: ["Publish CP podspecs (internal)"]
362+
needs: ["Build Artifacts", "Publish CP podspecs (internal)"]
363363
script:
364364
- ./tools/runner-setup.sh --xcode "$DEFAULT_XCODE"
365365
- make env-check
@@ -372,7 +372,7 @@ Publish CP podspecs (legacy):
372372
- !reference [.release-pipeline-40m-delayed-job, rules]
373373
before_script:
374374
- *export_MAKE_release_params
375-
needs: ["Publish CP podspecs (dependent)"]
375+
needs: ["Build Artifacts", "Publish CP podspecs (dependent)"]
376376
script:
377377
- ./tools/runner-setup.sh --xcode "$DEFAULT_XCODE"
378378
- make env-check

BenchmarkTests/Benchmarks/Package.swift

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func addOpenTelemetryDependency(_ version: Version) {
3737
swiftSettings: [.define("OTEL_SWIFT")]
3838
)
3939
]
40-
4140
} else {
4241
package.dependencies = [
4342
.package(url: "https://github.com/DataDog/opentelemetry-swift-packages", exact: version)

BenchmarkTests/Benchmarks/Sources/Benchmarks.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public enum Benchmarks {
7474
self.context = context
7575
}
7676
}
77-
77+
7878
/// Configure OpenTelemetry metrics meter and start measuring Memory.
7979
///
8080
/// - Parameter configuration: The Benchmark configuration.
@@ -158,7 +158,7 @@ public enum Benchmarks {
158158
endpoint: .us1,
159159
uploadCondition: { true }
160160
)
161-
161+
162162
let exporter = try! DatadogExporter(config: exporterConfiguration)
163163
let processor = SimpleSpanProcessor(spanExporter: exporter)
164164

BenchmarkTests/Benchmarks/Sources/MetricExporter.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ final class MetricExporter: OpenTelemetrySdk.MetricExporter {
7777
return .failureNotRetryable
7878
}
7979
}
80-
80+
8181
/// Transforms otel `Metric` to Datadog `serie`.
8282
///
8383
/// - Parameter metric: The otel metric
@@ -121,7 +121,7 @@ final class MetricExporter: OpenTelemetrySdk.MetricExporter {
121121
tags: Array(tags)
122122
)
123123
}
124-
124+
125125
/// Submit timeseries to the Metrics intake.
126126
///
127127
/// - Parameter series: The timeseries.

BenchmarkTests/Benchmarks/Sources/Metrics.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ extension MetricAggregator where T: BinaryFloatingPoint {
9797
internal final class Memory: MetricAggregator<Double> {
9898
/// Dispatch source object for monitoring timer events.
9999
private let timer: DispatchSourceTimer
100-
100+
101101
/// Create a `Memory` aggregator to periodically record the memory footprint on the
102102
/// provided queue.
103103
///
@@ -247,7 +247,8 @@ internal final class FPS: MetricAggregator<Int> {
247247

248248
init() { }
249249

250-
@objc func tick(link: CADisplayLink) {
250+
@objc
251+
func tick(link: CADisplayLink) {
251252
guard let fps else {
252253
return
253254
}

BenchmarkTests/Runner/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3939
run: run
4040
)
4141
)
42-
42+
4343
DatadogInternal.profiler = Profiler()
4444
case .none:
4545
break

BenchmarkTests/Runner/Scenarios/SyntheticScenario.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ internal struct SyntheticScenario: Scenario {
1919

2020
/// The underlying scenario.
2121
private let _scenario: Scenario
22-
22+
2323
/// Creates the scenario by reading the `BENCHMARK_SCENARIO` value from the
2424
/// environment variables.
2525
///
2626
/// - Parameter processInfo: The `ProcessInfo` with environment variables
2727
/// configured
2828
init?(processInfo: ProcessInfo = .processInfo) {
29-
guard
29+
guard
3030
let rawValue = processInfo.environment["BENCHMARK_SCENARIO"],
3131
let name = Name(rawValue: rawValue)
3232
else {

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Unreleased
22

3+
- [IMPROVEMENT] Add Datadog Configuration `backgroundTasksEnabled` ObjC API. See [#2148][]
4+
- [FIX] Prevent Session Replay to create two full snapshots in a row. See [#2154][]
5+
36
# 2.21.0 / 11-12-2024
47

58
- [FIX] Fix sporadic file overwrite during consent change, ensuring event data integrity. See [#2113][]
@@ -806,6 +809,8 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO
806809
[#2116]: https://github.com/DataDog/dd-sdk-ios/pull/2116
807810
[#2120]: https://github.com/DataDog/dd-sdk-ios/pull/2120
808811
[#2126]: https://github.com/DataDog/dd-sdk-ios/pull/2126
812+
[#2148]: https://github.com/DataDog/dd-sdk-ios/pull/2148
813+
[#2154]: https://github.com/DataDog/dd-sdk-ios/pull/2154
809814
[@00fa9a]: https://github.com/00FA9A
810815
[@britton-earnin]: https://github.com/Britton-Earnin
811816
[@hengyu]: https://github.com/Hengyu

Datadog/Datadog.xcodeproj/project.pbxproj

+59-21
Large diffs are not rendered by default.

Datadog/IntegrationUnitTests/CrashReporting/SendingCrashReportTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import DatadogInternal
1616
/// - recording crash context data injected from SDK core and features like RUM.
1717
private class CrashReporterMock: CrashReportingPlugin {
1818
@ReadWriteLock
19-
internal var pendingCrashReport: DDCrashReport?
19+
var pendingCrashReport: DDCrashReport?
2020
@ReadWriteLock
21-
internal var injectedContext: Data? = nil
21+
var injectedContext: Data? = nil
2222
/// Custom backtrace reporter injected to the plugin.
2323
var injectedBacktraceReporter: BacktraceReporting?
2424

Datadog/IntegrationUnitTests/Public/CoreTelemetryIntegrationTests.swift

+16-10
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CoreTelemetryIntegrationTests: XCTestCase {
5757

5858
let metric = debugEvents[1]
5959
XCTAssertEqual(metric.telemetry.message, "[Mobile Metric] Metric Name")
60-
60+
6161
let metricAttribute = try XCTUnwrap(metric.telemetry.telemetryInfo["metric.attribute"] as? Int)
6262
XCTAssertEqual(metricAttribute, 42)
6363

@@ -204,7 +204,7 @@ class CoreTelemetryIntegrationTests: XCTestCase {
204204
XCTAssertNotNil(methodCalledMetric.view?.id)
205205
XCTAssertNotNil(methodCalledMetric.action?.id)
206206
}
207-
207+
208208
func testGivenRUMEnabled_effectiveSampleRateIsComposed() throws {
209209
// Given
210210
var config = RUM.Configuration(applicationID: .mockAny())
@@ -235,21 +235,27 @@ class CoreTelemetryIntegrationTests: XCTestCase {
235235
XCTAssertGreaterThan(usageEvents.count, 0)
236236

237237
let debug = try XCTUnwrap(debugEvents.first(where: { $0.telemetry.message == "Debug Telemetry" }))
238-
XCTAssertEqual(debug.effectiveSampleRate, Int64(withNoOverflow: config.telemetrySampleRate))
238+
XCTAssertEqual(debug.effectiveSampleRate, Double(config.telemetrySampleRate))
239239

240240
let error = try XCTUnwrap(errorEvents.first(where: { $0.telemetry.message == "Error Telemetry" }))
241-
XCTAssertEqual(error.effectiveSampleRate, Int64(withNoOverflow: config.telemetrySampleRate))
241+
XCTAssertEqual(error.effectiveSampleRate, Double(config.telemetrySampleRate))
242242

243243
let mobileMetric = try XCTUnwrap(debugEvents.first(where: { $0.telemetry.message == "[Mobile Metric] Metric Name" }))
244-
XCTAssertEqual(mobileMetric.effectiveSampleRate,
245-
Int64(withNoOverflow: config.telemetrySampleRate.composed(with: metricsSampleRate)))
244+
XCTAssertEqual(
245+
mobileMetric.effectiveSampleRate,
246+
Double(config.telemetrySampleRate.composed(with: metricsSampleRate))
247+
)
246248

247249
let methodCalledMetric = try XCTUnwrap(debugEvents.first(where: { $0.telemetry.message == "[Mobile Metric] Method Called" }))
248-
XCTAssertEqual(methodCalledMetric.effectiveSampleRate,
249-
Int64(withNoOverflow: config.telemetrySampleRate.composed(with: metricsSampleRate).composed(with: headSampleRate)))
250+
XCTAssertEqual(
251+
methodCalledMetric.effectiveSampleRate,
252+
Double(config.telemetrySampleRate.composed(with: metricsSampleRate).composed(with: headSampleRate))
253+
)
250254

251255
let usage = try XCTUnwrap(usageEvents.first)
252-
XCTAssertEqual(usage.effectiveSampleRate,
253-
Int64(withNoOverflow: config.telemetrySampleRate.composed(with: metricsSampleRate)))
256+
XCTAssertEqual(
257+
usage.effectiveSampleRate,
258+
Double(config.telemetrySampleRate.composed(with: metricsSampleRate))
259+
)
254260
}
255261
}

Datadog/IntegrationUnitTests/Public/NetworkInstrumentationIntegrationTests.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ class NetworkInstrumentationIntegrationTests: XCTestCase {
110110
providerDataCount = data?.count ?? 0
111111
providerExpectation.fulfill()
112112
return [:]
113-
})
113+
}
114+
)
114115
),
115116
in: core
116117
)
@@ -157,7 +158,8 @@ class NetworkInstrumentationIntegrationTests: XCTestCase {
157158
providerInfo = (resp, data, err)
158159
providerExpectation.fulfill()
159160
return [:]
160-
})
161+
}
162+
)
161163
),
162164
in: core
163165
)

Datadog/IntegrationUnitTests/Public/WebLogIntegrationTests.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ import DatadogInternal
1515
@testable import DatadogWebViewTracking
1616

1717
class WebLogIntegrationTests: XCTestCase {
18-
// swiftlint:disable implicitly_unwrapped_optional
1918
private var core: DatadogCoreProxy! // swiftlint:disable:this implicitly_unwrapped_optional
20-
private var controller: WKUserContentControllerMock!
21-
// swiftlint:enable implicitly_unwrapped_optional
19+
private var controller: WKUserContentControllerMock! // swiftlint:disable:this implicitly_unwrapped_optional
2220

2321
override func setUp() {
2422
core = DatadogCoreProxy(
@@ -54,7 +52,7 @@ class WebLogIntegrationTests: XCTestCase {
5452
{
5553
"eventType": "log",
5654
"event": {
57-
"date" : \(1635932927012),
55+
"date" : \(1_635_932_927_012),
5856
"status": "debug",
5957
"message": "message",
6058
"session_id": "0110cab4-7471-480e-aa4e-7ce039ced355",
@@ -72,7 +70,8 @@ class WebLogIntegrationTests: XCTestCase {
7270

7371
// Then
7472
let logMatcher = try XCTUnwrap(core.waitAndReturnLogMatchers().first)
75-
try logMatcher.assertItFullyMatches(jsonString: """
73+
try logMatcher.assertItFullyMatches(
74+
jsonString: """
7675
{
7776
"date": \(1_635_932_927_012 + 123.toInt64Milliseconds),
7877
"ddtags": "version:1.1.1,env:test",
@@ -92,7 +91,7 @@ class WebLogIntegrationTests: XCTestCase {
9291
// Given
9392
let randomApplicationID: String = .mockRandom()
9493
let randomUUID: UUID = .mockRandom()
95-
94+
9695
Logs.enable(in: core)
9796
RUM.enable(with: .mockWith(applicationID: randomApplicationID) {
9897
$0.uuidGenerator = RUMUUIDGeneratorMock(uuid: randomUUID)
@@ -102,7 +101,7 @@ class WebLogIntegrationTests: XCTestCase {
102101
{
103102
"eventType": "log",
104103
"event": {
105-
"date" : \(1635932927012),
104+
"date" : \(1_635_932_927_012),
106105
"status": "debug",
107106
"message": "message",
108107
"session_id": "0110cab4-7471-480e-aa4e-7ce039ced355",
@@ -122,7 +121,8 @@ class WebLogIntegrationTests: XCTestCase {
122121
// Then
123122
let expectedUUID = randomUUID.uuidString.lowercased()
124123
let logMatcher = try XCTUnwrap(core.waitAndReturnLogMatchers().first)
125-
try logMatcher.assertItFullyMatches(jsonString: """
124+
try logMatcher.assertItFullyMatches(
125+
jsonString: """
126126
{
127127
"date": \(1_635_932_927_012 + 123.toInt64Milliseconds),
128128
"ddtags": "version:1.1.1,env:test",

Datadog/IntegrationUnitTests/RUM/SDKMetrics/RUMSessionEndedMetricIntegrationTests.swift

-4
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,9 @@ class RUMSessionEndedMetricIntegrationTests: XCTestCase {
263263
}
264264

265265
private extension RUMSessionEndedMetricIntegrationTests {
266-
267266
func rumMonitor(with sessionEndedSampleRate: SampleRate = .maxSampleRate) -> RUMMonitorProtocol {
268-
269267
let monitor = RUMMonitor.shared(in: core)
270268
monitor.dd.scopes.dependencies.sessionEndedMetric.sampleRate = sessionEndedSampleRate
271-
272269
return monitor
273270
}
274271
}
@@ -287,4 +284,3 @@ private extension TelemetryDebugEvent {
287284
return telemetry.telemetryInfo[SessionEndedMetric.Constants.rseKey] as? SessionEndedMetric.Attributes
288285
}
289286
}
290-

Datadog/IntegrationUnitTests/RUM/WatchdogTerminationsMonitoringTests.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import DatadogCrashReporting
1111
@testable import DatadogRUM
1212

1313
class WatchdogTerminationsMonitoringTests: XCTestCase {
14-
// swiftlint:disable:this implicitly_unwrapped_optional
15-
var core: DatadogCoreProxy!
16-
// swiftlint:disable:this implicitly_unwrapped_optional
14+
var core: DatadogCoreProxy! // swiftlint:disable:this implicitly_unwrapped_optional
1715
var rumConfig = RUM.Configuration(applicationID: .mockAny())
1816
let device: DeviceInfo = .init(
1917
name: .mockAny(),
@@ -107,7 +105,6 @@ class WatchdogTerminationsMonitoringTests: XCTestCase {
107105
XCTAssertEqual(watchdogCrash.error.category, .watchdogTermination)
108106
}
109107

110-
111108
/// Watchdog Termination check is done in the background, we need to wait for it to finish before we can proceed with the test
112109
/// - Parameter core: `DatadogCoreProxy` instance
113110
func waitForWatchdogTerminationCheck(core: DatadogCoreProxy) throws {

Datadog/IntegrationUnitTests/RUM/WebEventIntegrationTests.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ import TestUtilities
1414
@testable import DatadogWebViewTracking
1515

1616
class WebEventIntegrationTests: XCTestCase {
17-
// swiftlint:disable implicitly_unwrapped_optional
1817
private var core: DatadogCoreProxy! // swiftlint:disable:this implicitly_unwrapped_optional
19-
private var controller: WKUserContentControllerMock!
20-
// swiftlint:enable implicitly_unwrapped_optional
18+
private var controller: WKUserContentControllerMock! // swiftlint:disable:this implicitly_unwrapped_optional
2119

2220
override func setUp() {
2321
core = DatadogCoreProxy(
@@ -29,7 +27,7 @@ class WebEventIntegrationTests: XCTestCase {
2927
)
3028

3129
controller = WKUserContentControllerMock()
32-
30+
3331
WebViewTracking.enable(
3432
tracking: controller,
3533
hosts: [],
@@ -61,7 +59,7 @@ class WebEventIntegrationTests: XCTestCase {
6159
"application": {
6260
"id": "xxx"
6361
},
64-
"date": \(1635932927012),
62+
"date": \(1_635_932_927_012),
6563
"service": "super",
6664
"session": {
6765
"id": "0110cab4-7471-480e-aa4e-7ce039ced355",
@@ -123,7 +121,8 @@ class WebEventIntegrationTests: XCTestCase {
123121
// Then
124122
let expectedUUID = randomUUID.uuidString.lowercased()
125123
let rumMatcher = try XCTUnwrap(core.waitAndReturnRUMEventMatchers().last)
126-
try rumMatcher.assertItFullyMatches(jsonString: """
124+
try rumMatcher.assertItFullyMatches(
125+
jsonString: """
127126
{
128127
"application": {
129128
"id": "\(randomApplicationID)"
@@ -235,7 +234,8 @@ class WebEventIntegrationTests: XCTestCase {
235234
// Then
236235
let expectedUUID = randomUUID.uuidString.lowercased()
237236
let rumMatcher = try XCTUnwrap(core.waitAndReturnRUMEventMatchers().last)
238-
try rumMatcher.assertItFullyMatches(jsonString: """
237+
try rumMatcher.assertItFullyMatches(
238+
jsonString: """
239239
{
240240
"type": "telemetry",
241241
"date": \(1_712_069_357_432 + 123.toInt64Milliseconds),

Datadog/IntegrationUnitTests/SessionReplay/WebRecordIntegrationTests.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import WebKit
1111
import TestUtilities
1212
@testable import DatadogRUM
1313
@testable import DatadogWebViewTracking
14-
@_spi(Internal) @testable import DatadogSessionReplay
14+
@_spi(Internal)
15+
@testable import DatadogSessionReplay
1516

1617
class WebRecordIntegrationTests: XCTestCase {
1718
// swiftlint:disable implicitly_unwrapped_optional
@@ -60,7 +61,7 @@ class WebRecordIntegrationTests: XCTestCase {
6061
{
6162
"eventType": "record",
6263
"event": {
63-
"timestamp" : \(1635932927012),
64+
"timestamp" : \(1_635_932_927_012),
6465
"type": 2
6566
},
6667
"view": { "id": "\(randomBrowserViewID.uuidString.lowercased())" }
@@ -112,7 +113,7 @@ class WebRecordIntegrationTests: XCTestCase {
112113
{
113114
"eventType": "record",
114115
"event": {
115-
"timestamp" : \(1635932927012),
116+
"timestamp" : \(1_635_932_927_012),
116117
"type": 2
117118
},
118119
"view": { "id": "\(randomBrowserViewID.uuidString.lowercased())" }

DatadogAlamofireExtension.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "DatadogAlamofireExtension"
3-
s.version = "2.21.0"
3+
s.version = "2.22.0"
44
s.summary = "An Official Extensions of Datadog Swift SDK for Alamofire."
55
s.description = <<-DESC
66
The DatadogAlamofireExtension pod is deprecated and will no longer be maintained.

0 commit comments

Comments
 (0)