Skip to content

impr: Deprecate App Hang tracking - #8944

Draft
philprime wants to merge 10 commits into
mainfrom
impr/deprecate-app-hang-tracking
Draft

impr: Deprecate App Hang tracking#8944
philprime wants to merge 10 commits into
mainfrom
impr/deprecate-app-hang-tracking

Conversation

@philprime

@philprime philprime commented Sep 4, 2026

Copy link
Copy Markdown
Member

Deprecates the legacy App Hang tracking APIs before their removal in v10. The warnings explain that legacy tracking can produce less relevant stack traces and false positives, and direct users to MetricKit for system-provided hang diagnostics.

Compatibility

appHangTimeoutInterval remains supported because v10 still uses it for watchdog termination classification. Tests continue exercising the deprecated APIs under explicit deprecation annotations or local Objective-C warning suppression.

Related documentation: getsentry/sentry-docs#19263

Verification

  • make format
  • make analyze
  • make generate-public-api
  • make build-ios FOR_AGENTS=true
  • make build-macos FOR_AGENTS=true
  • make test-ios FOR_AGENTS=true
  • Targeted SentryObjCTests on macOS

Closes #5263
Closes #8945

Warn users before the legacy integration is removed in v10 and direct them to MetricKit for system-provided hang diagnostics.

Keep appHangTimeoutInterval supported because watchdog termination classification still uses it in v10.
@philprime philprime self-assigned this Sep 4, 2026
@philprime philprime added the run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request label Sep 4, 2026
@philprime
philprime marked this pull request as ready for review September 4, 2026 07:29

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 543613f. Configure here.

Comment thread SentryTestUtils/Sources/TestOptions.swift Outdated
@sentry

sentry Bot commented Sep 4, 2026

Copy link
Copy Markdown

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
SDK-Size io.sentry.sample.SDK-Size 9.27.0 (1) Release

⚙️ sentry-cocoa Build Distribution Settings

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1219.85 ms 1263.06 ms 43.21 ms
Size 24.14 KiB 1.32 MiB 1.29 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
fc4e913 1231.79 ms 1267.89 ms 36.11 ms
6f28fd8 1229.98 ms 1271.73 ms 41.75 ms
a7c42d9 1217.25 ms 1253.98 ms 36.73 ms
230cc86 1225.33 ms 1258.67 ms 33.34 ms
5556249 1208.87 ms 1246.60 ms 37.72 ms
8ed81c1 1227.47 ms 1249.24 ms 21.77 ms
92fada5 1217.60 ms 1252.89 ms 35.30 ms
6d9f89d 1226.37 ms 1260.94 ms 34.57 ms
318f8af 1213.09 ms 1246.21 ms 33.13 ms
01ffe09 1208.52 ms 1240.94 ms 32.42 ms

App size

Revision Plain With Sentry Diff
fc4e913 24.14 KiB 1.17 MiB 1.15 MiB
6f28fd8 24.14 KiB 1.30 MiB 1.28 MiB
a7c42d9 24.14 KiB 1.15 MiB 1.13 MiB
230cc86 24.14 KiB 1.25 MiB 1.23 MiB
5556249 24.14 KiB 1.29 MiB 1.27 MiB
8ed81c1 24.14 KiB 1.23 MiB 1.21 MiB
92fada5 24.14 KiB 1.17 MiB 1.15 MiB
6d9f89d 24.14 KiB 1.26 MiB 1.23 MiB
318f8af 24.14 KiB 1.30 MiB 1.28 MiB
01ffe09 24.14 KiB 1.29 MiB 1.27 MiB

Previous results on branch: impr/deprecate-app-hang-tracking

Startup times

Revision Plain With Sentry Diff
6d66ae9 1219.29 ms 1252.59 ms 33.30 ms
bd9d458 1213.10 ms 1250.21 ms 37.10 ms

App size

Revision Plain With Sentry Diff
6d66ae9 24.14 KiB 1.32 MiB 1.29 MiB
bd9d458 24.14 KiB 1.32 MiB 1.29 MiB

@NinjaLikesCheez NinjaLikesCheez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall, LGTM - but I have 3 comments for your consideration before merging.

Comment on lines +436 to +439
@property (nonatomic) BOOL enableAppHangTracking
__attribute__((deprecated("App Hang tracking is deprecated and will be removed in v10 because "
"it can produce less relevant stack traces and false positives. "
"Migrate to MetricKit for system-provided hang diagnostics.")));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

h: 'Migrate to MetricKit' is a little confusing - do you mean they should migrate to our MetricKit integration? If so, we should state more directly what a user should do and add a compiler fixit

Suggested change
@property (nonatomic) BOOL enableAppHangTracking
__attribute__((deprecated("App Hang tracking is deprecated and will be removed in v10 because "
"it can produce less relevant stack traces and false positives. "
"Migrate to MetricKit for system-provided hang diagnostics.")));
@property (nonatomic) BOOL enableAppHangTracking
__attribute__((deprecated("App Hang tracking is deprecated and will be removed in v10 because "
"it can produce less relevant stack traces and false positives. "
"Enable the MetricKit integration for system-provided hang diagnostics.", "enableMetricKit")));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The same replacement could happen to the rest of the 'enableX' APIs

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.

I agree with @NinjaLikesCheez, enable enableMetrics sounds more natural and actionable

#if !SDK_V10
@objc public var enableReportNonFullyBlockingAppHangs: Bool {
get { wrapped.enableReportNonFullyBlockingAppHangs }
@available(*, deprecated, message: "App Hang tracking is deprecated and will be removed in v10 because it can produce less relevant stack traces and false positives. Migrate to MetricKit for system-provided hang diagnostics.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as the objc version - we can (ab)use renamed: <...> to have a similar outcome for v9 users.

@itaybre itaybre 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.

LGTM after the wording changes

Comment on lines +436 to +439
@property (nonatomic) BOOL enableAppHangTracking
__attribute__((deprecated("App Hang tracking is deprecated and will be removed in v10 because "
"it can produce less relevant stack traces and false positives. "
"Migrate to MetricKit for system-provided hang diagnostics.")));

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.

I agree with @NinjaLikesCheez, enable enableMetrics sounds more natural and actionable

@philprime

Copy link
Copy Markdown
Member Author

Moving this PR back into draft until I have fully validated MetricKit hang diagnostics

@philprime
philprime marked this pull request as draft September 7, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

impr: Deprecate App Hang tracking App Hang/Session Replay should use runloop observers

3 participants