Skip to content

feat: Propagate traceId to the Cocoa SDK #2106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Apr 22, 2025
Merged

Conversation

bitsandfoxes
Copy link
Contributor

With this change the Unity SDK is propagating the trace down to the Cocoa SDK. This allows connecting native errors and crashes with the ones from within the game.

Relies on getsentry/sentry-cocoa#5081

Screenshot 2025-04-10 at 14 45 13

Copy link
Contributor

github-actions bot commented Apr 10, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 5a49697

@@ -255,6 +274,22 @@ void SentryNativeBridgeUnsetUser()
return cString;
}

void SentryNativeBridgeSetTrace(const char *traceId, const char *spanId)
Copy link
Member

Choose a reason for hiding this comment

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

is the iOS and Mac bridges the same? I wonder if we could use symlinks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, they are not. Functionally, yes, but we load the lib dynamically on macOS:

/*******************************************************************************/
/* The remaining code is a copy of iOS/SentryNativeBridge.m with changes to */
/* make it work with dynamically loaded classes. Mainly: */
/* - call: [class performSelector:@selector(arg1:arg2:) */
/* withObject:arg1Value withObject:arg2Value]; */
/* or xCode warns of class/instance method not found */
/* - use `id` as variable types */
/* - use [obj setValue:value forKey:@"prop"] instead of `obj.prop = value` */
/*******************************************************************************/

@bitsandfoxes bitsandfoxes merged commit d32cf36 into main Apr 22, 2025
10 checks passed
@bitsandfoxes bitsandfoxes deleted the feat/cocoa-sync-trace-id branch April 22, 2025 16:59
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