Skip to content

fix: Use different fallback for when MetricKit does not have file path#7473

Merged
noahsmartin merged 2 commits intomainfrom
metricKitInAppFallback
Feb 24, 2026
Merged

fix: Use different fallback for when MetricKit does not have file path#7473
noahsmartin merged 2 commits intomainfrom
metricKitInAppFallback

Conversation

@noahsmartin
Copy link
Copy Markdown
Contributor

@noahsmartin noahsmartin commented Feb 17, 2026

Sometimes metric kit only provides the binaryUUID and not the image name. This will break the in app logic and requires a full fix on the backend getsentry/sentry#108352

In the meantime though, I noticed this only ever occurring with frames that are in the app, so we can change this default to true for a slight improvement. It still won't work with overrides from the default in-app behavior.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 17, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • Use different fallback for when MetricKit does not have file path by noahsmartin in #7473
  • Don't report NSException subclasses as C++ exceptions by denrase in #7420
  • Don't finish network spans for suspended URL session tasks by denrase in #7471
  • Resolve data race crash in monitorCachedData by denrase in #7423

Internal Changes 🔧

Deps

  • Bump actions/checkout from 6.0.1 to 6.0.2 by dependabot in #7497
  • Bump getsentry/craft from 2.21.4 to 2.21.7 by dependabot in #7499
  • Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.21.4 to 2.21.7 by dependabot in #7498
  • Bump nokogiri from 1.19.0 to 1.19.1 by dependabot in #7489

Other

  • (core) Add SDK history doc by philipphofmann in #7505
  • (logs) Move span_id from attributes to top-level field by philprime in #7467
  • Bump xcodebuildmcp to 2.0.7 by philipphofmann in #7504
  • Replace DefaultSentryMetricsTelemetryBuffer with DefaultTelemetryBuffer by philipphofmann in #7485

Other

  • Making setOutput in SentrySDKLog.swift public to make it possible to forward logs to the JS console by alwx in #7444

🤖 This preview updates automatically when you update the PR.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.269%. Comparing base (d819e19) to head (8df8b8a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #7473       +/-   ##
=============================================
+ Coverage   85.240%   85.269%   +0.029%     
=============================================
  Files          479       479               
  Lines        28591     28600        +9     
  Branches     12421     12422        +1     
=============================================
+ Hits         24371     24387       +16     
+ Misses        4174      4166        -8     
- Partials        46        47        +1     
Files with missing lines Coverage Δ
...Core/MetricKit/SentryMXCallStackTree+Parsing.swift 100.000% <100.000%> (ø)

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d819e19...8df8b8a. Read the comment docs.

@noahsmartin noahsmartin added the ready-to-merge Use this label to trigger all PR workflows label Feb 17, 2026
@noahsmartin noahsmartin force-pushed the metricKitInAppFallback branch from 382d56d to 0b34ddb Compare February 17, 2026 17:15
@noahsmartin noahsmartin marked this pull request as ready for review February 17, 2026 17:15
Copy link
Copy Markdown
Contributor

@itaybre itaybre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing with @noahsmartin, this LGTM

@noahsmartin noahsmartin force-pushed the metricKitInAppFallback branch from 0b34ddb to 91e119a Compare February 18, 2026 18:30
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 18, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1222.14 ms 1255.24 ms 33.10 ms
Size 24.14 KiB 1.11 MiB 1.09 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d0b4402 1218.62 ms 1241.80 ms 23.18 ms
ffe0649 1213.35 ms 1248.64 ms 35.29 ms
1a887e2 1212.46 ms 1241.33 ms 28.87 ms
5ca545a 1219.06 ms 1244.59 ms 25.53 ms
d69379c 1211.30 ms 1234.77 ms 23.47 ms
a1a9260 1192.15 ms 1229.80 ms 37.64 ms
d492bc8 1214.12 ms 1242.19 ms 28.06 ms
9a34176 1227.24 ms 1266.22 ms 38.98 ms
680923d 1211.40 ms 1241.00 ms 29.60 ms
db9e223 1193.69 ms 1213.56 ms 19.87 ms

App size

Revision Plain With Sentry Diff
d0b4402 24.14 KiB 1.11 MiB 1.08 MiB
ffe0649 24.14 KiB 1.06 MiB 1.04 MiB
1a887e2 24.14 KiB 1.09 MiB 1.07 MiB
5ca545a 24.14 KiB 1.06 MiB 1.04 MiB
d69379c 24.14 KiB 1.11 MiB 1.09 MiB
a1a9260 24.14 KiB 1.08 MiB 1.06 MiB
d492bc8 24.14 KiB 1.11 MiB 1.09 MiB
9a34176 24.14 KiB 1.10 MiB 1.07 MiB
680923d 24.14 KiB 1.10 MiB 1.08 MiB
db9e223 24.14 KiB 1.06 MiB 1.03 MiB

Previous results on branch: metricKitInAppFallback

Startup times

Revision Plain With Sentry Diff
d4bdae9 1218.47 ms 1253.21 ms 34.74 ms

App size

Revision Plain With Sentry Diff
d4bdae9 24.14 KiB 1.11 MiB 1.09 MiB

Copy link
Copy Markdown
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Sources/Swift/Core/MetricKit/SentryMXCallStackTree+Parsing.swift
Copilot AI review requested due to automatic review settings February 24, 2026 19:16
@noahsmartin noahsmartin force-pushed the metricKitInAppFallback branch from 91e119a to 8df8b8a Compare February 24, 2026 19:16
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread Sources/Swift/Core/MetricKit/SentryMXCallStackTree+Parsing.swift
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where MetricKit sometimes provides only a binaryUUID without an image name (binaryName), causing the in-app frame detection logic to fail. The fix changes the default fallback behavior from inApp: false to inApp: true when the package (binaryName) is nil, based on the observation that MetricKit only does this for in-app code, not system code.

Changes:

  • Modified inApp logic in SentryMXCallStackTree+Parsing.swift to default to true when package is nil
  • Added test case to verify the new behavior when package is nil
  • Added corresponding test resource JSON file for the nil package scenario

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Sources/Swift/Core/MetricKit/SentryMXCallStackTree+Parsing.swift Updated inApp assignment logic to handle nil package with a fallback to true instead of false
Tests/SentryTests/Integrations/MetricKit/SentryMXCallStackTreeTests.swift Added test case testInAppTrue_WhenPackageIsNil to verify the new behavior
Tests/Resources/MetricKitCallstacks/per-thread-nil-package.json Added test resource file representing MetricKit data with missing binaryName
CHANGELOG.md Added entry documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@noahsmartin noahsmartin enabled auto-merge (squash) February 24, 2026 19:39
@noahsmartin noahsmartin merged commit b984142 into main Feb 24, 2026
213 checks passed
@noahsmartin noahsmartin deleted the metricKitInAppFallback branch February 24, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants