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

Support Source Context

Open bruno-garcia opened this issue 5 years ago • 7 comments

Originally posted on flutter: https://github.com/flutter/flutter/issues/63276

Users would like to see the source context around the stack trace. This is a feature supported in Python, JavaScript and other script languages. Native has this support with source bundles.

Relates to (Java, .NET)

bruno-garcia avatar Oct 25 '20 03:10 bruno-garcia

Currently blocked by https://github.com/dart-lang/sdk/issues/44325

marandaneto avatar Dec 04 '20 15:12 marandaneto

Currently blocked by https://github.com/dart-lang/sdk/issues/44325

The linked issue mentions that most of it is now possible via --resolve-dwarf-paths. Is that enough for us to work with?

ueman avatar Jun 03 '21 20:06 ueman

Hello guys, any news about this issue? This is really important for us 😬

augustorsouza avatar Jun 25 '21 11:06 augustorsouza

@augustorsouza we'd like to do it but we didn't spend much time investigating it yet, we don't even know if it's supported ootb by the flutter/dart tooling.

just to be clear, this is about showing the source code around the stack trace on sentry, not really related to source maps or anything, it's a nice feature indeed, but would you mind elaborating why is it important? interested in the use case, so we can prioritize.

marandaneto avatar Jun 25 '21 12:06 marandaneto

For Web, it works at some degree, see https://github.com/getsentry/sentry-dart/issues/417#issuecomment-897480519

marandaneto avatar Aug 12 '21 09:08 marandaneto

We'll test if the new flag --resolve-dwarf-paths works or if something else is needed. https://github.com/dart-lang/sdk/issues/44325#issuecomment-826771991

marandaneto avatar May 20 '22 07:05 marandaneto

Relates to: https://github.com/getsentry/sentry-java/issues/633

bruno-garcia avatar Jun 01 '22 13:06 bruno-garcia

@vaind do you know if this is possible after your PRs on Dart/Flutter language/engine?

marandaneto avatar Oct 27 '22 11:10 marandaneto

@vaind do you know if this is possible after your PRs on Dart/Flutter language/engine?

not out of the top of my head, I'll check

vaind avatar Oct 27 '22 11:10 vaind

https://github.com/getsentry/sentry-dart-plugin already supports include_native_sources we'd need to upload debug symbols with this flag enabled when compiling with --split-debug-info and without, since the process changes a little bit. My hunch is that it works for Android if --split-debug-info is enabled at least, if disabled not sure.

iOS does not work at all https://github.com/getsentry/team-mobile/issues/42#issuecomment-1305602466

marandaneto avatar Oct 27 '22 12:10 marandaneto

I've managed (with a custom flutter build) to get an issue with absolute paths to sentry.io from Android. Weirdly though, each stacktrace source path contains "dispose" somewhere in the path - see https://sentry.io/organizations/sentry-sdks/issues/3734649639/events/1f7d76d638bf44dd8c069bc0a15c260f/?project=5428562

No idea where that comes from because the stack trace coming from flutter symbolize doesn't have that, see https://github.com/dart-lang/sdk/issues/44325#issuecomment-1311728421

edit: the same "dispose" is in the path on iOS: https://sentry.io/organizations/sentry-sdks/issues/3734649639/events/78f08f5fcd75451db6a64161b4b0133c/?project=5428562 - likely something we're adding along the way

vaind avatar Nov 11 '22 14:11 vaind

As for web, I'm confused... this issue linked above says it should work, but for some reason, It doesn't for me: https://sentry.io/organizations/sentry-sdks/issues/3734775388/events/e14d18b2b90c4c97815245624ed4757e/?project=5428562

vaind avatar Nov 11 '22 15:11 vaind

I've managed (with a custom flutter build) to get an issue with absolute paths to sentry.io from Android. Weirdly though, each stacktrace source path contains "dispose" somewhere in the path - see sentry.io/organizations/sentry-sdks/issues/3734649639/events/1f7d76d638bf44dd8c069bc0a15c260f/?project=5428562

No idea where that comes from because the stack trace coming from flutter symbolize doesn't have that, see dart-lang/sdk#44325 (comment)

edit: the same "dispose" is in the path on iOS: sentry.io/organizations/sentry-sdks/issues/3734649639/events/78f08f5fcd75451db6a64161b4b0133c/?project=5428562 - likely something we're adding along the way

Does the SDK set that in the absPath or is that during symbolication on the server? just asking cus I can check with the stack trace team.

marandaneto avatar Nov 14 '22 09:11 marandaneto

Does the SDK set that in the absPath or is that during symbolication on the server? just asking cus I can check with the stack trace team.

I've checked that last week and didn't find any occurrence of the "dispose" as a string anywhere in the dart, java or native SDK.

vaind avatar Nov 14 '22 10:11 vaind

just asking cus I can check with the stack trace team.

please do - I've posted on discord in the dwarf channel (for the lack of a better place) to no avail yet.

vaind avatar Nov 14 '22 10:11 vaind

As for web, I'm confused... this issue linked above says it should work, but for some reason, It doesn't for me: sentry.io/organizations/sentry-sdks/issues/3734775388/events/e14d18b2b90c4c97815245624ed4757e/?project=5428562

There's no uploaded sourcemaps for this release.

marandaneto avatar Nov 14 '22 10:11 marandaneto

There's no uploaded sourcemaps for this release.

hmm, that looks like an error. SENTRY_RELEASE env var is set in run.sh but maybe not picked up properly by the dart plugin. I'll check

vaind avatar Nov 14 '22 10:11 vaind

web - it loaded the cached version from a previous run. when I made sure I use the version I've just built, in-app source codes work fine - https://sentry.io/organizations/sentry-sdks/issues/3741285487/events/0c0429bd595840b6a5117b755a3f0da8/?project=5428562

vaind avatar Nov 15 '22 09:11 vaind

@vaind I believe this is completed on our side and it works OOTB when the source context is uploaded, right? Do we have to document the usage of --resolve-dwarf-paths? do people need to use the master channel of Dart and/or Flutter still?

marandaneto avatar Jan 30 '23 17:01 marandaneto

@marandaneto not at all, there's an open PR on Flutter to enable this option (https://github.com/flutter/flutter/pull/114767) and there's an UI issue that the sources don't show up on sentry.io (looking into that - https://discord.com/channels/621778831602221064/809895882987536395/1068962301228617830)

vaind avatar Jan 30 '23 17:01 vaind

UI work is being tracked here. I will ping folks for that.

marandaneto avatar Jan 31 '23 17:01 marandaneto

UI is fixed and the flutter PR has landed as well. In other words, this is "done" and should start working automatically with the next Flutter release. I'll keep my eye on this and check in a couple of days against Flutter master to see if everything seems in order.

Keeping the issue open for now

vaind avatar Feb 10 '23 13:02 vaind

@vaind did you manage to check whether this is working now?

kahest avatar Mar 01 '23 15:03 kahest

Works with the latest beta tag (but not in with the flutter channel beta yet because that one is on 3.8.0-10.1.pre)

Flutter 3.8.0-17.0.pre • channel unknown • unknown source
Framework • revision 1d17caed66 (6 days ago) • 2023-02-27 23:11:38 -0500
Engine • revision 002b3d7a24
Tools • Dart 3.0.0 (build 3.0.0-277.0.dev) • DevTools 2.22.1

https://sentry-sdks.sentry.io/issues/3979346432/events/a64d54c3c3a44eeba76ddf22f2bf9800/?project=5428562 image

vaind avatar Mar 06 '23 09:03 vaind