Skip to content

Conversation

@sbarrio
Copy link
Contributor

@sbarrio sbarrio commented Dec 3, 2025

What does this PR do?

The DatadogSDKWrapper has changed a bit on v3, mainly removing it's core SDK instance reference. On the other hand, the Write protocol was modified slightly for v3 of iOS, so the FEatureScopeInterceptor used to track events on internal tests needed to be adapted.

Motivation

We need the internal testing module working to be able to test v3 with out e2e test suite.

Additional data

I tested the fix locally with the nightly tests project and the test app builds and runs properly after this change.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@sbarrio sbarrio marked this pull request as ready for review December 3, 2025 17:10
@sbarrio sbarrio requested a review from a team as a code owner December 3, 2025 17:10
@sbarrio sbarrio marked this pull request as draft December 3, 2025 17:23
@sbarrio sbarrio marked this pull request as ready for review December 4, 2025 11:28
DatadogSDKWrapper.shared.addOnSdkInitializedListener(listener: {core in
let proxiedCore = DatadogCoreProxy(core: core)
DatadogSDKWrapper.shared.setCoreInstance(core: proxiedCore)
CoreRegistry.unregisterDefault()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling register directly with the same name does not overwrite its value, so we need to call unregsiterDefault first to be able to set the proxied core as the default core.


@objc
public func debug(message: String, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
if (!self.isSDKInitialized()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these for two reasons:

  • It's a bit weird that the logs module is checking for this when the native SDK does it too.
  • When running the app with the internal testing tools module, this check will always be false, since the way in which the core SDK checks if the core is initialized is by checking the core type and comparing it with DatadogCore. Since the internal testing tools wrap it into a DatadogCoreProxy to allow for intercepting events this check always fails, even if the SDK is running fine.

And for those curious, this worked fine on v2 because the DatadogSdkWrapper kept a local reference to the core sdk instance, and the internal testing tools were wrapping that one instead, so calls to Datadog.isInitialized would still work fine as they would not deal with the wrapped core but with the internal SDK one.

@sbarrio sbarrio self-assigned this Dec 9, 2025
Base automatically changed from sbarrio/internal/update-v3-with-latest-from-develop to feature/v3 December 9, 2025 08:53
@sbarrio sbarrio merged commit 43ff463 into feature/v3 Dec 9, 2025
9 checks passed
@sbarrio sbarrio deleted the sbarrio/v3/adapt-internal-testing-tools-package-to-v3 branch December 9, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants