Skip to content

Commit

Permalink
Merge pull request #1951 from DataDog/hotfix/2.14.1
Browse files Browse the repository at this point in the history
Release `2.14.1`
  • Loading branch information
maciejburda authored Jul 9, 2024
2 parents 312e7c2 + ca46ce6 commit 65854b3
Show file tree
Hide file tree
Showing 43 changed files with 204 additions and 201 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Smoke Tests (iOS):
PLATFORM: "iOS Simulator"
DEVICE: "iPhone 15 Pro"
script:
- ./tools/runner-setup.sh --xcode "$XCODE" --iOS --os "$OS" # temporary, waiting for AMI
- ./tools/runner-setup.sh --xcode "$XCODE" --iOS --tvOS --os "$OS" # temporary, waiting for AMI
- make clean repo-setup ENV=ci
- make spm-build-ios
- make smoke-test-ios-all OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE"
Expand All @@ -152,7 +152,7 @@ Smoke Tests (tvOS):
PLATFORM: "tvOS Simulator"
DEVICE: "Apple TV"
script:
- ./tools/runner-setup.sh --xcode "$XCODE" --tvOS --os "$OS" # temporary, waiting for AMI
- ./tools/runner-setup.sh --xcode "$XCODE" --iOS --tvOS --os "$OS" # temporary, waiting for AMI
- make clean repo-setup ENV=ci
- make spm-build-tvos
- make smoke-test-tvos-all OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Unreleased

# 2.14.1 / 09-07-2024

- [FIX] Objc attributes interop for KMP. See [#1947][]
- [FIX] Inject backtrace reporter into Logs feature. See [#1948][]

# 2.14.0 / 04-07-2024

- [IMPROVEMENT] Use `#fileID` over `#filePath` as the default argument in errors. See [#1938][]
Expand Down Expand Up @@ -708,6 +713,8 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO
[#1925]: https://github.com/DataDog/dd-sdk-ios/pull/1925
[#1934]: https://github.com/DataDog/dd-sdk-ios/pull/1934
[#1938]: https://github.com/DataDog/dd-sdk-ios/pull/1938
[#1947]: https://github.com/DataDog/dd-sdk-ios/pull/1947
[#1948]: https://github.com/DataDog/dd-sdk-ios/pull/1948
[@00fa9a]: https://github.com/00FA9A
[@britton-earnin]: https://github.com/Britton-Earnin
[@hengyu]: https://github.com/Hengyu
Expand Down
14 changes: 0 additions & 14 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@
61133BD92423979B00786299 /* DataUploadDelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133BB32423979B00786299 /* DataUploadDelay.swift */; };
61133C00242397DA00786299 /* DatadogObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 61133BF2242397DA00786299 /* DatadogObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
61133C0E2423983800786299 /* Datadog+objc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133C092423983800786299 /* Datadog+objc.swift */; };
61133C0F2423983800786299 /* ObjcIntercompatibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133C0B2423983800786299 /* ObjcIntercompatibility.swift */; };
61133C102423983800786299 /* Logs+objc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133C0C2423983800786299 /* Logs+objc.swift */; };
61133C112423983800786299 /* DatadogConfiguration+objc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133C0D2423983800786299 /* DatadogConfiguration+objc.swift */; };
61133C482423990D00786299 /* DDDatadogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133C142423990D00786299 /* DDDatadogTests.swift */; };
Expand Down Expand Up @@ -1504,7 +1503,6 @@
D2CB6F8427C520D400A62B57 /* DatadogTestsObserverLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 6184751726EFD03400C7C9C5 /* DatadogTestsObserverLoader.m */; };
D2CB6F8527C520D400A62B57 /* PerformancePresetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61345612244756E300E7DA6B /* PerformancePresetTests.swift */; };
D2CB6F9627C5217A00A62B57 /* DatadogObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 61133BF2242397DA00786299 /* DatadogObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2CB6F9827C5217A00A62B57 /* ObjcIntercompatibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61133C0B2423983800786299 /* ObjcIntercompatibility.swift */; };
D2CB6F9927C5217A00A62B57 /* Casting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6132BF5024A49F7400D7BD17 /* Casting.swift */; };
D2CB6F9A27C5217A00A62B57 /* RUMDataModels+objc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6111C58125C0081F00F5C4A2 /* RUMDataModels+objc.swift */; };
D2CB6F9B27C5217A00A62B57 /* DDSpanContext+objc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6132BF4824A49B6800D7BD17 /* DDSpanContext+objc.swift */; };
Expand Down Expand Up @@ -2298,7 +2296,6 @@
61133BF2242397DA00786299 /* DatadogObjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DatadogObjc.h; sourceTree = "<group>"; };
61133BF3242397DA00786299 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
61133C092423983800786299 /* Datadog+objc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Datadog+objc.swift"; sourceTree = "<group>"; };
61133C0B2423983800786299 /* ObjcIntercompatibility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjcIntercompatibility.swift; sourceTree = "<group>"; };
61133C0C2423983800786299 /* Logs+objc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Logs+objc.swift"; sourceTree = "<group>"; };
61133C0D2423983800786299 /* DatadogConfiguration+objc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DatadogConfiguration+objc.swift"; sourceTree = "<group>"; };
61133C142423990D00786299 /* DDDatadogTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DDDatadogTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4222,20 +4219,11 @@
6111C58025C0080C00F5C4A2 /* RUM */,
6132BF4024A38D0600D7BD17 /* OpenTracing */,
D2A434A72A8E3FFB0028E329 /* SessionReplay */,
61133C0A2423983800786299 /* ObjcIntercompatibility */,
);
name = DatadogObjc;
path = ../DatadogObjc/Sources;
sourceTree = "<group>";
};
61133C0A2423983800786299 /* ObjcIntercompatibility */ = {
isa = PBXGroup;
children = (
61133C0B2423983800786299 /* ObjcIntercompatibility.swift */,
);
path = ObjcIntercompatibility;
sourceTree = "<group>";
};
61133C122423990D00786299 /* DatadogCoreTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -8226,7 +8214,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
61133C0F2423983800786299 /* ObjcIntercompatibility.swift in Sources */,
6132BF5124A49F7400D7BD17 /* Casting.swift in Sources */,
6111C58225C0081F00F5C4A2 /* RUMDataModels+objc.swift in Sources */,
6132BF4924A49B6800D7BD17 /* DDSpanContext+objc.swift in Sources */,
Expand Down Expand Up @@ -9484,7 +9471,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D2CB6F9827C5217A00A62B57 /* ObjcIntercompatibility.swift in Sources */,
D2CB6F9927C5217A00A62B57 /* Casting.swift in Sources */,
D2CB6F9A27C5217A00A62B57 /* RUMDataModels+objc.swift in Sources */,
D2CB6F9B27C5217A00A62B57 /* DDSpanContext+objc.swift in Sources */,
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.14.0"
s.version = "2.14.1"
s.summary = "An Official Extensions of Datadog Swift SDK for Alamofire."

s.homepage = "https://www.datadoghq.com"
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.14.0"
s.version = "2.14.1"
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.14.0"
internal let __sdkVersion = "2.14.1"
8 changes: 4 additions & 4 deletions DatadogCore/Tests/DatadogObjc/DDDatadogTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ class DDDatadogTests: XCTestCase {
XCTAssertEqual(userInfo.current.name, "name")
XCTAssertEqual(userInfo.current.email, "email")
let extraInfo = userInfo.current.extraInfo
XCTAssertEqual(extraInfo["attribute-int"] as? Int, 42)
XCTAssertEqual(extraInfo["attribute-double"] as? Double, 42.5)
XCTAssertEqual(extraInfo["attribute-string"] as? String, "string value")
XCTAssertEqual(extraInfo["foo"] as? String, "bar")
XCTAssertEqual(extraInfo["attribute-int"]?.dd.decode(), 42)
XCTAssertEqual(extraInfo["attribute-double"]?.dd.decode(), 42.5)
XCTAssertEqual(extraInfo["attribute-string"]?.dd.decode(), "string value")
XCTAssertEqual(extraInfo["foo"]?.dd.decode(), "bar")

DDDatadog.setUserInfo(id: nil, name: nil, email: nil, extraInfo: [:])
XCTAssertNil(userInfo.current.id)
Expand Down
4 changes: 2 additions & 2 deletions DatadogCore/Tests/DatadogObjc/DDRUMMonitorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DDRUMViewTests: XCTestCase {
func testItCreatesSwiftRUMView() {
let objcRUMView = DDRUMView(name: "name", attributes: ["foo": "bar"])
XCTAssertEqual(objcRUMView.swiftView.name, "name")
XCTAssertEqual(objcRUMView.swiftView.attributes["foo"] as? String, "bar")
XCTAssertEqual(objcRUMView.swiftView.attributes["foo"]?.dd.decode(), "bar")
XCTAssertEqual(objcRUMView.name, "name")
XCTAssertEqual(objcRUMView.attributes["foo"] as? String, "bar")
}
Expand Down Expand Up @@ -80,7 +80,7 @@ class DDRUMActionTests: XCTestCase {
func testItCreatesSwiftRUMAction() {
let objcRUMAction = DDRUMAction(name: "name", attributes: ["foo": "bar"])
XCTAssertEqual(objcRUMAction.swiftAction.name, "name")
XCTAssertEqual(objcRUMAction.swiftAction.attributes["foo"] as? String, "bar")
XCTAssertEqual(objcRUMAction.swiftAction.attributes["foo"]?.dd.decode(), "bar")
XCTAssertEqual(objcRUMAction.name, "name")
XCTAssertEqual(objcRUMAction.attributes["foo"] as? String, "bar")
}
Expand Down
7 changes: 4 additions & 3 deletions DatadogCore/Tests/DatadogObjc/DDTraceConfigurationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import XCTest
import TestUtilities
import DatadogInternal
@testable import DatadogTrace
@testable import DatadogObjc

Expand All @@ -26,10 +27,10 @@ class DDTraceConfigurationTests: XCTestCase {
}

func testTags() {
let random = mockRandomAttributes()
let random: [String: Any] = mockRandomAttributes()
objc.tags = random
DDAssertDictionariesEqual(objc.tags!, random)
DDAssertReflectionEqual(swift.tags!, castAttributesToSwift(random))
DDAssertJSONEqual(objc.tags!, random)
DDAssertReflectionEqual(swift.tags!, random.dd.swiftAttributes)
}

func testSetDDTraceURLSessionTracking() {
Expand Down
20 changes: 10 additions & 10 deletions DatadogCore/Tests/DatadogObjc/RUM/RUMDataModels+objcTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class RUMDataModels_objcTests: XCTestCase {

// Given
var swiftView: RUMViewEvent = .mockRandom()
swiftView.context?.contextInfo = castAttributesToSwift(expectedContextAttributes)
swiftView.usr?.usrInfo = castAttributesToSwift(expectedUserInfoAttributes)
swiftView.context?.contextInfo = expectedContextAttributes.dd.swiftAttributes
swiftView.usr?.usrInfo = expectedUserInfoAttributes.dd.swiftAttributes

let objcView = DDRUMViewEvent(swiftModel: swiftView)

Expand All @@ -37,8 +37,8 @@ class RUMDataModels_objcTests: XCTestCase {

// Given
var swiftResource: RUMResourceEvent = .mockRandom()
swiftResource.context?.contextInfo = castAttributesToSwift(expectedContextAttributes)
swiftResource.usr?.usrInfo = castAttributesToSwift(expectedUserInfoAttributes)
swiftResource.context?.contextInfo = expectedContextAttributes.dd.swiftAttributes
swiftResource.usr?.usrInfo = expectedUserInfoAttributes.dd.swiftAttributes

let objcResource = DDRUMResourceEvent(swiftModel: swiftResource)

Expand All @@ -57,8 +57,8 @@ class RUMDataModels_objcTests: XCTestCase {

// Given
var swiftAction: RUMActionEvent = .mockRandom()
swiftAction.context?.contextInfo = castAttributesToSwift(expectedContextAttributes)
swiftAction.usr?.usrInfo = castAttributesToSwift(expectedUserInfoAttributes)
swiftAction.context?.contextInfo = expectedContextAttributes.dd.swiftAttributes
swiftAction.usr?.usrInfo = expectedUserInfoAttributes.dd.swiftAttributes

let objcAction = DDRUMActionEvent(swiftModel: swiftAction)

Expand All @@ -77,8 +77,8 @@ class RUMDataModels_objcTests: XCTestCase {

// Given
var swiftError: RUMErrorEvent = .mockRandom()
swiftError.context?.contextInfo = castAttributesToSwift(expectedContextAttributes)
swiftError.usr?.usrInfo = castAttributesToSwift(expectedUserInfoAttributes)
swiftError.context?.contextInfo = expectedContextAttributes.dd.swiftAttributes
swiftError.usr?.usrInfo = expectedUserInfoAttributes.dd.swiftAttributes

let objcError = DDRUMErrorEvent(swiftModel: swiftError)

Expand All @@ -97,8 +97,8 @@ class RUMDataModels_objcTests: XCTestCase {

// Given
var swiftLongTask: RUMLongTaskEvent = .mockRandom()
swiftLongTask.context?.contextInfo = castAttributesToSwift(expectedContextAttributes)
swiftLongTask.usr?.usrInfo = castAttributesToSwift(expectedUserInfoAttributes)
swiftLongTask.context?.contextInfo = expectedContextAttributes.dd.swiftAttributes
swiftLongTask.usr?.usrInfo = expectedUserInfoAttributes.dd.swiftAttributes

let objcLongTask = DDRUMLongTaskEvent(swiftModel: swiftLongTask)

Expand Down
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.14.0"
s.version = "2.14.1"
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.14.0"
s.version = "2.14.1"
s.summary = "Datadog Internal Package. This module is not for public use."

s.homepage = "https://www.datadoghq.com"
Expand Down
36 changes: 36 additions & 0 deletions DatadogInternal/Sources/Attributes/Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,39 @@ public struct LaunchArguments {
/// For example, if this flag is present it can use no sampling.
public static let Debug = "DD_DEBUG"
}

extension DatadogExtension where ExtendedType == [String: Any] {
public var swiftAttributes: [String: Encodable] {
type.mapValues { AnyEncodable($0) }
}
}

extension DatadogExtension where ExtendedType == [String: Encodable] {
public var objCAttributes: [String: Any] {
type.compactMapValues { ($0 as? AnyEncodable)?.value }
}
}

extension AttributeValue {
/// Instance Datadog extension point.
///
/// `AttributeValue` aka `Encodable` is a protocol and cannot be extended
/// with conformance to`DatadogExtension`, so we need to define the `dd`
/// endpoint.
public var dd: DatadogExtension<AttributeValue> {
DatadogExtension(self)
}
}

extension DatadogExtension where ExtendedType == AttributeValue {
public func decode<T>(_: T.Type = T.self) -> T? {
switch type {
case let encodable as _AnyEncodable:
return encodable.value as? T
case let val as T:
return val
default:
return nil
}
}
}
3 changes: 3 additions & 0 deletions DatadogInternal/Sources/Extensions/DatadogExtended.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ extension DatadogExtended {
set {}
}
}

extension Array: DatadogExtended {}
extension Dictionary: DatadogExtended {}
2 changes: 1 addition & 1 deletion DatadogLogs.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DatadogLogs"
s.version = "2.14.0"
s.version = "2.14.1"
s.summary = "Datadog Logs Module."

s.homepage = "https://www.datadoghq.com"
Expand Down
3 changes: 2 additions & 1 deletion DatadogLogs/Sources/Logs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public enum Logs {
logEventMapper: logEventMapper,
dateProvider: configuration.dateProvider,
customIntakeURL: configuration.customEndpoint,
telemetry: core.telemetry
telemetry: core.telemetry,
backtraceReporter: core.backtraceReporter
)

do {
Expand Down
6 changes: 3 additions & 3 deletions DatadogLogs/Sources/RemoteLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ internal final class RemoteLogger: LoggerProtocol {
// capture current tags and attributes before opening the write event context
let tags = self.tags
var logAttributes = attributes
let isCrash = logAttributes?.removeValue(forKey: CrossPlatformAttributes.errorLogIsCrash) as? Bool ?? false
let errorFingerprint = logAttributes?.removeValue(forKey: Logs.Attributes.errorFingerprint) as? String
let addBinaryImages = logAttributes?.removeValue(forKey: CrossPlatformAttributes.includeBinaryImages) as? Bool ?? false
let isCrash = logAttributes?.removeValue(forKey: CrossPlatformAttributes.errorLogIsCrash)?.dd.decode() ?? false
let errorFingerprint: String? = logAttributes?.removeValue(forKey: Logs.Attributes.errorFingerprint)?.dd.decode()
let addBinaryImages = logAttributes?.removeValue(forKey: CrossPlatformAttributes.includeBinaryImages)?.dd.decode() ?? false
let userAttributes = self.attributes
.merging(logAttributes ?? [:]) { $1 } // prefer message attributes
let combinedAttributes: [String: any Encodable]
Expand Down
12 changes: 12 additions & 0 deletions DatadogLogs/Tests/LogsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ class LogsTests: XCTestCase {
XCTAssertTrue(Logs._internal.isEnabled(in: core))
}

func testInitializedWithBacktraceReporter() throws {
// Given
let core = FeatureRegistrationCoreMock()

// When
Logs.enable(in: core)

// Then
let logs = try XCTUnwrap(core.get(feature: LogsFeature.self))
XCTAssertNotNil(logs.backtraceReporter)
}

func testConfigurationOverrides() throws {
// Given
let customEndpoint: URL = .mockRandom()
Expand Down
2 changes: 1 addition & 1 deletion DatadogObjc.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DatadogObjc"
s.version = "2.14.0"
s.version = "2.14.1"
s.summary = "Official Datadog Objective-C SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand Down
4 changes: 2 additions & 2 deletions DatadogObjc/Sources/Datadog+objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public class DDDatadog: NSObject {

@objc
public static func setUserInfo(id: String? = nil, name: String? = nil, email: String? = nil, extraInfo: [String: Any] = [:]) {
Datadog.setUserInfo(id: id, name: name, email: email, extraInfo: castAttributesToSwift(extraInfo))
Datadog.setUserInfo(id: id, name: name, email: email, extraInfo: extraInfo.dd.swiftAttributes)
}

@objc
public static func addUserExtraInfo(_ extraInfo: [String: Any]) {
Datadog.addUserExtraInfo(castAttributesToSwift(extraInfo))
Datadog.addUserExtraInfo(extraInfo.dd.swiftAttributes)
}

@objc
Expand Down
Loading

0 comments on commit 65854b3

Please sign in to comment.