Skip to content

Conversation

@bitsandfoxes
Copy link
Contributor

There is a difference in how the integration works based on whether the SDK can make use of multi threaded - or not.

@codeowner-assignment codeowner-assignment bot requested a review from a team September 8, 2025 12:36
@vercel
Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
develop-docs Ready Ready Preview Comment Sep 9, 2025 9:24am
sentry-docs Ready Ready Preview Comment Sep 9, 2025 9:24am

@codecov
Copy link

codecov bot commented Sep 9, 2025

Bundle Report

Changes will decrease total bundle size by 1.19kB (-0.01%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 9.91MB -6 bytes (-0.0%) ⬇️
sentry-docs-server-cjs* 12.59MB -1.19kB (-0.01%) ⬇️

ℹ️ *Bundle size includes cached data from a previous commit

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 882.71kB -0.0%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
static/Dst-*.js (New) 77 bytes 77 bytes 100.0% 🚀
static/Dst-*.js (New) 684 bytes 684 bytes 100.0% 🚀
static/fZZ6NBkK5PueEszhjEYnV/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/fZZ6NBkK5PueEszhjEYnV/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.78MB -0.0%
../instrumentation.js -3 bytes 1.1MB -0.0%
9523.js -3 bytes 1.08MB -0.0%
../app/[[...path]]/page.js.nft.json -392 bytes 797.47kB -0.05%
../app/platform-redirect/page.js.nft.json -392 bytes 797.38kB -0.05%
../app/sitemap.xml/route.js.nft.json -392 bytes 794.86kB -0.05%

On platforms that do no support multithreading the ANR detection falls back to relying on the coroutine itself to report if the last time it executed exceeds the timeout.
### Platforms with Multi-Threading Support

On platforms that support multithreading, the ANR detection works in two parts:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
On platforms that support multithreading, the ANR detection works in two parts:
On platforms that support multithreading, the ANR detection has two components:


On platforms that support multithreading, the ANR detection works in two parts:
1. A coroutine periodically resets a counter
2. A background thread increments and monitors this counter. It reports an ANR event when the threshold defined on `options.AnrTimeout` is exceeded
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
2. A background thread increments and monitors this counter. It reports an ANR event when the threshold defined on `options.AnrTimeout` is exceeded
2. A background thread increments and monitors this counter, triggering an ANR event when the value exceeds the threshold defined in `options.AnrTimeout`.

### Platforms without Multi-Threading Support - WebGL

On platforms without multi-threading support like WebGL, the ANR detection uses a slightly different approach:
- A single coroutine using a `Stopwatch` to measure elapsed time
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- A single coroutine using a `Stopwatch` to measure elapsed time
- A single coroutine uses a `Stopwatch` to measure elapsed time

- A single coroutine using a `Stopwatch` to measure elapsed time
- When the coroutine detects that more time has passed than the ANR timeout, it reports the ANR event

The drawback here is that the ANR detection relies on the game recovering from the not-responding state to report the event.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The drawback here is that the ANR detection relies on the game recovering from the not-responding state to report the event.
The drawback here is that the ANR detection relies on the game recovering from the non-responsive state to report the event.

Copy link
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

LGTM!

@bitsandfoxes bitsandfoxes merged commit 7953c44 into master Sep 15, 2025
13 checks passed
@bitsandfoxes bitsandfoxes deleted the fix/unity-anr branch September 15, 2025 15:38
The ANR detection in the Unity SDK works differently depending on whether multithreading is available on the target platform:

On platforms that do no support multithreading the ANR detection falls back to relying on the coroutine itself to report if the last time it executed exceeds the timeout.
### Platforms with Multi-Threading Support
Copy link
Member

Choose a reason for hiding this comment

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

give an example of what this is.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants