getsentry / team-sdks

A meta repository for tracking work across all SDK teams.
0 stars 0 forks source link

Report as app context what's the current activity during the error #18

Closed marandaneto closed 7 months ago

marandaneto commented 1 year ago

I'd like to know which Activity/Screen was visible during the error (right now we only know if it's in the background or foreground). Right now it's only possible by looking at crumbs, I want to make this more visible. This should be searchable/alertable, I want to know which screens are getting more errors and alert only the screens I care the most. For transactions this is not needed since the Screen name is already the transaction name. I want to filter/alert errors that happened during screen X only.

For example, an error that happened after payment is less important than an error during the payment :P

### Tasks
- [ ] https://github.com/getsentry/sentry-java/issues/2664
- [ ] https://github.com/getsentry/sentry-cocoa/issues/3140
- [ ] https://github.com/getsentry/sentry-dart/issues/1411
- [ ] https://github.com/getsentry/sentry-react-native/issues/2994
- [ ] https://github.com/getsentry/relay/pull/2344

Other platforms to consider:

romtsn commented 1 year ago

We should define what would be the key for this in App context, this also requires some backend work to make it searchable, update relay with the new known key, etc.

brustolin commented 1 year ago

The navigation crumbs on Cocoa are based on viewDidAppear of UIViewControllers. While this helps you to understand which UIViewControllers are visible, it is not a reliable way of detecting on which screen the user currently is, as you can have nested UIViewControllers. On Android, we have a similar problem with single activity and fragments. So basically, we need a reliable way of reporting the current screen.

We could traverse the view controller tree to find out the root controller, but even this is not guaranteed to be correct.

krystofwoldrich commented 1 year ago

RN sends this information as a tag routing.route.name.

Could the key be:

event.contexts.app.screen event.contexts.app.view

kahest commented 12 months ago

As discussed for Cocoa here: https://github.com/getsentry/sentry-cocoa/issues/3140#issuecomment-1641992662

marandaneto commented 11 months ago

For android: https://github.com/skydoves/snitcher We can take a look at how on they track "current screen" for crashes.