sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Improve support for Kotlin Native

Open rickclephas opened this issue 3 years ago • 4 comments

Problem Statement

I have been playing with Sentry in a Kotlin Multiplatform iOS app.

So far I have been able to successfully log a fatal Kotlin exception. However it currently requires using a lot of private APIs.

Solution Brainstorm

To convert a Kotlin Exception to a SentryException we'll need something like:

@interface SentryStacktrace ()

+ (SentryStacktrace *)stacktraceFromCallStackReturnAddresses:(NSArray<NSNumber *> *)callStackReturnAddresses;

@end

All the logic already exists, but it currently requires using SentryStacktraceBuilder and SentryCrashStackCursor.

The other API that's missing is a way to store a crash event. Currently there is storeEnvelope (which is also private) which requires a lot of private APIs to create a SentryEnvelope. Something like the following (that internally prepares the event and creates the envelope) would be great.

@interface SentrySDK ()

+ (void)storeCrashEvent:(SentryEvent *)event;

@end

rickclephas avatar Jul 22 '22 09:07 rickclephas

Hey @rickclephas thanks for this. It looks like a nice use case. We gonna look into it.

brustolin avatar Jul 25 '22 08:07 brustolin

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Sep 01 '22 00:09 github-actions[bot]

@buenaflor, you worked on the Kotlin Multiplatform in the past weeks. Isn't that issue already fixed? Or how did you work around the issue again?

philipphofmann avatar Sep 01 '22 12:09 philipphofmann

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Sep 23 '22 00:09 github-actions[bot]

Should be fixed with https://github.com/getsentry/sentry-kotlin-multiplatform/pull/20. Feel free to open if not.

philipphofmann avatar Sep 26 '22 13:09 philipphofmann

@philipphofmann I don't think that really solves the "problem". That PR uses similar logic to what I have used, which relies on a number of private APIs.

I feel like it would be better to officially support this in the Cocoa SDK.

A KMP SDK is great, but one of the biggest strengths of KMP is its ability to integrate with native projects. Providing the required APIs as part of the public API would improve the KMP experience. It would also decouple the KMP SDK from the Cocoa SDK, allowing it to focus on improving the Kotlin experience without having to worry too much about the underlying native SDKs.

rickclephas avatar Sep 26 '22 17:09 rickclephas

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Oct 21 '22 00:10 github-actions[bot]