Skip to content
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

Add isCrashed() property in SentryEvent Model #4552

Open
KimTaeHyeong17 opened this issue Nov 18, 2024 · 2 comments
Open

Add isCrashed() property in SentryEvent Model #4552

KimTaeHyeong17 opened this issue Nov 18, 2024 · 2 comments

Comments

@KimTaeHyeong17
Copy link

KimTaeHyeong17 commented Nov 18, 2024

Problem Statement

As implementing Sentry sdk in both android and ios device, we wanted to make sure to implement same way in both os.

There were some difference in android/iOS sentry interface but one thing I hoped to be added is "isCrashed" property.

As an ios developer who wanted to distinguish crash event and normal event at beforeSend closure, I tried to find flag to whether event is crash event and I was able to find only at android sdk.

After that I was started to think what's the difference between event.logLevel fatal and isCrashed value
I planned to use loglevel fatal in ios, and isCrahsed in android but it seems bit wrong for determine crash event.
After getting answer from sentry team about this question and I understood clearly.

However if there is "isCrahsed" in sentry-cocoa too, it would be much clear for this usecase.

Solution Brainstorm

- (BOOL)isCrash
{
    for (SentryException *exception in self.exceptions) {
        if (exception.mechanism != nil) {
            return YES;
        }
    }
    return NO;
}

Are you willing to submit a PR?

No response

@philipphofmann
Copy link
Member

We already have that; we need to make it public. We could consider making isAppHangEvent and isMetricKitEvent public too.

@property (nonatomic) BOOL isCrashEvent;
/**
* This indicates whether this event represents an app hang.
*/
@property (nonatomic, readonly) BOOL isAppHangEvent;
/**
* We're storing serialized breadcrumbs to disk in JSON, and when we're reading them back (in
* the case of OOM), we end up with the serialized breadcrumbs again. Instead of turning those
* dictionaries into proper SentryBreadcrumb instances which then need to be serialized again in
* SentryEvent, we use this serializedBreadcrumbs property to set the pre-serialized
* breadcrumbs. It saves a LOT of work - especially turning an NSDictionary into a SentryBreadcrumb
* is silly when we're just going to do the opposite right after.
*/
@property (nonatomic, strong) NSArray *serializedBreadcrumbs;
#if SENTRY_TARGET_PROFILING_SUPPORTED
@property (nonatomic) uint64_t startSystemTime;
@property (nonatomic) uint64_t endSystemTime;
#endif // SENTRY_TARGET_PROFILING_SUPPORTED
#if SENTRY_HAS_METRIC_KIT
- (BOOL)isMetricKitEvent;
#endif // SENTRY_HAS_METRIC_KIT

We will discuss this internally and get back to you.

@philipphofmann
Copy link
Member

philipphofmann commented Nov 27, 2024

We need to make all the public properties exposed in this PR read-only, and we agree that we can make these properties public. Feel free to open a PR to make these public, @KimTaeHyeong17.

@philipphofmann philipphofmann moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Backlog
Development

No branches or pull requests

2 participants