-
-
Notifications
You must be signed in to change notification settings - Fork 472
-
I'm using sentry to capture errors but I want only for specified package and not from all packages and not even from activities from my app. Is this the correct way of doing it or should be done via some other configuration ?
SentryAndroid.init(this, options -> {
options.addInAppExclude("*");
options.addInAppInclude("com.example.lib.*");
});
Beta Was this translation helpful? Give feedback.
All reactions
hi, sorry I'm not sure I got your problem exactly - would you like to filter out some certain sentry events? inAppExclude is not meant for that, it's meant for marking some stackframes as in-app or not, but not really for filtering out the events.
If you would like some events to be dropped, you can use as mentioned here, but check for events from the lib that you'd like to capture:
SentryAndroid.init(context) { options -> options.beforeSend = SentryOptions.BeforeSendCallback { event, hint -> if (event.exceptions?.any { exception -> exception.stacktrace?.frames?.any { frame -> frame.module?.startsWith("com.example.lib") == true } == true } == true) { re...
Replies: 1 comment 2 replies
-
hi, sorry I'm not sure I got your problem exactly - would you like to filter out some certain sentry events? inAppExclude is not meant for that, it's meant for marking some stackframes as in-app or not, but not really for filtering out the events.
If you would like some events to be dropped, you can use as mentioned here, but check for events from the lib that you'd like to capture:
SentryAndroid.init(context) { options -> options.beforeSend = SentryOptions.BeforeSendCallback { event, hint -> if (event.exceptions?.any { exception -> exception.stacktrace?.frames?.any { frame -> frame.module?.startsWith("com.example.lib") == true } == true } == true) { return@BeforeSendCallback event } null } }
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Sorry for the late reply but it took us some time in our end to test the code you provided, I think I wasn't clear what I wanted. I wanted to exclude all events from my app by default and wanted only events from a library I'm adding.
Also tried the above code and didn't work did the above code filter event which are produced in particular package ? we were getting all events in sentry
Beta Was this translation helpful? Give feedback.
All reactions
-
@romtsn, hey good news, the code you provided worked perfectly, the issue was with auto-initialisation overriding this initialisation. Once we disabled auto-init this worked.
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 1