Deprecate iOS App Hang tracking in favor of MetricKit and expose new Cocoa MetricKit/serializer APIs
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- objective-c, react-native, swift, typescript
- 領域
- documentation, mobile
調査の方向性
Start with packages/core/src/js/options.ts, packages/core/src/js/sdk.tsx, packages/core/ios/SentrySDKWrapper.m, and the native bridge spec to map the deprecated APIs and Objective-C call sites. The Swift shim must be validated against CocoaPods and SwiftPM before MetricKit and serializer APIs can be exposed; backend flame-graph support remains a prerequisite. Done means the deprecations and warning are covered, the bridge uses SentrySDK.internal.serializer, the new experiment is exposed when supported, and the migration guide and default decision are recorded.
索引モデルが issue の本文から書いたものです。
説明
[!IMPORTANT]
Blocked. Two things have to happen first:
- iOS bridge: the new Cocoa MetricKit and serializer APIs are Swift-only, so the RN Objective-C bridge can't reach them. The RNSentry pod needs a Swift shim, or we need a
SentryObjCdependency (see Swift access below).- Backend: Sentry doesn't support MetricKit hang flame graph attachments yet.
Problem
sentry-cocoa has deprecated App Hang tracking and will remove it in v10. The stated reason is that it "can produce less relevant stack traces and false positives". Cocoa recommends the MetricKit integration instead, for hang diagnostics provided by the system. These deprecations are already in the Cocoa version we bundle (9.30.2 and later).
The RN SDK still exposes the deprecated surface without any deprecation notice. It also turns app hang tracking on by default, while MetricKit is off by default:
| RN surface | Location | Cocoa status |
|---|---|---|
enableAppHangTracking (default true) |
packages/core/src/js/options.ts |
Deprecated, removed in v10 |
appHangTimeoutInterval |
packages/core/src/js/options.ts |
Tied to app hang tracking (Cocoa also uses it to classify watchdog terminations, which needs checking) |
pauseAppHangTracking() / resumeAppHangTracking() |
packages/core/src/js/sdk.tsx, public barrel, NativeRNSentry.ts bridge spec |
SWIFT_DEPRECATED_MSG, removed in v10 |
enableMetricKit (default false) |
packages/core/src/js/options.ts |
The recommended replacement |
Our iOS bridge (packages/core/ios/SentrySDKWrapper.m) calls the deprecated Cocoa methods, so iOS builds already show deprecation warnings.
If we do nothing, the Cocoa v10 bump becomes a breaking change for RN users with no migration path.
Scope
1. Deprecate app hang tracking in JS (non-breaking, 8.x minor)
- Add
@deprecatedJSDoc toenableAppHangTracking,appHangTimeoutInterval(pending the watchdog-termination check),pauseAppHangTrackingandresumeAppHangTracking. Point users toenableMetricKit. - Log a one-time debug warning when
enableAppHangTrackingis explicitly set totrue. - Update the
enableMetricKitdocs: it's the recommended way to get hang reporting on iOS 15+.
2. Expose MetricKit hang flame graphs (blocked: iOS bridge + backend)
Cocoa 9.31.0 adds options.experimental.metrickit.hangReportingMode = .flamegraphAttachment. Exposing it as _experiments.metricKitHangReportingMode: 'legacy' | 'flamegraphAttachment' (iOS only) would make MetricKit a stronger replacement for app hang tracking.
3. Move the bridge off serialize (blocked: iOS bridge)
Cocoa 9.31.0 adds SentrySDK.internal.serializer for hybrid SDKs, and the public SentrySerializable/serialize() goes away in v10 (it's already wrapped in #if !SDK_V10). Our bridge still calls [scope serialize] (RNSentry.mm) and [debugImage serialize] (RNSentry+fetchNativeStack.m).
Swift access (prerequisite for 2 and 3)
SentryExperimentalOptions.metrickitis@nonobjc.SentryMetricKitHangReportingModeis a plain Swift enum.SentryInternalSerializerApiis a Swift struct.
None of these can be called from our Objective-C bridge. There are two options:
- Add a small Swift shim to the RNSentry pod (preferred).
packages/core/ioshas no Swift sources today, so it needs to work with CocoaPods (static and dynamic frameworks), SwiftPM (Package.swift) and both architectures. - Depend on
SentryObjC. It ships as a separate xcframework, so this is a new native dependency and makes the bundle bigger.
4. Migration guide
- Explain how to go from
enableAppHangTrackingtoenableMetricKit: true. - Call out the differences:
- MetricKit needs iOS 15+.
- Its reports are delivered by the OS, usually on the next launch.
- There's no pause/resume equivalent. Explain how to handle the system dialog use case (permission prompts).
- Turning on both sources can report the same hang twice.
5. Defaults (needs discussion)
Should RN turn on enableMetricKit by default and/or turn off app hang tracking by default before the major? Follow whatever Cocoa does in v10 so the hybrid behavior matches.
6. Next major (paired with Cocoa v10)
Remove the deprecated app hang options, the exports and the two bridge spec methods. The bridge spec removal must keep working for older JS running against newer native and the other way round.
Acceptance criteria
- All app hang APIs listed above carry
@deprecatedJSDoc pointing toenableMetricKit, and the API report is regenerated. - Explicitly turning on
enableAppHangTrackinglogs a deprecation warning once. - Swift access to the Cocoa experimental and internal APIs works for CocoaPods (static/dynamic) and SwiftPM, on the old and new architecture.
-
_experiments.metricKitHangReportingModeis exposed once the backend supports flame graph attachments. - The bridge uses
SentrySDK.internal.serializerinstead ofserialize. - The docs migration guide is published.
- The default-values decision is recorded.
- The removal is tracked for the next major, paired with Cocoa v10.
Related: #6457, #6747, #6925
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 371
- 平均マージ
- 22時間 3分
- マージ済み PR(30日)
- 106
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-react-native のほかの issue
-
React-Native
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-react-native#7073 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Improvement React-Native
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
getsentry/sentry-react-native#7055 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
React-Native Replays Task
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
getsentry/sentry-react-native#6680 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Improvement React-Native
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
getsentry/sentry-react-native#6143 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
React-Native Task User Feedbacks
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
getsentry/sentry-react-native#5932 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry-react-native の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
danielmiessler/LifeOS#3028 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
Koenkk/zigbee2mqtt#33855 ·
メンテナーはふだん 1 日以内に返信