Skip to content

Commit

Permalink
Merge pull request #2061 from DataDog/release/2.18.0
Browse files Browse the repository at this point in the history
Release 2.18.0
  • Loading branch information
maciejburda authored Sep 25, 2024
2 parents e9d153d + 00aee79 commit e67af5e
Show file tree
Hide file tree
Showing 173 changed files with 1,485 additions and 395 deletions.
12 changes: 12 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ stages:
- dogfood
- release-build
- release-publish
- post

variables:
MAIN_BRANCH: "master"
Expand Down Expand Up @@ -401,3 +402,14 @@ Publish CP podspecs (legacy):
- make env-check
- make clean
- make release-publish-legacy-podspecs

# ┌────────────────┐
# │ Notifications: │
# └────────────────┘

# This job runs at the end of every successful pipeline.
# It syncs the GitLab pipeline status with GitHub status checks.
Sync GH Checks:
stage: post
script:
- echo "All good"
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<EnvironmentVariable
key = "BENCHMARK_RUN"
value = "instrumented"
isEnabled = "YES">
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "BENCHMARK_SCENARIO"
Expand Down
7 changes: 3 additions & 4 deletions BenchmarkTests/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
guard
let scenario = SyntheticScenario(),
let run = SyntheticRun()
else {
guard let scenario = SyntheticScenario() else {
return false
}

let run = SyntheticRun()
let applicationInfo = try! AppInfo() // crash if info are missing or malformed

switch run {
Expand All @@ -43,6 +41,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
)

DatadogInternal.profiler = Profiler()
case .none:
break
}

Expand Down
15 changes: 6 additions & 9 deletions BenchmarkTests/Runner/Scenarios/SyntheticScenario.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,17 @@ internal enum SyntheticRun: String {
case baseline
case instrumented
case profiling
case none

/// Creates the scenario by reading the `BENCHMARK_RUN` value from the
/// environment variables.
///
/// - Parameter processInfo: The `ProcessInfo` with environment variables
/// configured
init?(processInfo: ProcessInfo = .processInfo) {
guard
let rawValue = processInfo.environment["BENCHMARK_RUN"],
let run = Self(rawValue: rawValue)
else {
return nil
}

self = run
init(processInfo: ProcessInfo = .processInfo) {
self = processInfo
.environment["BENCHMARK_RUN"]
.flatMap(Self.init(rawValue:))
?? .none
}
}
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Unreleased

# 2.18.0 / 25-09-2024
- [IMPROVEMENT] Add overwrite required (breaking) param to addViewLoadingTime & usage telemetry. See [#2040][]
- [FEATURE] Prevent "show password" features from revealing sensitive texts in Session Replay. See [#2050][]
- [FEATURE] Add Fine-Grained Masking configuration options to Session Replay. See [#2043][]

# 2.17.0 / 11-09-2024

- [FEATURE] Add support for view loading API (addViewLoadingTime). See [#2026][]
- [FEATURE] Add support for view loading experimental API (addViewLoadingTime). See [#2026][]
- [IMPROVEMENT] Drop support for deprecated cocoapod specs. See [#1998][]
- [FIX] Propagate global Tracer tags to OpenTelemetry span attributes. See [#2000][]
- [FEATURE] Add Logs event mapper to ObjC API. See [#2008][]
Expand Down Expand Up @@ -764,6 +771,9 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO
[#1998]: https://github.com/DataDog/dd-sdk-ios/pull/1998
[#1966]: https://github.com/DataDog/dd-sdk-ios/pull/1966
[#2026]: https://github.com/DataDog/dd-sdk-ios/pull/2026
[#2043]: https://github.com/DataDog/dd-sdk-ios/pull/2043
[#2040]: https://github.com/DataDog/dd-sdk-ios/pull/2040
[#2050]: https://github.com/DataDog/dd-sdk-ios/pull/2050
[@00fa9a]: https://github.com/00FA9A
[@britton-earnin]: https://github.com/Britton-Earnin
[@hengyu]: https://github.com/Hengyu
Expand Down
8 changes: 4 additions & 4 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
61054FC02A6EE1BA00AAA894 /* UITextViewRecorderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F782A6EE1BA00AAA894 /* UITextViewRecorderTests.swift */; };
61054FC12A6EE1BA00AAA894 /* ViewTreeRecorderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F792A6EE1BA00AAA894 /* ViewTreeRecorderTests.swift */; };
61054FC22A6EE1BA00AAA894 /* ViewTreeSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F7A2A6EE1BA00AAA894 /* ViewTreeSnapshotTests.swift */; };
61054FC32A6EE1BA00AAA894 /* PrivacyLevelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F7B2A6EE1BA00AAA894 /* PrivacyLevelTests.swift */; };
61054FC32A6EE1BA00AAA894 /* TextAndInputPrivacyLevelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F7B2A6EE1BA00AAA894 /* TextAndInputPrivacyLevelTests.swift */; };
61054FC42A6EE1BA00AAA894 /* RecorderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F7C2A6EE1BA00AAA894 /* RecorderTests.swift */; };
61054FC52A6EE1BA00AAA894 /* UIKitMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F7E2A6EE1BA00AAA894 /* UIKitMocks.swift */; };
61054FC62A6EE1BA00AAA894 /* CoreGraphicsMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61054F7F2A6EE1BA00AAA894 /* CoreGraphicsMocks.swift */; };
Expand Down Expand Up @@ -2284,7 +2284,7 @@
61054F782A6EE1BA00AAA894 /* UITextViewRecorderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITextViewRecorderTests.swift; sourceTree = "<group>"; };
61054F792A6EE1BA00AAA894 /* ViewTreeRecorderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewTreeRecorderTests.swift; sourceTree = "<group>"; };
61054F7A2A6EE1BA00AAA894 /* ViewTreeSnapshotTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewTreeSnapshotTests.swift; sourceTree = "<group>"; };
61054F7B2A6EE1BA00AAA894 /* PrivacyLevelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivacyLevelTests.swift; sourceTree = "<group>"; };
61054F7B2A6EE1BA00AAA894 /* TextAndInputPrivacyLevelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAndInputPrivacyLevelTests.swift; sourceTree = "<group>"; };
61054F7C2A6EE1BA00AAA894 /* RecorderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecorderTests.swift; sourceTree = "<group>"; };
61054F7E2A6EE1BA00AAA894 /* UIKitMocks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKitMocks.swift; sourceTree = "<group>"; };
61054F7F2A6EE1BA00AAA894 /* CoreGraphicsMocks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreGraphicsMocks.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3890,7 +3890,7 @@
61054F5B2A6EE1BA00AAA894 /* Utilties */,
61054F602A6EE1BA00AAA894 /* TouchSnapshotProducer */,
61054F642A6EE1BA00AAA894 /* ViewTreeSnapshotProducer */,
61054F7B2A6EE1BA00AAA894 /* PrivacyLevelTests.swift */,
61054F7B2A6EE1BA00AAA894 /* TextAndInputPrivacyLevelTests.swift */,
61054F7C2A6EE1BA00AAA894 /* RecorderTests.swift */,
);
path = Recorder;
Expand Down Expand Up @@ -8416,7 +8416,7 @@
96E414162C2AF5C1005A6119 /* UIProgressViewRecorderTests.swift in Sources */,
61054FB32A6EE1BA00AAA894 /* UITextFieldRecorderTests.swift in Sources */,
61054FCD2A6EE1BA00AAA894 /* SnapshotProducerMocks.swift in Sources */,
61054FC32A6EE1BA00AAA894 /* PrivacyLevelTests.swift in Sources */,
61054FC32A6EE1BA00AAA894 /* TextAndInputPrivacyLevelTests.swift in Sources */,
61054FA82A6EE1BA00AAA894 /* RecordingCoordinatorTests.swift in Sources */,
61054FAD2A6EE1BA00AAA894 /* WindowTouchSnapshotProducerTests.swift in Sources */,
61054FD52A6EE1BA00AAA894 /* XCTAssertRectsEqual.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Datadog/Example/Debugging/DebugRUMViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class DebugRUMViewController: UIViewController {
)
case "usage":
telemetry.send(
telemetry: .usage(.setTrackingConsent(.granted))
telemetry: .usage(.init(event: .setTrackingConsent(.granted), sampleRate: 100))
)
default:
break
Expand Down
2 changes: 1 addition & 1 deletion DatadogAlamofireExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DatadogAlamofireExtension"
s.version = "2.17.0"
s.version = "2.18.0"
s.summary = "An Official Extensions of Datadog Swift SDK for Alamofire."
s.description = <<-DESC
The DatadogAlamofireExtension pod is deprecated and will no longer be maintained.
Expand Down
2 changes: 1 addition & 1 deletion DatadogCore.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DatadogCore"
s.version = "2.17.0"
s.version = "2.18.0"
s.summary = "Official Datadog Swift SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand Down
2 changes: 1 addition & 1 deletion DatadogCore/Sources/Versioning.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// GENERATED FILE: Do not edit directly

internal let __sdkVersion = "2.17.0"
internal let __sdkVersion = "2.18.0"
126 changes: 124 additions & 2 deletions DatadogCore/Tests/DatadogObjc/DDSessionReplayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,88 @@ class DDSessionReplayTests: XCTestCase {
// Then
XCTAssertEqual(config._swift.replaySampleRate, sampleRate)
XCTAssertEqual(config._swift.defaultPrivacyLevel, .mask)
XCTAssertEqual(config._swift.textAndInputPrivacyLevel, .maskAll)
XCTAssertEqual(config._swift.imagePrivacyLevel, .maskAll)
XCTAssertEqual(config._swift.touchPrivacyLevel, .hide)
XCTAssertNil(config._swift.customEndpoint)
}

func testConfigurationWithNewApi() {
// Given
let textAndInputPrivacy: DDTextAndInputPrivacyLevel = [.maskAll, .maskAllInputs, .maskSensitiveInputs].randomElement()!
let touchPrivacy: DDTouchPrivacyLevel = [.show, .hide].randomElement()!
let imagePrivacy: DDImagePrivacyLevel = [.maskAll, .maskNonBundledOnly, .maskNone].randomElement()!
let sampleRate: Float = .mockRandom(min: 0, max: 100)

// When
let config = DDSessionReplayConfiguration(
replaySampleRate: sampleRate,
textAndInputPrivacyLevel: textAndInputPrivacy,
imagePrivacyLevel: imagePrivacy,
touchPrivacyLevel: touchPrivacy
)

// Then
XCTAssertEqual(config._swift.replaySampleRate, sampleRate)
XCTAssertEqual(config._swift.textAndInputPrivacyLevel, textAndInputPrivacy._swift)
XCTAssertEqual(config._swift.imagePrivacyLevel, imagePrivacy._swift)
XCTAssertEqual(config._swift.touchPrivacyLevel, touchPrivacy._swift)
XCTAssertNil(config._swift.customEndpoint)
}

func testConfigurationOverrides() {
// Given
let sampleRate: Float = .mockRandom(min: 0, max: 100)
let privacy: DDSessionReplayConfigurationPrivacyLevel = [.allow, .mask, .maskUserInput].randomElement()!
let textAndInputPrivacy: DDTextAndInputPrivacyLevel = [.maskAll, .maskAllInputs, .maskSensitiveInputs].randomElement()!
let imagePrivacy: DDImagePrivacyLevel = [.maskAll, .maskNonBundledOnly, .maskNone].randomElement()!
let touchPrivacy: DDTouchPrivacyLevel = [.show, .hide].randomElement()!
let url: URL = .mockRandom()

// When
let config = DDSessionReplayConfiguration(replaySampleRate: 100)
config.replaySampleRate = sampleRate
config.defaultPrivacyLevel = privacy
config.textAndInputPrivacyLevel = textAndInputPrivacy
config.imagePrivacyLevel = imagePrivacy
config.touchPrivacyLevel = touchPrivacy
config.customEndpoint = url

// Then
XCTAssertEqual(config._swift.replaySampleRate, sampleRate)
XCTAssertEqual(config._swift.defaultPrivacyLevel, privacy._swift)
XCTAssertEqual(config._swift.textAndInputPrivacyLevel, textAndInputPrivacy._swift)
XCTAssertEqual(config._swift.imagePrivacyLevel, imagePrivacy._swift)
XCTAssertEqual(config._swift.touchPrivacyLevel, touchPrivacy._swift)
XCTAssertEqual(config._swift.customEndpoint, url)
}

func testConfigurationOverridesWithNewApi() {
// Given
let sampleRate: Float = .mockRandom(min: 0, max: 100)
let textAndInputPrivacy: DDTextAndInputPrivacyLevel = [.maskAll, .maskAllInputs, .maskSensitiveInputs].randomElement()!
let imagePrivacy: DDImagePrivacyLevel = [.maskAll, .maskNonBundledOnly, .maskNone].randomElement()!
let touchPrivacy: DDTouchPrivacyLevel = [.show, .hide].randomElement()!
let url: URL = .mockRandom()

// When
let config = DDSessionReplayConfiguration(
replaySampleRate: 100,
textAndInputPrivacyLevel: .maskAll,
imagePrivacyLevel: .maskAll,
touchPrivacyLevel: .hide
)
config.replaySampleRate = sampleRate
config.textAndInputPrivacyLevel = textAndInputPrivacy
config.imagePrivacyLevel = imagePrivacy
config.touchPrivacyLevel = touchPrivacy
config.customEndpoint = url

// Then
XCTAssertEqual(config._swift.replaySampleRate, sampleRate)
XCTAssertEqual(config._swift.textAndInputPrivacyLevel, textAndInputPrivacy._swift)
XCTAssertEqual(config._swift.imagePrivacyLevel, imagePrivacy._swift)
XCTAssertEqual(config._swift.touchPrivacyLevel, touchPrivacy._swift)
XCTAssertEqual(config._swift.customEndpoint, url)
}

Expand All @@ -54,6 +118,34 @@ class DDSessionReplayTests: XCTestCase {
XCTAssertEqual(DDSessionReplayConfigurationPrivacyLevel(.maskUserInput), .maskUserInput)
}

func testTextAndInputPrivacyLevelsInterop() {
XCTAssertEqual(DDTextAndInputPrivacyLevel.maskAll._swift, .maskAll)
XCTAssertEqual(DDTextAndInputPrivacyLevel.maskAllInputs._swift, .maskAllInputs)
XCTAssertEqual(DDTextAndInputPrivacyLevel.maskSensitiveInputs._swift, .maskSensitiveInputs)

XCTAssertEqual(DDTextAndInputPrivacyLevel(.maskAll), .maskAll)
XCTAssertEqual(DDTextAndInputPrivacyLevel(.maskAllInputs), .maskAllInputs)
XCTAssertEqual(DDTextAndInputPrivacyLevel(.maskSensitiveInputs), .maskSensitiveInputs)
}

func testImagePrivacyLevelsInterop() {
XCTAssertEqual(DDImagePrivacyLevel.maskAll._swift, .maskAll)
XCTAssertEqual(DDImagePrivacyLevel.maskNonBundledOnly._swift, .maskNonBundledOnly)
XCTAssertEqual(DDImagePrivacyLevel.maskNone._swift, .maskNone)

XCTAssertEqual(DDImagePrivacyLevel(.maskAll), .maskAll)
XCTAssertEqual(DDImagePrivacyLevel(.maskNonBundledOnly), .maskNonBundledOnly)
XCTAssertEqual(DDImagePrivacyLevel(.maskNone), .maskNone)
}

func testTouchPrivacyLevelsInterop() {
XCTAssertEqual(DDTouchPrivacyLevel.show._swift, .show)
XCTAssertEqual(DDTouchPrivacyLevel.hide._swift, .hide)

XCTAssertEqual(DDTouchPrivacyLevel(.show), .show)
XCTAssertEqual(DDTouchPrivacyLevel(.hide), .hide)
}

func testWhenEnabled() throws {
// Given
let core = FeatureRegistrationCoreMock()
Expand All @@ -69,9 +161,39 @@ class DDSessionReplayTests: XCTestCase {
let sr = try XCTUnwrap(core.get(feature: SessionReplayFeature.self))
let requestBuilder = try XCTUnwrap(sr.requestBuilder as? DatadogSessionReplay.SegmentRequestBuilder)
XCTAssertEqual(sr.recordingCoordinator.sampler.samplingRate, 42)
XCTAssertEqual(sr.recordingCoordinator.privacy, .mask)
XCTAssertEqual(sr.recordingCoordinator.textAndInputPrivacy, .maskAll)
XCTAssertEqual(sr.recordingCoordinator.imagePrivacy, .maskAll)
XCTAssertEqual(sr.recordingCoordinator.touchPrivacy, .hide)
XCTAssertNil(requestBuilder.customUploadURL)
}
}

func testWhenEnabledWithNewApi() throws {
// Given
let core = FeatureRegistrationCoreMock()
CoreRegistry.register(default: core)
let textAndInputPrivacy: DDTextAndInputPrivacyLevel = [.maskAll, .maskAllInputs, .maskSensitiveInputs].randomElement()!
let imagePrivacy: DDImagePrivacyLevel = [.maskAll, .maskNonBundledOnly, .maskNone].randomElement()!
let touchPrivacy: DDTouchPrivacyLevel = [.show, .hide].randomElement()!
defer { CoreRegistry.unregisterDefault() }

let config = DDSessionReplayConfiguration(
replaySampleRate: 42,
textAndInputPrivacyLevel: textAndInputPrivacy,
imagePrivacyLevel: imagePrivacy,
touchPrivacyLevel: touchPrivacy
)

// When
DDSessionReplay.enable(with: config)

// Then
let sr = try XCTUnwrap(core.get(feature: SessionReplayFeature.self))
let requestBuilder = try XCTUnwrap(sr.requestBuilder as? DatadogSessionReplay.SegmentRequestBuilder)
XCTAssertEqual(sr.recordingCoordinator.sampler.samplingRate, 42)
XCTAssertEqual(sr.recordingCoordinator.textAndInputPrivacy, textAndInputPrivacy._swift)
XCTAssertEqual(sr.recordingCoordinator.imagePrivacy, imagePrivacy._swift)
XCTAssertEqual(sr.recordingCoordinator.touchPrivacy, touchPrivacy._swift)
XCTAssertNil(requestBuilder.customUploadURL)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ - (void)testConfiguration {
[DDSessionReplay enableWith:configuration];
}

- (void)testConfigurationWithNewApi {
DDSessionReplayConfiguration *configuration = [[DDSessionReplayConfiguration alloc] initWithReplaySampleRate:100
textAndInputPrivacyLevel:DDTextAndInputPrivacyLevelMaskAll
imagePrivacyLevel:DDImagePrivacyLevelMaskNone
touchPrivacyLevel:DDTouchPrivacyLevelShow];
configuration.customEndpoint = [NSURL new];

[DDSessionReplay enableWith:configuration];
}

@end
2 changes: 1 addition & 1 deletion DatadogCrashReporting.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DatadogCrashReporting"
s.version = "2.17.0"
s.version = "2.18.0"
s.summary = "Official Datadog Crash Reporting SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand Down
2 changes: 1 addition & 1 deletion DatadogInternal.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DatadogInternal"
s.version = "2.17.0"
s.version = "2.18.0"
s.summary = "Datadog Internal Package. This module is not for public use."

s.homepage = "https://www.datadoghq.com"
Expand Down
Loading

0 comments on commit e67af5e

Please sign in to comment.