Skip to content

Commit

Permalink
Fixed latest SDK breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-saia-datadog committed Jun 28, 2024
1 parent fd4ca75 commit 5faa876
Show file tree
Hide file tree
Showing 23 changed files with 272 additions and 277 deletions.
60 changes: 32 additions & 28 deletions example-new-architecture/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
PODS:
- boost (1.83.0)
- CocoaAsyncSocket (7.6.5)
- DatadogCore (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogCrashReporting (2.7.1):
- DatadogInternal (= 2.7.1)
- PLCrashReporter (~> 1.11.1)
- DatadogInternal (2.7.1)
- DatadogLogs (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogRUM (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogCore (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogCrashReporting (2.13.0):
- DatadogInternal (= 2.13.0)
- PLCrashReporter (~> 1.11.2)
- DatadogInternal (2.13.0)
- DatadogLogs (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogRUM (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogSDKReactNative (2.3.6):
- DatadogCore (~> 2.7.1)
- DatadogCrashReporting (~> 2.7.1)
- DatadogLogs (~> 2.7.1)
- DatadogRUM (~> 2.7.1)
- DatadogTrace (~> 2.7.1)
- DatadogWebViewTracking (~> 2.7.1)
- DatadogCore (~> 2.13.0)
- DatadogCrashReporting (~> 2.13.0)
- DatadogLogs (~> 2.13.0)
- DatadogRUM (~> 2.13.0)
- DatadogTrace (~> 2.13.0)
- DatadogWebViewTracking (~> 2.13.0)
- glog
- hermes-engine
- RCT-Folly (= 2022.05.16.00)
Expand All @@ -36,10 +36,11 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DatadogTrace (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogWebViewTracking (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogTrace (2.13.0):
- DatadogInternal (= 2.13.0)
- OpenTelemetrySwiftApi (= 1.6.0)
- DatadogWebViewTracking (2.13.0):
- DatadogInternal (= 2.13.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.73.6)
- Flipper (0.201.0):
Expand Down Expand Up @@ -105,6 +106,7 @@ PODS:
- hermes-engine/Pre-built (0.73.6)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
- OpenTelemetrySwiftApi (1.6.0)
- PLCrashReporter (1.11.2)
- RCT-Folly (2022.05.16.00):
- boost
Expand Down Expand Up @@ -1295,6 +1297,7 @@ SPEC REPOS:
- fmt
- libevent
- OpenSSL-Universal
- OpenTelemetrySwiftApi
- PLCrashReporter
- SocketRocket

Expand Down Expand Up @@ -1408,14 +1411,14 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DatadogCore: 4a4cdf7beca3aa12b7095bebd926acea1a865a99
DatadogCrashReporting: f8b4ea638acaf58b68bbc51cb62a2d876f763241
DatadogInternal: b9217da25018284c087a2ed4b9bb3b0f26c767c0
DatadogLogs: 3b4132eefa67f196bb3ab2d603c1a2acd1292615
DatadogRUM: 8845815ba89f5ab8ceee765ee268f7de36f3e35d
DatadogSDKReactNative: 65a87cf33b9dde71b730ccb98713fa8709dbaf67
DatadogTrace: a63da746c609bd4c683bca61a94429889e33b11e
DatadogWebViewTracking: 713f862ddd89173e0a3f5342cefa23def40f0f48
DatadogCore: 9390fd07a89f57a23983de66fbec5bf3c2034f7a
DatadogCrashReporting: 79b67b790df186524fc76d45c0b8ce751c36ef41
DatadogInternal: 61ab12516d2faad79e35973534c29a72b0d44382
DatadogLogs: 912d7b3fd3d75df856de060082b785f92f7cefe6
DatadogRUM: b5629479d4553d80f2a57ef9db44ce37e56f8b97
DatadogSDKReactNative: 2146426b86f121fbe03418c0576a77aaeaf2cc47
DatadogTrace: 1f40893de00c9a9b87be46fa7016fa0d50c4e66b
DatadogWebViewTracking: d1e2e755bb2ed7c18208471b9cbcfc7cb920aa45
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
FBLazyVector: f64d1e2ea739b4d8f7e4740cde18089cd97fe864
Flipper: c7a0093234c4bdd456e363f2f19b2e4b27652d44
Expand All @@ -1431,6 +1434,7 @@ SPEC CHECKSUMS:
hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
OpenTelemetrySwiftApi: 657da8071c2908caecce11548e006f779924ff9c
PLCrashReporter: 499c53b0104f95c302d94fd723ebb03c56d9bac8
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: ca1d7414aba0b27efcfa2ccd37637edb1ab77d96
Expand Down
84 changes: 44 additions & 40 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
PODS:
- boost (1.83.0)
- DatadogCore (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogCrashReporting (2.7.1):
- DatadogInternal (= 2.7.1)
- PLCrashReporter (~> 1.11.1)
- DatadogInternal (2.7.1)
- DatadogLogs (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogRUM (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogCore (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogCrashReporting (2.13.0):
- DatadogInternal (= 2.13.0)
- PLCrashReporter (~> 1.11.2)
- DatadogInternal (2.13.0)
- DatadogLogs (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogRUM (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogSDKReactNative (2.3.6):
- DatadogCore (~> 2.7.1)
- DatadogCrashReporting (~> 2.7.1)
- DatadogLogs (~> 2.7.1)
- DatadogRUM (~> 2.7.1)
- DatadogTrace (~> 2.7.1)
- DatadogWebViewTracking (~> 2.7.1)
- DatadogCore (~> 2.13.0)
- DatadogCrashReporting (~> 2.13.0)
- DatadogLogs (~> 2.13.0)
- DatadogRUM (~> 2.13.0)
- DatadogTrace (~> 2.13.0)
- DatadogWebViewTracking (~> 2.13.0)
- React-Core
- DatadogSDKReactNative/Tests (2.3.6):
- DatadogCore (~> 2.7.1)
- DatadogCrashReporting (~> 2.7.1)
- DatadogLogs (~> 2.7.1)
- DatadogRUM (~> 2.7.1)
- DatadogTrace (~> 2.7.1)
- DatadogWebViewTracking (~> 2.7.1)
- DatadogCore (~> 2.13.0)
- DatadogCrashReporting (~> 2.13.0)
- DatadogLogs (~> 2.13.0)
- DatadogRUM (~> 2.13.0)
- DatadogTrace (~> 2.13.0)
- DatadogWebViewTracking (~> 2.13.0)
- React-Core
- DatadogSDKReactNativeSessionReplay (2.3.6-alpha.0):
- DatadogSDKReactNative
- DatadogSessionReplay (~> 2.7.1)
- DatadogSessionReplay (~> 2.13.0)
- React-Core
- DatadogSDKReactNativeSessionReplay/Tests (2.3.6-alpha.0):
- DatadogSDKReactNative
- DatadogSessionReplay (~> 2.7.1)
- DatadogSessionReplay (~> 2.13.0)
- React-Core
- React-RCTText
- DatadogSessionReplay (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogTrace (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogWebViewTracking (2.7.1):
- DatadogInternal (= 2.7.1)
- DatadogSessionReplay (2.13.0):
- DatadogInternal (= 2.13.0)
- DatadogTrace (2.13.0):
- DatadogInternal (= 2.13.0)
- OpenTelemetrySwiftApi (= 1.6.0)
- DatadogWebViewTracking (2.13.0):
- DatadogInternal (= 2.13.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.73.6)
- FBReactNativeSpec (0.73.6):
Expand All @@ -57,6 +58,7 @@ PODS:
- hermes-engine/Pre-built (0.73.6)
- HMSegmentedControl (1.5.6)
- libevent (2.1.12)
- OpenTelemetrySwiftApi (1.6.0)
- PLCrashReporter (1.11.2)
- RCT-Folly (2022.05.16.00):
- boost
Expand Down Expand Up @@ -1201,6 +1203,7 @@ SPEC REPOS:
- fmt
- HMSegmentedControl
- libevent
- OpenTelemetrySwiftApi
- PLCrashReporter
- SocketRocket

Expand Down Expand Up @@ -1323,16 +1326,16 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
DatadogCore: 4a4cdf7beca3aa12b7095bebd926acea1a865a99
DatadogCrashReporting: f8b4ea638acaf58b68bbc51cb62a2d876f763241
DatadogInternal: b9217da25018284c087a2ed4b9bb3b0f26c767c0
DatadogLogs: 3b4132eefa67f196bb3ab2d603c1a2acd1292615
DatadogRUM: 8845815ba89f5ab8ceee765ee268f7de36f3e35d
DatadogSDKReactNative: 2abe05ac536daaf462cc801db9c9ad8b36eb2f8d
DatadogSDKReactNativeSessionReplay: 8709d75b13290d95a793de50d107ca869522a650
DatadogSessionReplay: f189054bd2fc2d14c487fd614f04b2b8041dd81f
DatadogTrace: a63da746c609bd4c683bca61a94429889e33b11e
DatadogWebViewTracking: 713f862ddd89173e0a3f5342cefa23def40f0f48
DatadogCore: 9390fd07a89f57a23983de66fbec5bf3c2034f7a
DatadogCrashReporting: 79b67b790df186524fc76d45c0b8ce751c36ef41
DatadogInternal: 61ab12516d2faad79e35973534c29a72b0d44382
DatadogLogs: 912d7b3fd3d75df856de060082b785f92f7cefe6
DatadogRUM: b5629479d4553d80f2a57ef9db44ce37e56f8b97
DatadogSDKReactNative: cf34eea449b1eaa05e479cb95a5fea7210e09b98
DatadogSDKReactNativeSessionReplay: 16b6db2ef784ce0bc2b14c2afb4cb16f37f41300
DatadogSessionReplay: 2e7795c1a8a86ff989ed5c0ccd616eed0f6c9a3a
DatadogTrace: 1f40893de00c9a9b87be46fa7016fa0d50c4e66b
DatadogWebViewTracking: d1e2e755bb2ed7c18208471b9cbcfc7cb920aa45
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
FBLazyVector: f64d1e2ea739b4d8f7e4740cde18089cd97fe864
FBReactNativeSpec: 9f2b8b243131565335437dba74923a8d3015e780
Expand All @@ -1341,6 +1344,7 @@ SPEC CHECKSUMS:
hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0
HMSegmentedControl: 34c1f54d822d8308e7b24f5d901ec674dfa31352
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenTelemetrySwiftApi: 657da8071c2908caecce11548e006f779924ff9c
PLCrashReporter: 499c53b0104f95c302d94fd723ebb03c56d9bac8
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: ca1d7414aba0b27efcfa2ccd37637edb1ab77d96
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class MockRumMonitor : RumMonitor {

override fun addFeatureFlagEvaluation(name: String, value: Any) {}

override fun addFeatureFlagEvaluations(featureFlags: Map<String, Any>) {}

override fun addTiming(name: String) {}

override fun clearAttributes() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.datadog.tools.unit.forge

import com.datadog.android.privacy.TrackingConsent
import com.datadog.android.telemetry.model.TelemetryConfigurationEvent
import fr.xgouchet.elmyr.Forge
import fr.xgouchet.elmyr.ForgeryFactory
Expand Down Expand Up @@ -49,8 +50,20 @@ internal class TelemetryConfigurationEventForgeryFactory :
forge.aNullable { aLong() },
forge.aNullable { aLong() },
forge.aNullable { aLong() },
forge.aNullable {
aValueFrom(
TelemetryConfigurationEvent.TraceContextInjection::class.java
)
},
forge.aNullable { aLong() },
forge.aNullable { aLong() },
forge.aNullable { aLong() },
forge.aNullable {
aValueFrom(
TelemetryConfigurationEvent.TrackingConsent::class.java
)
},
forge.aNullable { aBool() },
forge.aNullable { aBool() },
forge.aNullable { aBool() },
forge.aNullable { aBool() },
Expand Down Expand Up @@ -80,6 +93,8 @@ internal class TelemetryConfigurationEventForgeryFactory :
forge.aNullable { aBool() },
forge.aNullable { aBool() },

forge.aNullable { aBool() },
forge.aNullable { aBool() },
forge.aNullable { aBool() },
forge.aNullable { aBool() },
forge.aNullable { aList { aString() } },
Expand Down
6 changes: 3 additions & 3 deletions packages/core/ios/Sources/DatadogSDKWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ public class DatadogSDKWrapper {
reactVersion: reactVersion,
trackCrossPlatformLongTasks: trackCrossPlatformLongTasks,
trackErrors: trackErrors,
trackInteractions: trackInteractions,
trackLongTask: trackLongTask,
trackLongTask: trackLongTask,
trackNativeErrors: trackNativeErrors,
trackNativeLongTasks: trackNativeLongTasks,
trackNetworkRequests: trackNetworkRequests
trackNetworkRequests: trackNetworkRequests,
trackUserInteractions: trackInteractions
)
}

Expand Down
11 changes: 7 additions & 4 deletions packages/core/ios/Tests/DdSdkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,17 +513,20 @@ internal class DdSdkTests: XCTestCase {
let expectedFirstPartyHosts: [String: Set<TracingHeaderType>]? = ["example.com": [.datadog, .b3], "datadog.com": [.b3multi, .tracecontext]]
var actualFirstPartyHosts: [String: Set<TracingHeaderType>]?
var actualTracingSamplingRate: Float?
var actualTraceContextInjection: TraceContextInjection?
switch ddConfig.urlSessionTracking?.firstPartyHostsTracing {
case .trace(_,_): break
case let .traceWithHeaders(hostsWithHeaders, samplingRate):
case .trace(_,_,_): break
case let .traceWithHeaders(hostsWithHeaders, samplingRate, traceContextInjection):
actualFirstPartyHosts = hostsWithHeaders
actualTracingSamplingRate = samplingRate
actualTraceContextInjection = traceContextInjection
break
case .none: break
}

XCTAssertEqual(actualFirstPartyHosts, expectedFirstPartyHosts)
XCTAssertEqual(actualTracingSamplingRate, 66)
XCTAssertEqual(actualTraceContextInjection, .all)
}

func testBuildTelemetrySampleRate() {
Expand Down Expand Up @@ -806,7 +809,7 @@ internal class DdSdkTests: XCTestCase {

XCTAssertEqual(core.configuration?.initializationType, "LEGACY")
XCTAssertEqual(core.configuration?.trackErrors, true)
XCTAssertEqual(core.configuration?.trackInteractions, true)
XCTAssertEqual(core.configuration?.trackUserInteractions, true)
XCTAssertEqual(core.configuration?.trackNetworkRequests, true)
XCTAssertEqual(core.configuration?.trackNativeErrors, false)
XCTAssertEqual(core.configuration?.trackNativeLongTasks, false)
Expand Down Expand Up @@ -886,7 +889,7 @@ internal class DdSdkTests: XCTestCase {
DatadogSDKWrapper.shared.setCoreInstance(core: core)
DdSdkNativeInitialization().enableFeatures(sdkConfiguration: configuration)

DdSdkImplementation().consumeWebviewEvent(message: "{\"eventType\":\"RUM\",\"event\":{\"blabla\":\"custom message\"}}", resolve: mockResolve, reject: mockReject)
DdSdkImplementation().consumeWebviewEvent(message: "{\"eventType\":\"rum\",\"event\":{\"blabla\":\"custom message\"}}", resolve: mockResolve, reject: mockReject)

XCTAssertNotNil(core.baggages["browser-rum-event"])
}
Expand Down
20 changes: 11 additions & 9 deletions packages/core/ios/Tests/MockDatadogCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
@testable import DatadogInternal

internal class MockDatadogCore: DatadogCoreProtocol {
func set(baggage: @escaping () -> DatadogInternal.FeatureBaggage?, forKey key: String) {}

func send(message: FeatureMessage, else fallback: @escaping () -> Void) {
if // Configuration Telemetry Message
case .telemetry(let telemetry) = message,
Expand All @@ -20,6 +18,10 @@ internal class MockDatadogCore: DatadogCoreProtocol {
if case .baggage(let key, let baggage) = message {
self.baggages[key] = baggage
}

if case .webview(let webViewMessage) = message {
self.baggages["browser-rum-event"] = webViewMessage
}
}

@ReadWriteLock
Expand All @@ -29,20 +31,20 @@ internal class MockDatadogCore: DatadogCoreProtocol {
@ReadWriteLock
private(set) var baggages: [String: Any] = [:]

func register<T>(feature: T) throws where T : DatadogFeature {
func register<T>(feature: T) throws where T : DatadogInternal.DatadogFeature {
features[T.name] = feature
}

func get<T>(feature type: T.Type) -> T? where T : DatadogFeature {
func feature<T>(named name: String, type: T.Type) -> T? {
return nil
}

func scope(for feature: String) -> FeatureScope? {
return nil
func scope<T>(for featureType: T.Type) -> any DatadogInternal.FeatureScope where T : DatadogInternal.DatadogFeature {
return NOPFeatureScope()
}

func set(feature: String, attributes: @escaping () -> FeatureBaggage) {}

func update(feature: String, attributes: @escaping () -> FeatureBaggage) {}
func set(baggage: @escaping () -> DatadogInternal.FeatureBaggage?, forKey key: String) {
baggages[key] = baggage
}
}

Loading

0 comments on commit 5faa876

Please sign in to comment.