-
-
Notifications
You must be signed in to change notification settings - Fork 60
feat: app hang capture on desktop #2709
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
20bfd1c
fixed debug symbol upload project name
bitsandfoxes 360e3cf
Add app-hang heartbeat coroutine to SentryMonoBehaviour
bitsandfoxes c9146d5
Forward app-hang options to sentry-native
bitsandfoxes c94b7c6
Start app-hang heartbeat coroutine on native init
bitsandfoxes 74d6a36
Mention macOS in app-hang tracking tooltip
bitsandfoxes eab0f31
Disable C# ANR watchdog on macOS when native app-hang tracking is ena…
bitsandfoxes 24b23bd
Bump sentry-native to include the app hang feature
bitsandfoxes 1956fe4
tweak
bitsandfoxes ecdb6be
bumped sentry-native, targeting desktop
bitsandfoxes 3a715d3
tooltips and logs
bitsandfoxes 8350c0b
app hangs in integration test
bitsandfoxes c1ca597
updated changelog
bitsandfoxes 38d98a7
run app hang test on macos with sentry-native
bitsandfoxes 7a8d8c7
comments
bitsandfoxes 9a29a04
reverted changelog
bitsandfoxes c9450bd
updated changelog
bitsandfoxes f607f51
made native app hang tracking experimental
bitsandfoxes dd8b25c
fixed bridge method names
bitsandfoxes bc0eeaf
Apply suggestion from @bitsandfoxes
bitsandfoxes 7355756
bumped native
bitsandfoxes 61558ce
updated changelog
bitsandfoxes cfe79c1
.
bitsandfoxes f0b1505
Update CHANGELOG.md
bitsandfoxes 5b384a7
make the heartbeat reentrant
bitsandfoxes 37b571c
Merge branch 'feat/native-app-hang' of https://github.com/getsentry/s…
bitsandfoxes b6665e1
Apply suggestion from @JoshuaMoelans
bitsandfoxes c5dfc59
added switch stubs
bitsandfoxes bb51773
Merge branch 'main' into feat/native-app-hang
bitsandfoxes 01be258
updated changelog
bitsandfoxes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Submodule sentry-native
updated
4 files
| +5 −3 | include/sentry.h | |
| +0 −6 | src/sentry_app_hang_monitor.c | |
| +11 −0 | src/sentry_app_hang_monitor.h | |
| +9 −0 | src/sentry_options.c |
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using System; | ||
| using System.Collections; | ||
| using UnityEngine; | ||
|
|
||
| namespace Sentry.Unity; | ||
|
|
||
| /// <summary> | ||
| /// Drives the periodic heartbeat used by sentry-native's app-hang detection. | ||
| /// The coroutine runs on the Unity main thread, which is the thread the native | ||
| /// daemon latches onto as the monitored target. | ||
| /// </summary> | ||
| public partial class SentryMonoBehaviour | ||
| { | ||
| private static readonly TimeSpan AppHangHeartbeatInterval = TimeSpan.FromSeconds(1); | ||
|
|
||
| private Coroutine? _appHangHeartbeat; | ||
|
|
||
| /// <summary> | ||
| /// Starts the app-hang heartbeat on the main thread at a fixed 1-second interval. Arming is | ||
| /// deferred until the player loop is running (see <see cref="AppHangHeartbeatCoroutine"/>) so | ||
| /// the synchronous startup stall isn't reported as a hang. | ||
| /// </summary> | ||
| public Coroutine StartAppHangHeartbeat(Action heartbeat) => | ||
| StartAppHangHeartbeat(heartbeat, AppHangHeartbeatInterval); | ||
|
|
||
| // Internal overload so tests can use a short interval. | ||
| internal Coroutine StartAppHangHeartbeat(Action heartbeat, TimeSpan interval) | ||
| { | ||
| if (_appHangHeartbeat is not null) | ||
| { | ||
| StopCoroutine(_appHangHeartbeat); | ||
| } | ||
|
|
||
| _appHangHeartbeat = StartCoroutine(AppHangHeartbeatCoroutine(heartbeat, interval)); | ||
| return _appHangHeartbeat; | ||
| } | ||
|
|
||
| private IEnumerator AppHangHeartbeatCoroutine(Action heartbeat, TimeSpan interval) | ||
| { | ||
| // Skipping the first frame. The first heartbeat both latches the main thread as the | ||
| // monitored target and arms detection. The monitor no-op without having received a | ||
| // heartbeat. During startup, splash screen plus the first scene load routinely block the | ||
| // main thread longer than the hang timeout and would cause false positives. | ||
| // This also works in batchmode/headless (e.g. LinuxServer), unlike WaitForEndOfFrame. | ||
| yield return null; | ||
| heartbeat(); | ||
|
|
||
| var wait = new WaitForSecondsRealtime((float)interval.TotalSeconds); | ||
| while (true) | ||
| { | ||
| yield return wait; | ||
| heartbeat(); | ||
| } | ||
| } | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.