Files
charleswiltgen__axiom/docs/reference/metrickit-ref.md
T
Charles Wiltgen f7b891d9d7 fix(axiom-performance,hooks): restore visionOS availability; harden the temp-root guard
Corrects two things the earlier commits in this area got wrong, and closes the
false positive they left open.

CrashReportExtension visionOS availability. e5f1018b dropped the visionOS claim
on the strength of developer.apple.com symbol-page badges; the SDK contradicts
them. Against the installed Xcode 27 SDK,
'xcrun --sdk xros swiftc -typecheck -target arm64e-apple-xros27.0' compiles
clean, xros26.0 reports "only available in visionOS 27.0 or newer" (a version
gate, not an exclusion), while tvOS and watchOS report "unavailable" outright
and Mac Catalyst has no module at all. The .swiftinterface carries
@available(iOS 27.0, macOS 27.0, *) with @available(tvOS, unavailable) and
@available(watchOS, unavailable), and no visionOS clause. Apple's pages disagree
with one another, so the SDK leads: skill text, the version-support row and the
docs page are restored with the reasoning inline.

Temp-root guard. Three ways the guard added by ba04043b could still misjudge a
project:
- a TMPDIR-less process got /tmp from tempfile.gettempdir(), leaving the macOS
  per-user scratch root unneutralized and the original false positive alive for
  any launcher that scrubs the environment — roots now also come from the
  filesystem on darwin (containers and their T/ dirs);
- a relative TMPDIR resolved against the detector's own cwd — the project being
  judged — turning a real Apple project into a "temp root" and silently
  disabling Axiom; only absolute values are accepted;
- the scan-root guard ran before the repo-root exemption, so a repo rooted at a
  temp root (devcontainer or CI exporting TMPDIR to the workspace, or a clone in
  /tmp) read as non-Apple; the exemption now wins.

Mirrored into axiom-pi/src/session.ts with the same three tests; the parity
matrix gained a repo-rooted-at-a-temp-root case and TMPDIR control.

Verified: detector 54/54, axiom-pi 69/69 + typecheck, npm test PASS, test:unit
exit 0, check:cursor clean, docs build clean.
2026-09-15 10:52:34 -07:00

4.3 KiB
Raw Blame History

name, description
name description
metrickit-ref MetricKit API reference for field diagnostics -- the 27-cycle Swift API (MetricManager, MetricResult, StateReporting) plus legacy MXMetricPayload, MXDiagnosticPayload, MXCallStackTree

MetricKit Reference

Complete API reference for collecting field performance metrics and diagnostics using MetricKit. Covers the new Swift-first API from the 27 platform releases (MetricManager, typed metrics and diagnostics, per-state metrics via StateReporting) alongside the legacy MX* payload API, call stack symbolication, and integration patterns.

When to Use This Reference

Use this reference when:

  • Setting up MetricKit collection — the new MetricManager AsyncSequence streams (27) or a legacy MXMetricManagerSubscriber
  • Migrating from MXMetricManager to the new Swift API
  • Splitting field metrics by app state (per-tab, per-experiment) with the StateReporting framework
  • Parsing typed MetricReport/DiagnosticReport values or legacy MXMetricPayload/MXDiagnosticPayload
  • Symbolicating MetricKit call-stack frames with dSYMs
  • Understanding background exit reasons (jetsam, watchdog, CPU limit)
  • Building a crash reporter extension with the CrashReportExtension framework (27)
  • Integrating MetricKit alongside a crash reporter like Crashlytics or Sentry

Example Prompts

Questions you can ask Claude that will draw from this reference:

  • "How do I set up MetricKit to collect crash data?"
  • "How do I migrate from MXMetricManager to MetricManager?"
  • "Can I get hitch metrics per tab or per experiment arm?"
  • "Where did the scroll hitch metric go in the new MetricKit API?"
  • "How do I attach custom metadata to my reported app states?"
  • "How do I symbolicate MetricKit call stacks?"
  • "What background exit types does MetricKit track?"
  • "How do I use MetricKit signpost metrics for custom operations?"
  • "How do I build a crash reporter extension?"
  • "What's the difference between MetricKit and Xcode Organizer?"

What's Covered

  • The new Swift API (27): MetricManager setup, MetricReport interval entries, the full MetricResult metric inventory (including Metal frame rate and storage metrics, and HitchTimeMetric with its HitchTimeRatio unit — the Swift API has no scroll-specific hitch metric), launch-task tracking, typed diagnostics with termination categories, and memory exception diagnostics
  • Per-state metrics: StateReporting domains, state transitions, the @ReportableMetadata macro, and state-grouped report encoding
  • Crash reporter extensions (27, iOS/iPadOS/macOS/visionOS): the CrashReportExtension framework — CrashedProcess, in-extension symbolication, binary image inventory, and the extension-point setup
  • Migration map from the soft-deprecated MX* API to the 27 API
  • MXMetricManagerSubscriber setup and registration timing (legacy)
  • MXMetricPayload: CPU, memory, launch time histograms, disk I/O, network, scroll hitches, signpost metrics
  • MXDiagnosticPayload: crash, hang, disk write exception, and CPU exception diagnostics
  • MXCallStackTree JSON parsing and symbolication with atos
  • MXBackgroundExitData: all 10 exit types with interpretation and recommended actions
  • Integration patterns: analytics upload, hybrid crash reporting, regression alerting
  • MetricKit vs Xcode Organizer comparison
  • Common gotchas: daily metric delivery, opt-in only, simulator limitations, unsymbolicated stacks, state rate limiting

Documentation Scope

This page documents the axiom-performance reference skill -- the complete MetricKit API guide Claude uses when you need to collect and analyze field performance data.

For profiling during development: See xctrace-ref for CLI-based Instruments profiling.

For App Store Connect metrics: See app-store-connect-ref for the web dashboard view of performance data.

For hang diagnosis: See the axiom-performance skill for hang-specific workflows.

Resources

WWDC: 2019-417, 2020-10081, 2021-10087, 2026-222

Docs: /metrickit, /metrickit/metricmanager, /statereporting, /crashreportextension, /metrickit/mxmetricmanager, /metrickit/mxdiagnosticpayload