Skip to content

Commit

Permalink
Merge pull request #858 from DataDog/release/1.11.0-rc1
Browse files Browse the repository at this point in the history
Merge `release/1.11.0-rc1` to `master`
  • Loading branch information
maxep authored May 19, 2022
2 parents 6198110 + 8340426 commit 6b17ccf
Show file tree
Hide file tree
Showing 101 changed files with 1,161 additions and 1,776 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

### Changes

# 1.11.0-rc1 / 18-05-2022

### Changes

* [IMPROVEMENT] Allow manually tracked resources in RUM Sessions to detect first party hosts. See [#837][]
* [IMPROVEMENT] Add tracing sampling rate. See [#851][]

# 1.11.0-beta2 / 05-04-2022

### Changes
Expand Down Expand Up @@ -357,7 +364,9 @@
[#797]: https://github.com/DataDog/dd-sdk-ios/issues/797
[#815]: https://github.com/DataDog/dd-sdk-ios/issues/815
[#830]: https://github.com/DataDog/dd-sdk-ios/issues/830
[#837]: https://github.com/DataDog/dd-sdk-ios/issues/837
[#832]: https://github.com/DataDog/dd-sdk-ios/issues/832
[#851]: https://github.com/DataDog/dd-sdk-ios/issues/851
[@00FA9A]: https://github.com/00FA9A
[@Britton-Earnin]: https://github.com/Britton-Earnin
[@Hengyu]: https://github.com/Hengyu
Expand Down
74 changes: 6 additions & 68 deletions Datadog/Datadog.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Datadog/E2ETests/Helpers/DatadogE2EHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ extension Datadog.Configuration {
rumApplicationID: E2EConfig.readRUMApplicationID(),
clientToken: E2EConfig.readClientToken(),
environment: E2EConfig.readEnv()
)
).set(sampleTelemetry: 100)
}
}
112 changes: 0 additions & 112 deletions Datadog/E2ETests/NTP/KronosE2ETests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class KronosE2ETests: E2ETests {
/// The logger sending logs on Kronos execution. These logs are available in Mobile Integrations org.
private var logger: Logger! // swiftlint:disable:this implicitly_unwrapped_optional
/// The logger sending telemetry on internal Kronos execution. These logs are available in Mobile Integrations org.
private var telemetryLogger: Logger! // swiftlint:disable:this implicitly_unwrapped_optional
private let queue = DispatchQueue(label: "kronos-monitor-queue")

override func setUp() {
Expand All @@ -19,33 +18,13 @@ class KronosE2ETests: E2ETests {
.builder
.set(loggerName: "kronos-e2e")
.build()
telemetryLogger = Logger.builder
.set(loggerName: "kronos-e2e-internal-telemetry")
.sendNetworkInfo(true)
.build()
}

override func tearDown() {
logger = nil
telemetryLogger = nil
super.tearDown()
}

/// Creates kronos monitor for checking connections to all IPs resolved from NTP pool and sending additional telemetry on their statuses.
private func createKronosMonitor() -> KronosMonitor? {
if #available(iOS 14.2, *) {
let monitor = KronosInternalMonitor(
queue: queue,
connectionMonitor: IPConnectionMonitor(queue: queue)
)
// Here we redirect IM's logger to E2E Kronos logger (`telemetryLogger`) to send data to Mobile Integrations org, not IM's org
monitor.export(to: InternalMonitor(sdkLogger: telemetryLogger))
return monitor
} else {
return nil
}
}

/// TODO: RUMM-1859: Add E2E tests for monitoring Kronos in nightly tests
func test_kronos_clock_performs_sync_using_datadog_ntp_pool() { // E2E:wip
/// The result of `KronosClock.sync()`.
Expand Down Expand Up @@ -81,7 +60,6 @@ class KronosE2ETests: E2ETests {
KronosClock.sync(
from: pool,
samples: numberOfSamplesForEachIP,
monitor: createKronosMonitor(),
first: { date, offset in // this closure could not be called if all samples to all servers resulted with failure
result.firstReceivedDate = date
result.firstReceivedOffset = offset
Expand Down Expand Up @@ -131,94 +109,4 @@ class KronosE2ETests: E2ETests {
}
}
}

/// TODO: RUMM-1859: Add E2E tests for monitoring Kronos in nightly tests
func test_kronos_ntp_client_queries_both_ipv4_and_ipv6_ips() { // E2E:wip
/// The result of `KronosNTPClient.query(pool:)`.
struct KronosNTPClientQueryResult {
/// Partial offsets received for each NTP packet sent to each resolved IP.
var receivedOffsets: [TimeInterval?] = []
/// Expected number of NTP packets to send.
var expectedNumberOfSamples = 0
/// Actual number of NTP packets that completed.
var numberOfCompletedSamples = 0
}

func performKronosNTPClientQuery() -> KronosNTPClientQueryResult {
let testTimeout: TimeInterval = 30
let monitor = createKronosMonitor()

// Given
let pool = "2.datadog.pool.ntp.org" // a pool resolved to multiple IPv4 and IPv6 addresses (e.g. 4 + 4)
let numberOfSamplesForEachIP = 2 // exchange only 2 samples with each resolved IP - to run test quick

// Each IP (each server) is asked in parallel, but samples are obtained sequentially.
// Here we compute individual sample timeout, to ensure that all (parallel) servers complete querying their (sequential) samples
// below `testTimeout` with assuming -30% margin. This should guarantee no flakiness on test timeout.
let timeoutForEachSample = (testTimeout / Double(numberOfSamplesForEachIP)) * 0.7

// When
let completionExpectation = expectation(description: "It completes all samples for all IPs")
var result = KronosNTPClientQueryResult()

monitor?.notifySyncStart(from: pool) // must be notified by hand because normally it's called from `KronosClock.sync()`

KronosNTPClient()
.query(
pool: pool,
numberOfSamples: numberOfSamplesForEachIP,
maximumServers: .max, // query all resolved IPs in the pool - to include both IPv4 and IPv6
timeout: timeoutForEachSample,
monitor: monitor
) { offset, completed, total in
result.receivedOffsets.append(offset)
result.numberOfCompletedSamples = completed
result.expectedNumberOfSamples = total

if completed == total {
monitor?.notifySyncEnd(serverOffset: offset) // must be notified by hand because normally it's called from `KronosClock.sync()`
completionExpectation.fulfill()
}
}

// Then

// We don't expect receiving timeout on `completionExpectation`. Number of samples and individual sample timeout
// is configured in a way that lets `KronosNTPClient` always fulfill the `completionExpectation`.
// In worst case, it can fulfill it, with recording only `nil` offsets, which will mean receiving timeouts
// or error on all NTP queries.
waitForExpectations(timeout: testTimeout)

return result
}

// Run test:
let result = measure(resourceName: DD.PerfSpanName.fromCurrentMethodName()) {
performKronosNTPClientQuery()
}

// Report result:
if result.receivedOffsets.contains(where: { offset in offset != nil }) {
// We consider `KronosNTPClient.query(pool:)` result to be consistent if it received at least one offset.
let receivedOffsets: [String] = result.receivedOffsets.map { offset in
if let offset = offset {
return "\(offset)"
} else {
return "(nil)"
}
}
logger.info(
"KronosNTPClient.query(pool:) completed with consistent result receiving \(result.numberOfCompletedSamples)/\(result.expectedNumberOfSamples) NTP packets",
attributes: [
"offsets_received": receivedOffsets
]
)
} else {
// Inconsistent result may correspond to flaky execution, e.g. if network was unreachable or if **all** NTP calls received timeout.
// We track inconsistent result as WARN log that will be watched by E2E monitor.
logger.warn(
"KronosNTPClient.query(pool:) completed with inconsistent result receiving \(result.numberOfCompletedSamples)/\(result.expectedNumberOfSamples) NTP packets"
)
}
}
}
7 changes: 2 additions & 5 deletions Datadog/Example/AppConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct ExampleAppConfiguration: AppConfiguration {
.set(serviceName: serviceName)
.set(batchSize: .small)
.set(uploadFrequency: .frequent)
.set(sampleTelemetry: 100)

if let customLogsURL = Environment.readCustomLogsURL() {
_ = configuration.set(customLogsEndpoint: customLogsURL)
Expand All @@ -51,11 +52,6 @@ struct ExampleAppConfiguration: AppConfiguration {
_ = configuration.set(customRUMEndpoint: customRUMURL)
}

#if DD_SDK_ENABLE_INTERNAL_MONITORING
_ = configuration
.enableInternalMonitoring(clientToken: Environment.readClientToken())
#endif

if let testScenario = testScenario {
// If the `Example` app was launched with test scenario ENV, apply the scenario configuration
testScenario.configureSDK(builder: configuration)
Expand Down Expand Up @@ -116,6 +112,7 @@ struct UITestsAppConfiguration: AppConfiguration {
.set(serviceName: "ui-tests-service-name")
.set(batchSize: .small)
.set(uploadFrequency: .frequent)
.set(tracingSamplingRate: 100)

let serverMockConfiguration = Environment.serverMockConfiguration()

Expand Down
2 changes: 1 addition & 1 deletion 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.11.0-beta2"
s.version = "1.11.0-rc1"
s.summary = "Official Datadog Swift SDK for iOS."

s.homepage = "https://www.datadoghq.com"
Expand Down
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.11.0-beta2"
s.version = "1.11.0-rc1"
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.11.0-beta2"
s.version = "1.11.0-rc1"
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.11.0-beta2'
s.dependency 'DatadogSDK', '1.11.0-rc1'
s.dependency 'PLCrashReporter', '~> 1.10.1'
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.11.0-beta2"
s.version = "1.11.0-rc1"
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.11.0-beta2'
s.dependency 'DatadogSDK', '1.11.0-rc1'
end
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ export DD_SDK_TESTING_XCCONFIG_CI

define DD_SDK_BASE_XCCONFIG
// Active compilation conditions - only enabled on local machine:\n
// - DD_SDK_ENABLE_INTERNAL_MONITORING - enables Internal Monitoring APIs\n
// - DD_SDK_ENABLE_EXPERIMENTAL_APIS - enables APIs which are not available in released version of the SDK\n
// - DD_SDK_COMPILED_FOR_TESTING - conditions the SDK code compiled for testing\n
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) DD_SDK_ENABLE_INTERNAL_MONITORING DD_SDK_ENABLE_EXPERIMENTAL_APIS DD_SDK_COMPILED_FOR_TESTING\n
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) DD_SDK_ENABLE_EXPERIMENTAL_APIS DD_SDK_COMPILED_FOR_TESTING\n
\n
// To build only active architecture for all configurations. This gives us ~10% build time gain\n
// in targets which do not use 'Debug' configuration.\n
Expand Down
18 changes: 9 additions & 9 deletions Sources/Datadog/Core/Feature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal struct FeatureStorage {
dataFormat: DataFormat,
directories: FeatureDirectories,
commonDependencies: FeaturesCommonDependencies,
internalMonitor: InternalMonitor? = nil
telemetry: Telemetry?
) {
let readWriteQueue = DispatchQueue(
label: "com.datadoghq.ios-sdk-\(featureName)-read-write",
Expand All @@ -65,13 +65,13 @@ internal struct FeatureStorage {
directory: directories.authorized,
performance: commonDependencies.performance,
dateProvider: commonDependencies.dateProvider,
internalMonitor: internalMonitor
telemetry: telemetry
)
let unauthorizedFilesOrchestrator = FilesOrchestrator(
directory: directories.unauthorized,
performance: commonDependencies.performance,
dateProvider: commonDependencies.dateProvider,
internalMonitor: internalMonitor
telemetry: telemetry
)

let dataOrchestrator = DataOrchestrator(
Expand All @@ -84,14 +84,14 @@ internal struct FeatureStorage {
dataFormat: dataFormat,
orchestrator: unauthorizedFilesOrchestrator,
encryption: commonDependencies.encryption,
internalMonitor: internalMonitor
telemetry: telemetry
)

let authorizedFileWriter = FileWriter(
dataFormat: dataFormat,
orchestrator: authorizedFilesOrchestrator,
encryption: commonDependencies.encryption,
internalMonitor: internalMonitor
telemetry: telemetry
)

let consentAwareDataWriter = ConsentAwareDataWriter(
Expand All @@ -103,7 +103,7 @@ internal struct FeatureStorage {
),
dataMigratorFactory: DataMigratorFactory(
directories: directories,
internalMonitor: internalMonitor
telemetry: telemetry
)
)

Expand All @@ -120,7 +120,7 @@ internal struct FeatureStorage {
dataFormat: dataFormat,
orchestrator: authorizedFilesOrchestrator,
encryption: commonDependencies.encryption,
internalMonitor: internalMonitor
telemetry: telemetry
)
)

Expand Down Expand Up @@ -170,7 +170,7 @@ internal struct FeatureUpload {
storage: FeatureStorage,
requestBuilder: RequestBuilder,
commonDependencies: FeaturesCommonDependencies,
internalMonitor: InternalMonitor? = nil
telemetry: Telemetry?
) {
let uploadQueue = DispatchQueue(
label: "com.datadoghq.ios-sdk-\(featureName)-upload",
Expand All @@ -195,7 +195,7 @@ internal struct FeatureUpload {
uploadConditions: uploadConditions,
delay: DataUploadDelay(performance: commonDependencies.performance),
featureName: featureName,
internalMonitor: internalMonitor
telemetry: telemetry
)
)
}
Expand Down
Loading

0 comments on commit 6b17ccf

Please sign in to comment.