Skip to content

feat(metrickit): Capture app launch diagnostics - #9441

Draft
itaybre wants to merge 1 commit into
feat/metrickit-diagnostic-optionsfrom
feat/metrickit-app-launch-diagnostics
Draft

itaybre wants to merge 1 commit into
feat/metrickit-diagnostic-optionsfrom
feat/metrickit-app-launch-diagnostics

Conversation

@itaybre

@itaybre itaybre commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Capture MetricKit app launch diagnostics. MXAppLaunchDiagnostic reports slow launches with the launch duration and a call stack on iOS 16 and later and on visionOS, but the SDK ignored it.

Stacked on #9267. The base switches to main once that merges.

Option

SentryMetricKit.DiagnosticReport gains appLaunch:

// v9: opt in through the report set. enableMetricKit = true keeps
// capturing cpuException, diskWriteException and hang only.
options.experimental.metrickit.enabledDiagnosticReports = [.hang, .appLaunch]

// V10: the default set is [.cpuException, .diskWriteException, .hang, .appLaunch].

The case exists on every platform so the same configuration compiles everywhere, while MXAppLaunchDiagnostic is only referenced under os(iOS) || os(visionOS) behind an iOS 16 availability check. On macOS it never produces events.

Event

Each diagnostic becomes a handled warning event with exception type MXAppLaunchDiagnostic, mechanism mx_app_launch_diagnostic, the value MXAppLaunchDiagnostic launchDuration:<duration> and the stack trace of the converted call stack tree, the same reduction CPU and disk write exceptions use. isMetricKitEvent picks up the new mechanism, so the client doesn't attach current threads, screenshots or the view hierarchy.

Sample app

The iOS-Swift sample blocks the main thread for 8 seconds at launch while the --io.sentry.metric-kit.slow-launch override is on. Like other sample overrides it is available as a scheme launch argument and in the settings screen, and it ignores "disable everything". The shared SDK wrapper enables .appLaunch in v9 builds too.

Fixes #9272

MetricKit reports slow app launches through MXAppLaunchDiagnostic on
iOS 16 and later and on visionOS, but the SDK ignored them. Add an
appLaunch diagnostic report and capture each diagnostic as a handled
warning event with the launch duration and the converted call stack.

Before v10 apps opt in by adding .appLaunch to enabledDiagnosticReports,
so enableMetricKit keeps capturing the same reports. In v10 the default
set of diagnostic reports includes it.

The iOS-Swift sample app slows down its launch while the
--io.sentry.metric-kit.slow-launch override is on.

Fixes #9272
@itaybre itaybre added the run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 3280828

@sentry

sentry Bot commented Oct 23, 2026

Copy link
Copy Markdown

📲 Install Builds

iOS

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

⚙️ sentry-cocoa Build Distribution Settings

@sentry

sentry Bot commented Oct 23, 2026

Copy link
Copy Markdown

Size Analysis

1 component analyzed

iOS Builds

Name Configuration Version Download Size Install Size
SDK-Size (iOS)
io.sentry.sample.SDK-Size
Release 9.31.0 (1) 1.2 MB (+532 B) 3.1 MB (0 B)

Configure sentry-cocoa status check rules

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

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.

1 participant