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

Flutter Frame Tracking Integration

Open ueman opened this issue 4 years ago • 3 comments

Flutter allows the developer to read how long it took for a frame to draw. See FrameTiming.

It would be nice if Sentry attaches a listener and sends events or add breadcrumbs if a frame took to long to draw.

Since there's no performance tracing yet, I can imagine that it's not that useful since you don't really know what caused dropped frames. Though the NavigatorObserver should help with that.

ueman avatar Jun 30 '21 16:06 ueman

I don't think this as events or breadcrumbs are useful as they won't know where/how to fix it, this would fit either our measurements or metrics product which is being worked on as we speak. See eg https://github.com/getsentry/sentry-cocoa/pull/1123 it requires the performance API so its blocked by it

marandaneto avatar Jul 01 '21 08:07 marandaneto

In one of the recent Flutter versions (either 2.5 or 2.8) your now able to read the current frame number and FrameTiming also got a frame number property.

This should make it possible to get at least somewhat useful metrics.

ueman avatar Jan 12 '22 16:01 ueman

There's also https://api.flutter.dev/flutter/scheduler/SchedulerBinding/addPersistentFrameCallback.html which gets called every frame.

ueman avatar Jan 25 '22 05:01 ueman

After raising the min versions of Dart and Flutter, the detection of slow and frozen frames is possible in pure Dart code without having to rely on native code. Thus that feature could be implemented for Linux and Windows. (Maybe on the canvaskit renderer on web too?) I believe the current implementation needs some changes to enable that though.

ueman avatar Dec 12 '22 15:12 ueman

After raising the min versions of Dart and Flutter, the detection of slow and frozen frames is possible in pure Dart code without having to rely on native code. Thus that feature could be implemented for Linux and Windows. (Maybe on the canvaskit renderer on web too?) I believe the current implementation needs some changes to enable that though.

Yes, I believe that would be the goal, getting the values directly from Skia instead of the Native SDKs.

marandaneto avatar Dec 12 '22 15:12 marandaneto

PR is closed due to https://github.com/getsentry/sentry-dart/pull/1271#issuecomment-1562970140

marandaneto avatar May 25 '23 14:05 marandaneto

Closed because of https://github.com/getsentry/sentry-dart/pull/1271#issuecomment-1562970140 We can reevaluate this in case we learn more or find out that this is actually possible within our current data model.

marandaneto avatar Jul 27 '23 09:07 marandaneto