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

Make lifecycle breadcrumbs logged by sentry-android-fragment integration customizable #1734

Closed mateuszkwiecinski closed 1 year ago

mateuszkwiecinski commented 3 years ago

Context

I tried to add FragmentLifecycleIntegration to my app, and I quickly reached default breadcrumbs limit. Almost all events came from FragmentLifecycleIntegration which decreased number of visible user interactions to last 2-3 screens before crash. I could increase breadcrumbs limit, but I concluded I'd prefer see less events logged by FragmentLifecycleIntegration.

Proposal

The simples thing I can suggest is to introduce api like:

FragmentLifecycleIntegration(
    application = application,
    loggedLifecycleEvents = setOf(Lifecycle.State.RESUMED, Lifecycle.State.PAUSED),
)

which would skip events non-listed in new parameter.

marandaneto commented 3 years ago

@mateuszkwiecinski thanks for reporting, such grain fined level makes sense, let's see if people upvote.

a workaround, for now, is using the BeforeBreadcrumb callback to filter breadcrumbs out https://docs.sentry.io/platforms/android/enriching-events/breadcrumbs/#customize-breadcrumbs or obviously, increasing the number of crumbs.

romtsn commented 1 year ago

Closed by #2299