Skip to content

Commit

Permalink
Merge pull request #1333 from DataDog/release/1.21.0
Browse files Browse the repository at this point in the history
Release `1.21.0`
  • Loading branch information
maciejburda authored Jun 27, 2023
2 parents 9cfa552 + bf60435 commit 757257b
Show file tree
Hide file tree
Showing 85 changed files with 2,259 additions and 333 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Unreleased

# 1.21.0 / 27-07-2023
- [BUGFIX] Fix TracingUUID string format. See [#1311][] (Thanks [@changm4n][])
- [BUGFIX] Rename _Datadog_Private to DatadogPrivate. See [#1331] (Thanks [@alexfanatics][])
- [IMPROVEMENT] Add context to crash when there's an active view. See [#1315][]

# 1.20.0 / 01-06-2023
- [BUGFIX] Use targetTimestamp as reference to calculate FPS for variable refresh rate displays. See [#1272][]

# 1.19.0 / 26-04-2023
Expand Down Expand Up @@ -463,6 +469,9 @@
[#1259]: https://github.com/DataDog/dd-sdk-ios/pull/1259
[#1264]: https://github.com/DataDog/dd-sdk-ios/pull/1264
[#1272]: https://github.com/DataDog/dd-sdk-ios/pull/1272
[#1311]: https://github.com/DataDog/dd-sdk-ios/pull/1311
[#1315]: https://github.com/DataDog/dd-sdk-ios/pull/1315
[#1331]: https://github.com/DataDog/dd-sdk-ios/pull/1331
[@00fa9a]: https://github.com/00FA9A
[@britton-earnin]: https://github.com/Britton-Earnin
[@hengyu]: https://github.com/Hengyu
Expand Down Expand Up @@ -490,3 +499,5 @@
[@avdlee]: https://github.com/AvdLee
[@dfed]: https://github.com/dfed
[@cltnschlosser]: https://github.com/cltnschlosser
[@alexfanatics]: https://github.com/alexfanatics
[@changm4n]: https://github.com/changm4n
8 changes: 4 additions & 4 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2270,7 +2270,7 @@
61133B9C2423979B00786299 /* Datadog */,
61133C082423983800786299 /* DatadogObjc */,
6170DC1325C1864B003AED5C /* DatadogCrashReporting */,
9E68FB52244707FD0013A8AA /* _Datadog_Private */,
9E68FB52244707FD0013A8AA /* DatadogPrivate */,
61133C122423990D00786299 /* DatadogTests */,
6170DC1425C18663003AED5C /* DatadogCrashReportingTests */,
61441C772461A204003D8BB8 /* DatadogBenchmarkTests */,
Expand Down Expand Up @@ -4125,15 +4125,15 @@
path = RUM;
sourceTree = "<group>";
};
9E68FB52244707FD0013A8AA /* _Datadog_Private */ = {
9E68FB52244707FD0013A8AA /* DatadogPrivate */ = {
isa = PBXGroup;
children = (
9E47010324471027000073A4 /* include */,
6179FFD2254ADB1100556A0B /* ObjcAppLaunchHandler.m */,
9E68FB53244707FD0013A8AA /* ObjcExceptionHandler.m */,
);
name = _Datadog_Private;
path = ../Sources/_Datadog_Private;
name = DatadogPrivate;
path = ../Sources/DatadogPrivate;
sourceTree = "<group>";
};
9EA95C182791C9BE00F6C1F3 /* WebView */ = {
Expand Down
6 changes: 3 additions & 3 deletions DatadogSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "DatadogSDK"
s.module_name = "Datadog"
s.version = "1.20.0"
s.version = "1.21.0"
s.summary = "Official Datadog Swift SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand All @@ -21,9 +21,9 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/DataDog/dd-sdk-ios.git", :tag => s.version.to_s }

s.source_files = ["Sources/Datadog/**/*.swift",
"Sources/_Datadog_Private/**/*.{h,m}",
"Sources/DatadogPrivate/**/*.{h,m}",
"Datadog/TargetSupport/Datadog/Datadog.h"]
s.public_header_files = ["Datadog/TargetSupport/Datadog/Datadog.h",
"Sources/_Datadog_Private/include/*.h"]
"Sources/DatadogPrivate/include/*.h"]

end
4 changes: 2 additions & 2 deletions DatadogSDK.podspec.src
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/DataDog/dd-sdk-ios.git", :tag => s.version.to_s }

s.source_files = ["Sources/Datadog/**/*.swift",
"Sources/_Datadog_Private/**/*.{h,m}",
"Sources/DatadogPrivate/**/*.{h,m}",
"Datadog/TargetSupport/Datadog/Datadog.h"]
s.public_header_files = ["Datadog/TargetSupport/Datadog/Datadog.h",
"Sources/_Datadog_Private/include/*.h"]
"Sources/DatadogPrivate/include/*.h"]

end
2 changes: 1 addition & 1 deletion DatadogSDKAlamofireExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "DatadogSDKAlamofireExtension"
s.module_name = "DatadogAlamofireExtension"
s.version = "1.20.0"
s.version = "1.21.0"
s.summary = "An Official Extensions of Datadog Swift SDK for Alamofire."

s.homepage = "https://www.datadoghq.com"
Expand Down
4 changes: 2 additions & 2 deletions DatadogSDKCrashReporting.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "DatadogSDKCrashReporting"
s.module_name = "DatadogCrashReporting"
s.version = "1.20.0"
s.version = "1.21.0"
s.summary = "Official Datadog Crash Reporting SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand All @@ -22,6 +22,6 @@ Pod::Spec.new do |s|
s.static_framework = true

s.source_files = "Sources/DatadogCrashReporting/**/*.swift"
s.dependency 'DatadogSDK', '1.20.0'
s.dependency 'DatadogSDK', '1.21.0'
s.dependency 'PLCrashReporter', '~> 1.11.0'
end
4 changes: 2 additions & 2 deletions DatadogSDKObjc.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "DatadogSDKObjc"
s.module_name = "DatadogObjc"
s.version = "1.20.0"
s.version = "1.21.0"
s.summary = "Official Datadog Objective-C SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand All @@ -21,5 +21,5 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/DataDog/dd-sdk-ios.git', :tag => s.version.to_s }

s.source_files = "Sources/DatadogObjc/**/*.swift"
s.dependency 'DatadogSDK', '1.20.0'
s.dependency 'DatadogSDK', '1.21.0'
end
2 changes: 1 addition & 1 deletion DatadogSDKSessionReplay.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "DatadogSDKSessionReplay"
s.module_name = "DatadogSessionReplay"
s.version = "1.20.0"
s.version = "1.21.0"
s.summary = "Official Datadog Session Replay SDK for iOS. This module is currently in beta - contact Datadog to request a try."

s.homepage = "https://www.datadoghq.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/

import XCTest
import Datadog
import TestUtilities
@testable import DatadogSessionReplay
@testable import SRHost

Expand Down Expand Up @@ -33,26 +35,20 @@ internal class SnapshotTestCase: XCTestCase {
let expectation = self.expectation(description: "Wait for wireframes")

// Set up SR recorder:
let scheduler = TestScheduler()
let processor = Processor(queue: NoQueue(), writer: Writer())
let recorder = try Recorder(
configuration: configuration,
rumContextObserver: RUMContextObserverMock(),
processor: processor,
scheduler: scheduler
)
let recorder = try Recorder(processor: processor)

// Set up wireframes interception and trigger recorder once:
// Set up wireframes interception :
var wireframes: [SRWireframe]?

processor.interceptWireframes = {
wireframes = $0
expectation.fulfill()
}

recorder.start()
scheduler.triggerOnce()
recorder.stop()
// Capture next record with mock RUM Context
recorder.captureNextRecord(
.init(privacy: configuration.privacy, applicationID: "", sessionID: "", viewID: "", viewServerTimeOffset: 0)
)

waitForExpectations(timeout: 10) // very pessimistic timeout to mitigate CI lags

Expand Down Expand Up @@ -127,28 +123,3 @@ internal class SnapshotTestCase: XCTestCase {
private struct NoQueue: Queue {
func run(_ block: @escaping () -> Void) { block() }
}

private struct RUMContextObserverMock: RUMContextObserver {
func observe(on queue: Queue, notify: @escaping (RUMContext?) -> Void) {
queue.run {
notify(RUMContext(ids: .init(applicationID: "", sessionID: "", viewID: ""), viewServerTimeOffset: 0))
}
}
}

private class TestScheduler: Scheduler {
private var operations: [() -> Void] = []

let queue: Queue = NoQueue()

func schedule(operation: @escaping () -> Void) {
operations.append(operation)
}

func start() {}
func stop() {}

func triggerOnce() {
operations.forEach { $0() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal struct RUMContext: Decodable, Equatable {
let applicationID: String
/// Current RUM session ID - standard UUID string, lowecased.
let sessionID: String
/// Current RUM view ID - standard UUID string, lowecased.
let viewID: String
/// Current RUM view ID - standard UUID string, lowecased. It can be empty when view is being loaded.
let viewID: String?
}

enum CodingKeys: String, CodingKey {
Expand Down
17 changes: 2 additions & 15 deletions DatadogSessionReplay/Sources/Drafts/SessionReplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@ public struct SessionReplay {

/// A draft interface of SR controller.
/// TODO: RUMM-2268 Design convenient public API
public protocol SessionReplayController {
/// Start recording.
func start()
public protocol SessionReplayController { }

/// Stop recording.
func stop()

/// Changes the content recording policy.
func change(privacy: SessionReplayPrivacy)
}

internal struct NOPSessionReplayController: SessionReplayController {
func start() {}
func stop() {}
func change(privacy: SessionReplayPrivacy) {}
}
internal struct NOPSessionReplayController: SessionReplayController { }
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ public struct SessionReplayConfiguration {
/// the target instance of Datadog SDK.
public var customUploadURL: URL?

/// Defines the percentage of sessions that should be tracked by Session Replay.
///
/// It should be a number between 0.0 and 100.0, where 0.0 indicates that no sessions should be tracked and 100.0 indicates that all sessions should be tracked.
/// By default, it is set to 0.0. Adjust the `samplingRate` based on the needs of your application and any resource constraints.
public var samplingRate: Float = 0.0

public init(
privacy: SessionReplayPrivacy = .maskAll,
customUploadURL: URL? = nil
customUploadURL: URL? = nil,
samplingRate: Float = 0.0
) {
self.privacy = privacy
self.customUploadURL = customUploadURL
self.samplingRate = samplingRate
}
}
38 changes: 12 additions & 26 deletions DatadogSessionReplay/Sources/Drafts/SessionReplayFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ internal class SessionReplayFeature: DatadogFeature, SessionReplayController {
let messageReceiver: FeatureMessageReceiver
let performanceOverride: PerformancePresetOverride?

// MARK: - Integrations with other features

/// Updates other Features with SR context.
private let contextPublisher: SRContextPublisher

// MARK: - Main Components

private let recorder: Recording
private let recordingCoordinator: RecordingCoordinator
private let processor: Processing
private let writer: Writing

Expand All @@ -45,42 +40,33 @@ internal class SessionReplayFeature: DatadogFeature, SessionReplayController {
writer: writer
)

let scheduler = MainThreadScheduler(interval: 0.1)
let messageReceiver = RUMContextReceiver()

let recorder = try Recorder(
configuration: configuration,
rumContextObserver: messageReceiver,
processor: processor
)
let recordingCoordinator = RecordingCoordinator(
scheduler: scheduler,
privacy: configuration.privacy,
rumContextObserver: messageReceiver,
srContextPublisher: SRContextPublisher(core: core),
recorder: recorder,
sampler: Sampler(samplingRate: configuration.samplingRate)
)

self.messageReceiver = messageReceiver
self.recorder = recorder
self.recordingCoordinator = recordingCoordinator
self.processor = processor
self.writer = writer
self.requestBuilder = RequestBuilder(customUploadURL: configuration.customUploadURL)
self.contextPublisher = SRContextPublisher(core: core)
self.performanceOverride = PerformancePresetOverride(
maxFileSize: UInt64(10).MB,
maxObjectSize: UInt64(10).MB
)
// Set initial SR context (it is configured, but not yet started):
contextPublisher.setRecordingIsPending(false)
}

func register(sessionReplayScope: FeatureScope) {
writer.startWriting(to: sessionReplayScope)
}

// MARK: - SessionReplayController

func start() {
contextPublisher.setRecordingIsPending(true)
recorder.start()
}

func stop() {
contextPublisher.setRecordingIsPending(false)
recorder.stop()
}

func change(privacy: SessionReplayPrivacy) { recorder.change(privacy: privacy) }
}
8 changes: 5 additions & 3 deletions DatadogSessionReplay/Sources/Processor/Processor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ internal class Processor: Processing {

var records: [SRRecord] = []
// Create records for describing UI:
if viewTreeSnapshot.rumContext != lastSnapshot?.rumContext {
// If RUM context has changed, new segment should be started.
if viewTreeSnapshot.context.applicationID != lastSnapshot?.context.applicationID ||
viewTreeSnapshot.context.sessionID != lastSnapshot?.context.sessionID ||
viewTreeSnapshot.context.viewID != lastSnapshot?.context.viewID {
// If RUM context ids have changed, new segment should be started.
// Segment must always start with "meta" → "focus" → "full snapshot" records.
records.append(recordsBuilder.createMetaRecord(from: viewTreeSnapshot))
records.append(recordsBuilder.createFocusRecord(from: viewTreeSnapshot))
Expand Down Expand Up @@ -111,7 +113,7 @@ internal class Processor: Processing {
if !records.isEmpty {
// Transform `[SRRecord]` to `EnrichedRecord` so we can write it to `DatadogCore` and
// later read it back (as `EnrichedRecordJSON`) for preparing upload request(s):
let enrichedRecord = EnrichedRecord(rumContext: viewTreeSnapshot.rumContext, records: records)
let enrichedRecord = EnrichedRecord(context: viewTreeSnapshot.context, records: records)
writer.write(nextRecord: enrichedRecord)
}

Expand Down
Loading

0 comments on commit 757257b

Please sign in to comment.