getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.15k stars 435 forks source link

InAppInclude option not added via AndroidManifest.xml #2617

Open rodolfoBee opened 1 year ago

rodolfoBee commented 1 year ago

Integration

sentry-android

Build System

Gradle

AGP Version

7.3.3

Proguard

Disabled

Version

6.16.0

Steps to Reproduce

Go to you AndroidManifest.xml and try to add extra prefixes to in app frames as described in the docs: https://docs.sentry.io/platforms/android/configuration/options/#in-app-include

For example:

Expected Result

From the docs above "Options on Android can be set by setting the values on the AndroidManifest.xml file", and by adding the option a user will expect frames from androidx.fragment to marked as in-app frames

Actual Result

frames from androidx.fragment are marked as system frames.]

As spotted by two colleagues, in-app-include (and in-app-exclude) are not listed in the manifest reader file: https://github.com/getsentry/sentry-java/blob/main/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java

nor are added to our sample: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml

It works as expected with manual init, which can be used as SDK workaround:

SentryAndroid.init(this, options -> {
            options.setDsn("MY_DSN");
            options.addInAppInclude("com.example.loja");
            options.addInAppInclude("androidx.fragment");
});

Server side workaround: https://docs.sentry.io/product/data-management-settings/event-grouping/stack-trace-rules/

markushi commented 1 year ago

@rbisol could you elaborate on why you see this as system frames?

frames from androidx.fragment are marked as system frames. It would be great to understand the underlying use-case better.

rodolfoBee commented 1 year ago

@markushi These are marked as not in app automatically by the SDK because it is a library. I'm just using this as an example to prove the in-app-includes option has no effect when configured in AndroidManifest.xml.