Skip to content

feat: add root-level methods and raw address properties to SentryInternalApi - #8097

Merged
philprime merged 8 commits into
mainfrom
philprime/internal-api/root-methods
Jun 23, 2026
Merged

philprime merged 8 commits into
mainfrom
philprime/internal-api/root-methods

Conversation

@philprime

@philprime philprime commented Jun 16, 2026

Copy link
Copy Markdown
Member

📜 Description

Adds root-level methods to SentryInternalApi and extends DebugMeta with raw numeric address properties.

Root-level methods on SentryInternalApi

  • setTrace(_:spanId:) — sets propagation context on the current scope
  • setLogOutput(_:) — configures SDK log output
  • ignoreNextSignal(_:) — tells SentryCrash to ignore the next signal
  • options — returns the current SDK options
  • options(fromDictionary:) — deserializes options from a dictionary

All methods are also exposed on SentryObjCInternalApi for ObjC consumers.

Dependency injection in SentryInternalApi

Replaced direct PrivateSentrySDKOnly static calls with injected dependencies:

  • Hub protocol (with setTrace method)
  • ClientProvider protocol (for options access)
  • OptionsDeserializerProvider protocol (for dictionary-to-options)

Raw address properties on DebugMeta

Added imageAddressRaw (UInt64) and imageVmAddressRaw (UInt64) to SentryDebugMeta, DebugMeta, and SentryObjCDebugMeta. These live alongside the existing hex string properties (imageAddress, imageVmAddress). Hybrid SDKs can use the raw values directly without parsing hex strings.

  • Populated in SentryDebugImageProvider.debugMeta(from:) and SentryInternalDebugApi.images(forAddresses:)
  • Not included in event serialization (hex strings already cover that)

Closes #8039

💡 Motivation and Context

Hybrid SDKs (React Native, Flutter, .NET, Unity) need access to the same root-level SDK operations currently only available through PrivateSentrySDKOnly. The structured SentrySDK.internal API provides a cleaner, more discoverable surface. Raw address properties were requested to avoid hex string parsing overhead in hybrid SDKs.

💚 How did you test it?

  • Unit tests for all new SentryInternalApi methods (SentryInternalApiIntegrationTests)
  • ObjC integration tests for SentryObjCInternalApi (SentryObjCInternalApiIntegrationTests)
  • TDD tests for imageAddressRaw/imageVmAddressRaw on SentryDebugMeta (SentryDebugMetaTests)
  • TDD tests for raw address population in SentryInternalDebugApi (SentryInternalDebugApiTests)
  • ObjC tests for SentryObjCDebugMeta raw address properties (SentryObjCDebugMetaTests)
  • Verified serialization excludes raw values
  • make test-macos passing

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • If I added a new public API, I also added it to the SentryObjC wrapper.

@philprime philprime added the ready-to-merge (deprecated) Use run-full-ci instead. label Jun 16, 2026
@philprime philprime self-assigned this Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

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 8cab81a

@philprime
philprime force-pushed the philprime/internal-api/root-methods branch from 0ab4bbd to 35e90bb Compare June 16, 2026 14:29
@sentry

sentry Bot commented Jun 16, 2026

Copy link
Copy Markdown

📲 Install Builds

iOS

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

⚙️ sentry-cocoa Build Distribution Settings

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1221.30 ms 1261.51 ms 40.21 ms
Size 24.14 KiB 1.20 MiB 1.17 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
92bcc8f 1233.43 ms 1270.20 ms 36.77 ms
ccf353a 1233.79 ms 1268.77 ms 34.98 ms
207a888 1215.22 ms 1248.98 ms 33.75 ms
909f4ae 1222.85 ms 1253.26 ms 30.41 ms
bdd8e0e 1233.35 ms 1266.96 ms 33.60 ms
9787f05 1233.67 ms 1269.00 ms 35.33 ms
8bb6aeb 1215.82 ms 1244.84 ms 29.02 ms
09627e8 1223.68 ms 1261.95 ms 38.27 ms
fc4e913 1221.61 ms 1253.82 ms 32.21 ms
e3147fd 1227.15 ms 1257.79 ms 30.63 ms

App size

Revision Plain With Sentry Diff
92bcc8f 24.14 KiB 1.15 MiB 1.13 MiB
ccf353a 24.14 KiB 1.17 MiB 1.15 MiB
207a888 24.14 KiB 1.18 MiB 1.15 MiB
909f4ae 24.14 KiB 1.16 MiB 1.13 MiB
bdd8e0e 24.14 KiB 1.16 MiB 1.13 MiB
9787f05 24.14 KiB 1.18 MiB 1.15 MiB
8bb6aeb 24.14 KiB 1.17 MiB 1.15 MiB
09627e8 24.14 KiB 1.17 MiB 1.14 MiB
fc4e913 24.14 KiB 1.17 MiB 1.15 MiB
e3147fd 24.14 KiB 1.17 MiB 1.14 MiB

Previous results on branch: philprime/internal-api/root-methods

Startup times

Revision Plain With Sentry Diff
4a5ae2e 1220.11 ms 1249.62 ms 29.51 ms
cf296cb 1221.90 ms 1253.94 ms 32.04 ms
b1b3e20 1222.13 ms 1244.56 ms 22.43 ms

App size

Revision Plain With Sentry Diff
4a5ae2e 24.14 KiB 1.19 MiB 1.17 MiB
cf296cb 24.14 KiB 1.19 MiB 1.17 MiB
b1b3e20 24.14 KiB 1.19 MiB 1.17 MiB

Base automatically changed from philprime/internal-api/profiling to main June 22, 2026 07:53
@philprime
philprime force-pushed the philprime/internal-api/root-methods branch from 67bfb99 to f0b92fd Compare June 22, 2026 08:16
Inject Hub, ClientProvider, and OptionsDeserializer dependencies
instead of calling PrivateSentrySDKOnly static methods directly.

- setTrace delegates to Hub.setTrace via new Scope convenience method
- options getter uses ClientProvider.client.options
- options(fromDictionary:) uses injectable OptionsDeserializer
- Revert unnecessary SENTRY_SWIFT_MIGRATION_ID on options property
Add UInt64 address properties alongside the existing hex string
properties on SentryDebugMeta and SentryObjCDebugMeta. Hybrid SDKs
can now access raw numeric addresses without parsing hex strings.

Populated from SentryBinaryImageInfo in both SentryDebugImageProvider
and SentryInternalDebugApi.images(forAddresses:). Not included in
event serialization as the hex strings already cover that.
@philprime philprime changed the title feat: add root-level methods on SentryInternalApi feat: add root-level methods and raw address properties to SentryInternalApi Jun 22, 2026
SentryClient.options returns SentryOptions * which is an incomplete
type from Swift in the xcframework build. Route through the Hub
protocol using getClient()?.getOptions() (returns NSObject) instead,
matching the pattern used for storeEnvelope/captureEnvelope.
@philprime

Copy link
Copy Markdown
Member Author

@sentry review

@philprime
philprime marked this pull request as ready for review June 22, 2026 09:33
@philprime
philprime requested a review from limbonaut June 22, 2026 09:33
@philprime philprime added ready-to-merge (deprecated) Use run-full-ci instead. and removed ready-to-merge (deprecated) Use run-full-ci instead. labels Jun 22, 2026
@philprime
philprime enabled auto-merge (squash) June 22, 2026 11:12
Revert SENTRY_SWIFT_MIGRATION_ID and NS_SWIFT_NAME on
PrivateSentrySDKOnly.optionsWithDictionary to avoid breaking
hybrid SDK callers (React Native, Flutter, etc.).

Move the Swift migration bridge to a new internal
SentryOptionsHelper class used only by SentryDependencyContainer.
@philprime
philprime disabled auto-merge June 23, 2026 11:38

@NinjaLikesCheez NinjaLikesCheez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, one small comment

Comment thread Sources/SentryObjCCompat/SentryObjCInternalApi.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge (deprecated) Use run-full-ci instead.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide interface to access debug image cache in SentryObjC wrapper

3 participants