Skip to content

Conversation

sbarrio
Copy link
Contributor

@sbarrio sbarrio commented Sep 12, 2025

What does this PR do?

This PR fixes the implementation of DdTrace on iOS, so nesting spans is possible and displays properly on the Datadog dashboard.

Motivation

Span nesting works as expected on Android, but it does not on iOS, where spans appear registered separately, without taking into account if they have a parent span or not.

Additional Notes

Before
Screenshot 2025-09-12 at 11 28 10

After
Screenshot 2025-09-12 at 11 28 23

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

public func startSpan(operation: String, context: NSDictionary, timestampMs: Double, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
let id = UUID().uuidString as NSString
objc_sync_enter(self)
defer { objc_sync_exit(self) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This way we make sure that objc_sync will be released no matter what.

@sbarrio sbarrio self-assigned this Sep 12, 2025
Copy link
Member

@marco-saia-datadog marco-saia-datadog left a comment

Choose a reason for hiding this comment

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

Nice 🚀 Looks good to me

@sbarrio sbarrio force-pushed the sbarrio/fix/get-span-nesting-to-work-on-ios branch from 293a5e8 to 539de5d Compare September 18, 2025 13:27
@sbarrio sbarrio marked this pull request as ready for review September 18, 2025 13:27
@sbarrio sbarrio requested a review from a team as a code owner September 18, 2025 13:27
@marco-saia-datadog marco-saia-datadog changed the base branch from develop to feature/v3 October 2, 2025 07:55
@marco-saia-datadog marco-saia-datadog dismissed their stale review October 2, 2025 07:55

The base branch was changed.

@marco-saia-datadog marco-saia-datadog changed the base branch from feature/v3 to develop October 2, 2025 07:55
@marco-saia-datadog marco-saia-datadog self-requested a review October 2, 2025 12:07
@sbarrio sbarrio merged commit 2f0ab89 into develop Oct 3, 2025
10 checks passed
@sbarrio sbarrio deleted the sbarrio/fix/get-span-nesting-to-work-on-ios branch October 3, 2025 07:45
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.

2 participants