Skip to content

Commit

Permalink
Add all fields to iOS configuration telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
louiszawadzki committed Sep 12, 2023
1 parent 2344c52 commit 317dedb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions packages/core/ios/Sources/DdSdkImplementation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ public class DdSdkImplementation: NSObject {
}

func overrideReactNativeTelemetry(rnConfiguration: DdSdkConfiguration, core: DatadogCoreProtocol) -> Void {
// TODO: missing some keys: initializationType, reactVersion, reactNativeVersion, trackNativeErrors
let telemetry = TelemetryCore(core: core)
telemetry.configuration(
core.telemetry.configuration(
initializationType: rnConfiguration.configurationForTelemetry?.initializationType as? String,
reactNativeVersion: rnConfiguration.configurationForTelemetry?.reactNativeVersion as? String,
reactVersion: rnConfiguration.configurationForTelemetry?.reactVersion as? String,
trackCrossPlatformLongTasks: rnConfiguration.longTaskThresholdMs != 0,
trackErrors: rnConfiguration.configurationForTelemetry?.trackErrors,
trackInteractions: rnConfiguration.configurationForTelemetry?.trackInteractions,
trackLongTask: rnConfiguration.longTaskThresholdMs != 0,
trackNativeErrors: rnConfiguration.nativeLongTaskThresholdMs != 0,
trackNativeLongTasks: rnConfiguration.nativeLongTaskThresholdMs != 0,
trackNetworkRequests: rnConfiguration.configurationForTelemetry?.trackNetworkRequests
)
Expand Down
9 changes: 4 additions & 5 deletions packages/core/ios/Tests/DdSdkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -725,16 +725,15 @@ internal class DdSdkTests: XCTestCase {

DdSdkImplementation().overrideReactNativeTelemetry(rnConfiguration: configuration, core: core)

// TODO: uncomment when all telemetry is supported
// XCTAssertEqual(mockTelemetry.configuration?.initializationType, "LEGACY")
XCTAssertEqual(core.configuration?.initializationType, "LEGACY")
XCTAssertEqual(core.configuration?.trackErrors, true)
XCTAssertEqual(core.configuration?.trackInteractions, true)
XCTAssertEqual(core.configuration?.trackNetworkRequests, true)
// XCTAssertEqual(core.configuration?.trackNativeErrors, false)
XCTAssertEqual(core.configuration?.trackNativeErrors, false)
XCTAssertEqual(core.configuration?.trackNativeLongTasks, false)
XCTAssertEqual(core.configuration?.trackLongTask, true)
// XCTAssertEqual(core.configuration?.reactVersion, "18.2.0")
// XCTAssertEqual(core.configuration?.reactNativeVersion, "0.71.0")
XCTAssertEqual(core.configuration?.reactVersion, "18.2.0")
XCTAssertEqual(core.configuration?.reactNativeVersion, "0.71.0")
}

func testDropsResourceMarkedAsDropped() throws {
Expand Down

0 comments on commit 317dedb

Please sign in to comment.