getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
743 stars 227 forks source link

Support for crash free rate for pure Dart apps (other than Flutter) #542

Open ueman opened 3 years ago

ueman commented 3 years ago

Sentry for Dart currently does not support session data used for crash free rate. (note this is NOT about session replay)

On Flutter for iOS, Android and macOS this is not necessarily a problem as the underlying SDK supports it. However that does mean, that there's no support for sessions on web, Windows and Linux.

The relevant documentation is here: https://develop.sentry.dev/sdk/sessions/

bruno-garcia commented 3 years ago

Worth noting we can align to what Unity is doing here. There's a C# implementation of it, with hooks to inspect the native layer for the result of the previous session (in case it crashed in the native layer).

The .NET SDK supports "Crashed" sessions through the .NET Unhandled Exception handler but Unity (like Flutter) doesn't crash on unhandled errors. So it turns out the "crash free" stats are always 0% when seeing only from the Dart layer perspective. The Dart/C# layers persist the open session so it can close on restart as Abnormal in case it wasn't gracefully closed, but when the native SDK allows, it can call a callback to be able to differentiate between Abnormal and Crash (native):

https://github.com/getsentry/sentry-dotnet/blob/fb2372a553c3319b9dc2ccfe00b92035bfe76721/src/Sentry/GlobalSessionManager.cs#L305-L311

We need to clarify this in the docs as the 0% crash free on platforms where we don't have native support to flag sessions as crashed might be confusing. Perhaps even adding some support on the product (like showing up Abnormal session rate instead of Crashed).

ueman commented 2 years ago

Perhaps even adding some support on the product (like showing up Abnormal session rate instead of Crashed).

@bruno-garcia Are there any updates on this?

bruno-garcia commented 2 years ago

Not yet. @lobsterkatie has brought up something in this area for JavaScript since "crashed" can also be a bit odd there. But nothing changed in Sentry yet

phr34k commented 1 year ago

Would be great if this can be supported. I have a desktop application and would be good if could get some stats about the sessions. For me it's simple enough that, I can manually create sessions based on login/logout screen, and just get some stats about 'handled' exceptions.

The-RootCause commented 5 months ago

Any update on this feature. It's very important

kahest commented 5 months ago

@The-RootCause thanks for your interest, we don't have updates on this at this time, but feel free to upvote the comment at the top and track this issue for updates

bruno-garcia commented 5 months ago

@The-RootCause I saw you also reacted on the Flutter repo about canvas and Session Replay. Did you mean you believe Replay is important? This issue is about sessions used for crash free rate, for Dart apps other than Flutter. So not really the same thing. We have a wait list for Replay and are working on it: https://sentry.io/lp/mobile-replay-beta/

The-RootCause commented 5 months ago

@bruno-garcia Yes, my question was more concerning Flutter apps. My bad I didn't pay attention to Pure dart. Thank you