fix: Add foreground state to app context in app hang events#7801
Merged
fix: Add foreground state to app context in app hang events#7801
Conversation
Set app.in_foreground and app.is_active when creating new app hang events in SentryHangTrackingIntegration, so persisted and fatal app hangs always carry the expected foreground context.
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Deps
🤖 This preview updates automatically when you update the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7801 +/- ##
=============================================
+ Coverage 85.434% 85.441% +0.007%
=============================================
Files 487 487
Lines 29261 29269 +8
Branches 12671 12658 -13
=============================================
+ Hits 24999 25008 +9
+ Misses 4212 4210 -2
- Partials 50 51 +1
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
philprime
approved these changes
Apr 20, 2026
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0e4b033 | 1203.74 ms | 1249.71 ms | 45.97 ms |
| bbee1ba | 1197.79 ms | 1215.42 ms | 17.63 ms |
| 59981b9 | 1207.25 ms | 1240.71 ms | 33.46 ms |
| 64a365a | 1225.60 ms | 1255.49 ms | 29.89 ms |
| 93d7fdf | 1225.77 ms | 1259.79 ms | 34.02 ms |
| e03f459 | 1222.56 ms | 1255.94 ms | 33.37 ms |
| ffac605 | 1217.10 ms | 1256.91 ms | 39.81 ms |
| 2f4ddaa | 1227.26 ms | 1260.04 ms | 32.78 ms |
| 778dadf | 1207.69 ms | 1246.09 ms | 38.40 ms |
| daf8b80 | 1233.78 ms | 1259.44 ms | 25.66 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0e4b033 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| bbee1ba | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 59981b9 | 24.14 KiB | 1.09 MiB | 1.06 MiB |
| 64a365a | 24.14 KiB | 1.09 MiB | 1.06 MiB |
| 93d7fdf | 24.14 KiB | 1.11 MiB | 1.08 MiB |
| e03f459 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| ffac605 | 24.14 KiB | 1.13 MiB | 1.10 MiB |
| 2f4ddaa | 24.14 KiB | 1.04 MiB | 1.02 MiB |
| 778dadf | 24.14 KiB | 1.04 MiB | 1.02 MiB |
| daf8b80 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
Co-authored-by: Philip Niedertscheider <phil.niedertscheider@sentry.io>
…y/sentry-cocoa into fix/app-hang-foreground-context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Set app.in_foreground and app.is_active when creating new app hang events in SentryHangTrackingIntegration, so persisted and fatal app hangs always carry the expected foreground context.
💡 Motivation and Context
Closes #5725
💚 How did you test it?
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.