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

Add In Foreground to App context #1260

Merged
merged 4 commits into from
Feb 7, 2023
Merged

Conversation

marandaneto
Copy link
Contributor

@marandaneto marandaneto commented Feb 1, 2023

📜 Description

Add In Foreground to App context

💡 Motivation and Context

Relates to getsentry/team-mobile#36

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@codecov
Copy link

codecov bot commented Feb 1, 2023

Codecov Report

Base: 90.11% // Head: 90.16% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (faf2626) compared to base (3e17cfa).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           v7.0.0    #1260      +/-   ##
==========================================
+ Coverage   90.11%   90.16%   +0.04%     
==========================================
  Files         164      164              
  Lines        5121     5136      +15     
==========================================
+ Hits         4615     4631      +16     
+ Misses        506      505       -1     
Impacted Files Coverage Δ
dart/lib/src/protocol/sentry_app.dart 100.00% <100.00%> (ø)
...nt_processor/flutter_enricher_event_processor.dart 94.18% <100.00%> (+1.59%) ⬆️
...ib/src/integrations/load_contexts_integration.dart 99.03% <100.00%> (+0.05%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@marandaneto
Copy link
Contributor Author

I'd like to add the event.thread.main=true|false as well but since Isolate.current always returns the main Isolate during unhandled callbacks, we can't really tell which Isolate threw the error, if it was the main or not.

Ideally, unhandled callbacks such as onError would return the faulty Isolate in the exception or even an extra parameter.

So its better to not report at all instead of reporting everything as the main Isolate.
@ueman ideas around this?

@ueman
Copy link
Collaborator

ueman commented Feb 1, 2023

With Flutter 3.7 you can actually initialize Sentry Flutter on a background isolate, where Isolate.current != 'main'. When the exceptions are passed from one isolate to another, I believe there's unfortunately no automatic way to detect it. For a lot of cases that's not a problem, though, I think. A lot of background computing is done with the compute() method from Flutter where the exception just gets rethrown. While the exception is technically from a background isolate, it still affects the main isolate.

@marandaneto marandaneto marked this pull request as ready for review February 6, 2023 14:15
Copy link
Collaborator

@brustolin brustolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants