getsentry / sentry-dart

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

UI events not detected on all widgets (like GestureDetector and Tab) #2012

Closed Jonny1987 closed 5 months ago

Jonny1987 commented 6 months ago

Platform

Dart

Obfuscation

Disabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.19.6, on Ubuntu 22.04.4 LTS 6.5.0-26-generic, locale en_US.UTF-8) • Flutter version 3.19.6 on channel stable at /home/john/dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (8 days ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /home/john/Android/Sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /opt/android-studio/jbr/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.

[✓] Chrome - develop for the web • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop • Ubuntu clang version 14.0.0-1ubuntu1.1 • cmake version 3.22.1 • ninja version 1.10.1 • pkg-config version 0.29.2

[✓] Android Studio (version 2023.1) • Android Studio at /opt/android-studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.88.1) • VS Code at /usr/share/code • Flutter extension version 3.86.0

[✓] Connected device (3 available) • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator) • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.5.0-26-generic • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.86

[✓] Network resources • All expected network resources are available.

• No issues found!

Version

8.0.0

Steps to Reproduce

1) Add a key to GestureDetector and Tab objects as needed for UI detection to work for other elements 2) Cause an error in a child widget 3) See that the issue result in sentry does not show the user clicking on the gesture detector or tab bar in the breadcrumbs

Expected Result

Clicks on the GestureDetector or Tab should show in the issue breadcrumbs

Actual Result

I don't think there is much point showing breadcrumbs with things missing since it's pretty easy to imagine

Are you willing to submit a PR?

None

buenaflor commented 6 months ago

Thanks for reporting this! Has this been an issue in older versions as well?

Jonny1987 commented 6 months ago

I only have experience with the newest version. It's not actually urgent because I can trigger a breadcrumb manually in these elements but it would be nice if it was done automatically

buenaflor commented 6 months ago

Got it, thanks for raising this, we'll have a look

denrase commented 6 months ago

As far as I understand this after looking at the code and debugging, only certain widgets are supported:

https://github.com/getsentry/sentry-dart/blob/9fe67d51d3fe8a8daa73206ae4eac77ca507e406/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart#L220

https://github.com/getsentry/sentry-dart/blob/9fe67d51d3fe8a8daa73206ae4eac77ca507e406/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart#L502

@Jonny1987 So doing this manually in your case is, currently, the correct approach.

If supporting GestureDetector, Tab or other widget types is needed more broadly, we need to add them in code or discuss other approaches how to open up this API. @buenaflor

buenaflor commented 6 months ago

Let's add it 👍

denrase commented 5 months ago

@Jonny1987 We have looked at this and decided that it's best to just manually add breadcrumbs for Tabs & GestureDetectors, as this might interfere with other auto crumbs nested inside.