Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2027年のMetricKit

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 2027年のMetricKit

Avatar for Kanta Oikawa

Kanta Oikawa

August 20, 2026

More Decks by Kanta Oikawa

Other Decks in Technology

Transcript

  1. 2 自己紹介 Kanta Oikawa - かんたっきー • 公立はこだて未来大学 修士2年 •

    修論を書き終えれば来年からiOSエンジニア • Twitter : @kanta̲cky
  2. 4 MetricKit iOS 13 - iOS 26 • MXMetricManagerSubscriber を実装

    • デリゲートメソッドでレポート受け取る • メトリクス MXMetricPayload • 起動時間、ハング、CPU/GPU/メモリ/ディスク書き込み/ネットワーク転送量、電力 • 独自区間のメトリクス MXSignpostMetric • 診断 MXDiagnosticPayload(iOS 14+) • クラッシュ/ハング/ディスク書き込み例外/CPU例外、コールスタック
  3. 5 MetricKit iOS 13 - iOS 26 class AppMetrics: NSObject,

    MXMetricManagerSubscriber { func receiveReports() { let manager = MXMetricManager.shared manager.add(self) } func pauseReports() { let manager = MXMetricManager.shared manager.remove(self) } // Receive daily metrics. func didReceive(_ payloads: [MXMetricPayload]) { // Process metrics. } } // Receive diagnostics immediately when available. func didReceive(_ payloads: [MXDiagnosticPayload]) { // Process diagnostics. }
  4. 6 MetricKit iOS 27+ • AsyncStreamでレポートを受け取る • メトリクス MetricReport •

    診断 DiagnosticReport • どちらのレポートもCodableに準拠
  5. 7 MetricKit iOS 27+ import MetricKit let manager = MetricManager()

    Task { for await report in manager.metricReports { process(report) } } Task { for await report in manager.diagnosticReports { process(report) } }
  6. 10 StateReporting ReportableMetadata import StateReporting @ReportableMetadata struct GraphicsSettings { let

    graphicsQuality: String let engineVersion: String @ReportableMetadataKey("api") let graphicsAPIName: String @ReportableMetadataIgnored let localCacheID: String } @ReportableMetadata struct GameplayVolatileMetadata { let playerHealth: Int }
  7. 11 StateReporting 状態遷移の報告とメタデータのアップデート let gameplayReporter = StateReporter.reporter( for: "com.mygame.gameplay", stableMetadata:

    GraphicsSettings.self, volatileMetadata: GameplayVolatileMetadata.self ) gameplayReporter.reportTransition( to: "Playing", stableMetadata: GraphicsSettings( graphicsQuality: "High", engineVersion: "1.2.3" ), volatileMetadata: GameplayVolatileMetadata(playerHealth: 100) ) gameplayReporter.reportVolatileMetadataUpdate( GameplayVolatileMetadata(playerHealth: 75) )
  8. 12 デバッグ • Xcode 27から実機でアプリを起動 • XcodeのDebug > MetricKit >

    Simulate MetricKit Payloads • ダミーのレポートを受け取ることができる • 本番と同じレポートは取得できない
  9. 15 他のツールとの比較 Instruments Xcode Organizer MetricKit Firebase Performance Datadog RUM

    計測できる場所 開発者端末 ユーザー端末 ユーザー端末 ユーザー端末 ユーザー端末 データソース OS OS OS SDK SDK 対象ユーザー 開発者自身 解析を共有をON 解析を共有をON すべて すべて リアルタイム リアルタイム リアルタイム性 即時 数日遅れ メトリクス=日次 診断=即時 粒度 関数・スレッド 集計 端末・日・状態 トレース・画面 セッション わかること なぜ遅いか 遅いという事実 どの状態で遅いか どの処理が遅いか 誰がいつ遅いか 無料 従量(高い) 有り 有り コスト 無料 無料 無料 送信先は自前 オーバーヘッド 有り ゼロ ほぼゼロ
  10. 16 References • MetricKit | Apple Developer Documentation • StateReporting

    | Apple Developer Documentation • Meet the new MetricKit - WWDC26