Expose Cocoa MetricKit report selection (enabledMetricReports / enabledDiagnosticReports)

オープン
#6,988 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ios, react-native, typescript
領域
mobile

調査の方向性

Start with packages/core/src/js/options.ts and packages/core/ios/RNSentryStart.m, then trace how wrapper.ts forwards options to native. First verify on a device whether an untyped metrickit dictionary reaches Cocoa; then check Cocoa’s accepted diagnostic report values and the experimental API pattern. Done means typed, documented options pass native tests and work across the listed build modes, architectures, and platforms.

索引モデルが issue の本文から書いたものです。

説明

Cocoa Feature iOS React-Native
Problem

sentry-cocoa 9.33.0 (bumped in #6987) lets apps choose which MetricKit reports the SDK collects. The RN SDK has no way to set this today. It only exposes enableMetricKit and enableMetricKitRawPayload (packages/core/src/js/options.ts).

New in Cocoa 9.33.0:

  • options.experimental.metrickit.enabledMetricReports can now be set through the enabledMetricReports key of the metrickit options dictionary, which also accepts "all" (getsentry/sentry-cocoa#9490).
  • New metric reports on iOS/macOS 27+: animationTotalHitchTime, animationTotalAnimationTime, metalFramesPerSecond, metalFrameCount, metalActiveDrawingDuration. On 27+, animationScrollHitchTimeRatio is no longer sent (getsentry/sentry-cocoa#9476).
  • Memory exception diagnostics on iOS 27+, collected when enabledDiagnosticReports contains .memoryException (getsentry/sentry-cocoa#9465).
Why this isn't blocked like #6926

SentryExperimentalOptions.metrickit is @nonobjc, which is part of what blocks #6926. But RN builds Cocoa options with RNSentryInternal optionsFromDictionary (packages/core/ios/RNSentryStart.m), and JS forwards options it doesn't know about to native (wrapper.ts initNativeSdk spreads the remaining options). So the new metrickit dictionary key should reach Cocoa's own parser without a Swift shim. That means metrickit: { enabledMetricReports: 'all' } may already work today, just without types. This hasn't been checked on a device.

Proposal

Wait until Cocoa takes these options out of experimental. Cocoa made a breaking change to the MetricReport enum in 9.33.0, so the shape is still changing. After that:

  • Add a typed, iOS-only option under _experiments, for example _experiments.metricKit: { enabledMetricReports?: string[] | 'all'; enabledDiagnosticReports?: string[] | 'all' }, and pass it through as Cocoa's metrickit dictionary.
  • Check which enabledDiagnosticReports values the dictionary parser accepts. #9490 only mentions enabledMetricReports.
  • Document that this only works when enableMetricKit: true, and which reports need iOS 27+.
Acceptance criteria
  • Verified on a device whether an untyped metrickit dictionary already reaches Cocoa (and record the result).
  • Typed experimental option added, with JSDoc, and the API report regenerated.
  • Works with CocoaPods (static/dynamic) and SwiftPM, on the old and new architecture. It does nothing on Android and other platforms.
  • Tests cover the option being passed to the native options.

Related: #6926, #6457, #6987

主要言語
TypeScript
スター
1.8k
フォーク
371
平均マージ
22時間 3分
マージ済み PR(30日)
106

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-react-native のほかの issue

getsentry/sentry-react-native の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。