Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't filter breadcrumbs on Android #3090

Closed
4 of 8 tasks
ejain opened this issue May 26, 2023 · 5 comments
Closed
4 of 8 tasks

Can't filter breadcrumbs on Android #3090

ejain opened this issue May 26, 2023 · 5 comments

Comments

@ejain
Copy link

ejain commented May 26, 2023

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.4.0

react-native version: 0.70.9

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

BLOOMTEXT-MOBILE-NX

Configuration:

(@sentry/react-native)

    Sentry.init({
      dsn: SENTRY_DSN,
      enableAppHangTracking: false,
      enableWatchdogTerminationTracking: false,
      beforeBreadcrumb (breadcrumb) {
        return breadcrumb.category === "action" ? breadcrumb : null
      },
    })

Also tried:

     ...
      integrations: function (integrations) {
        return integrations.filter(function (integration) {
          return integration.name !== "Breadcrumbs"
        })
      },
     ...

(AndroidManifest.xml)

<manifest>
  <application>
    ...
     <meta-data android:name="io.sentry.breadcrumbs.activity-lifecycle" android:value="false" />
     <meta-data android:name="io.sentry.breadcrumbs.app-components" android:value="false" />
     <meta-data android:name="io.sentry.breadcrumbs.app-lifecycle" android:value="false" />
     <meta-data android:name="io.sentry.breadcrumbs.system-events" android:value="false" />
     <meta-data android:name="io.sentry.breadcrumbs.user-interaction" android:value="false" />
   </application>
</manifest>

I have following issue:

Despite filtering on breadcrumb.category === 'action', network.event and app.lifecycle breadcrumbs are captured. Disabling automatic breadcrumbs in the Android manifest as described here doesn't suppress these, either.

Steps to reproduce:

  • Trigger any error

Actual result:

Breadcrumbs contain not just action but also network.event and app.lifecycle breadcrumbs. On iOS, there are even more categories, including 'ui.lifecycle' and touch...

Expected result:

Breadcrumbs contain only "action" items.

@ejain
Copy link
Author

ejain commented May 26, 2023

Should add that some breadcrumb categories (e.g. console) are being filtered out as expected with this setup.

@ejain
Copy link
Author

ejain commented May 26, 2023

I suspect beforeBreadcrumb is only processing "browser" breadcrumbs, but not "native" breadcrumbs -- if that makes sense.

@krystofwoldrich
Copy link
Member

Hi,
thank you for the message and details.

beforeBreadcrumb callback is executed only for JS Breadcrumbs. Native breadcrumbs are added by our integration later on. To only receive breadcrumb.category === 'action' you can filter the final breadcrumbs in beforeSend.

At the moment this won't work on Android due to the current way of scope synchronization. More information about the issue here.

The AndroidManifest.xml options are ignored because the RN SDK initializes the Android SDK. To change the Android Breadcrumbs options you would need to initialize the SDK manually.

@ejain
Copy link
Author

ejain commented May 30, 2023

Thanks for the explanation -- good to know that this is a known issue/limitation.

@krystofwoldrich
Copy link
Member

I'll close this issue since the core problem is described in getsentry/team-mobile#11

@krystofwoldrich krystofwoldrich closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants