Repository navigation
Conversation
Use the Swift MetricKit stream on iOS 27 and the MX subscriber on older systems. Preserve diagnostic-time context and report watchdog hangs without affecting the running session. Attach available fatal stack trees in flame graph mode and retain raw termination reasons as structured mechanism data. Add sample triggers and regression coverage for fatality, empty stacks, and API selection.
| ### Features | ||
|
|
||
| - Add experimental MetricKit hang flame graph attachments via `options.experimental.metrickit.hangReportingMode = .flamegraphAttachment`, also available through `SentryObjC`. The default `.legacy` mode reports the flattened call stack tree, which is also retained when flame graph attachment creation fails (#9347, #9421) | ||
| - Report MetricKit watchdog terminations as fatal hangs with structured termination metadata. Flame graph mode also attaches the recorded watchdog stack trees, omitting threads without stacks. Use the Swift MetricKit API with diagnostic-time state context on iOS 27 and the existing subscriber on older systems (#9425) |
Contributor
There was a problem hiding this comment.
- 🚫 The changelog entry seems to be part of an already released section
## 9.31.0.
Consider moving the entry to the## Unreleasedsection, please.
Contributor
|
Size Analysis1 component analyzed iOS Builds
|
📲 Install BuildsiOS
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Use the Swift MetricKit diagnostic stream on iOS 27 and the existing MX subscriber on older systems, rather than subscribing to both. Report watchdog terminations as fatal hangs and preserve diagnostic-time environment and StateReporting context when available.
Fatal hang messages stay concise, with the original termination reason in mechanism data. Flame graph mode attaches the recorded watchdog stack trees and ignores threads without stacks. The sample includes separate fatal and non-fatal hang triggers.
Motivation and Context
Watchdog terminations arrive as crash diagnostics, so treating only hang diagnostics as hangs misses fatal cases. The Swift API provides a typed watchdog category instead of requiring a match against the human-readable termination reason.
A watchdog flame graph represents the available termination snapshot, not a sampled history of the entire hang. The separate V9 app-hang tracker can still report its own event without a flame graph.
How did you test it?
Formatting, static analysis, the iOS SDK build, iOS test compilation, and focused macOS MetricKit tests passed before the final structural cleanup. iOS tests and UI tests were not executed. The latest sample build hit a shared-derived-data header conflict, and its isolated rebuild was stopped. Further validation and the lint commit hook were skipped on request.
Device events used during investigation, recorded before the final API-selection and message cleanup:
The non-fatal pair contained matching flame graph attachments. The fatal Swift report supplied the watchdog snapshot with empty threads used to reproduce the missing-attachment regression. StateReporting arrays in these device reports were empty, so populated state enrichment still needs device verification.
Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.