Skip to content

ref(anr): [Non-Fatal ANR 4] Run AnrProfilingIntegration on the HangManager - #6725

Open
markushi wants to merge 24 commits into
markushi/feat/non-fatal-anr-3-thread-sample-collectorfrom
markushi/feat/non-fatal-anr-4-wire-recorder
Open

markushi wants to merge 24 commits into
markushi/feat/non-fatal-anr-3-thread-sample-collectorfrom
markushi/feat/non-fatal-anr-4-wire-recorder

Conversation

@markushi

@markushi markushi commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Runs AnrProfilingIntegration on the HangManager and removes its own polling thread. The fatal ANR profile path keeps working. anrProfilingSampleRate is still drawn at each hang; only a sampled hang goes to the profile file (through AnrProfileStore). The profile now starts at 300 ms of hang instead of 1 s.

Design: Non-Fatal ANR Architecture (JAVA-777)

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

🤖 Generated with Claude Code

#skip-changelog

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 5ac8168.

Main concerns: public contract, data sent to Sentry, host performance.

Rules that block low also fired:

  • R4: a public API record changed: sentry-android-core/api/sentry-android-core.api

This label is a hint for reviewers, not an approval.

@markushi
markushi added this pull request to stack #6730 November 20, 2026 17:55
@sentry

sentry Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.65.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 23, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 24, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 24, 2026
@markushi markushi changed the title ref(anr): [Non-Fatal ANR 4] Run AnrProfilingIntegration on the HangRecorder ref(anr): [Non-Fatal ANR 4] Run AnrProfilingIntegration on the HangManager Nov 24, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 24, 2026
@markushi
markushi requested review from a team and adinauer as code owners November 24, 2026 12:42
@markushi
markushi requested review from 0xadam-brown and romtsn and removed request for a team November 24, 2026 12:42
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 24, 2026
@markushi
markushi removed this pull request from stack #6730 November 24, 2026 13:01
@markushi
markushi added this pull request to stack #6753 November 24, 2026 13:02
@github-actions github-actions Bot removed the risk: medium PR risk score: medium label Nov 25, 2026
@markushi
markushi removed this pull request from stack #6753 November 25, 2026 09:41
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 25, 2026
@markushi
markushi added this pull request to stack #6761 November 25, 2026 09:41
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 27, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 27, 2026

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

one comment about the clock!

}
final @NotNull Looper mainLooper = Looper.getMainLooper();
final @NotNull ThreadPoster mainThreadPoster = new HandlerThreadPoster(new Handler(mainLooper));
// options.getMonotonicTicker() counts device sleep, which would read as a hang.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah yeah that makes sense. in that case that changes the decision we made to only have a single clock that counts time during deep sleep. we should probably add a clock that doesn't count time spent during sleep and use it here. feel free to create that abstraction and name it as you see fit.

the other issue here too is that calling static methods like this means less testability.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants