Closed ueman closed 2 years ago
@ueman which package is this one? Trace.current(1).frames.first.package
The idea isn't bad, the only problem I see is if the SDK is being initialized in a library or 3rd party, that could lead to a wrong inApp, I guess?
For a normal App, it'd return:
0 Sentry.init (package:sentry[/src/sentry.dart:44:30]())
#1 main ([file:///Users/user/Github/sentry-dart/dart/example/bin/example.dart:17:3]())
So it'd only work for Flutter apps most likely.
@ueman which package is this one?
Trace.current(1).frames.first.package
It's from the stack_trace
library which is already in use by the SDK.
The idea isn't bad, the only problem I see is if the SDK is being initialized in a library or 3rd party, that could lead to a wrong inApp, I guess?
Yep, that's true, but still better than the current default of in-app = true
for all frames.
trace.frames.first.library
would return bin/example.dart
from a Dart App.
So in the isInApp
function, we could do: final packageOrLibrary = frame.package ?? frame.library;
and verify the inAppIncludes
and inAppExcludes
.
Maybe that's doable.
The idea isn't bad, the only problem I see is if the SDK is being initialized in a library or 3rd party, that could lead to a wrong inApp, I guess?
Maybe it's not a big problem if it gets logged with something like:
Automatically detected '<package_name>' as in app include. It it's not correct you can change it by doing <steps to change it>
?
Yeah, they can remove it from the inAppIncludes
anyway, let's toy with it, it still needs testing on the Web due to minified JS and Flutter + split debug symbols.
Since this is possible to do it manually, and also, doing It automatically can lead to unwanted side effects, for example, when initialising the SDK later.
The Flutter initialization can be changed to the following, in order to automatically detect the application package name to correctly identify in-app-stack-frames.
This works at least on Flutter VM platforms. I haven't looked at pure Dart and Web use cases.
Relates to https://github.com/getsentry/sentry-dart/issues/729. If both in-app-includes and in-app-excludes work, the results should be fairly reliable.