Repository navigation
Open
Description
Problem
UI profiling (_experiments.profilingOptions) on iOS only half-works today:
- sentry-cocoa profiles and uploads native profile chunks, but
startProfileron iOS always resolvesnil(packages/core/ios/RNSentry.mm, "sentry-cocoa has no public API for the current profiler id"). Because of that, iOS transactions get nocontexts.profile.profiler_id, so Sentry can't link a transaction or span to its profile. - Hermes JS samples aren't sent as profile chunks on iOS (gated to Android API 35+ in
uiProfilingIntegration.ts), so iOS UI profiles contain only native frames.
Android already handles both (#6916, #6966). Both PRs list iOS as a follow-up that's blocked on Cocoa exposing the profiler ID.
Transaction-based profiling (profilesSampleRate) isn't affected: JS owns the profile_id there.
Unblocked by
getsentry/sentry-cocoa#9712 adds SentrySDK.internal.profiling.currentProfilerId (Swift) and SentryObjCSDK.internal.profiling.currentProfilerId (ObjC). It returns the profiler_id that Cocoa writes into continuous profile chunks, or nil when the profiler is inactive. The ID is set synchronously by SentrySDK.startProfiler() and stays the same for the whole process.
Tasks
1. Link iOS transactions to the UI profile
- Bump sentry-cocoa to the release that includes feat: Expose the profiler ID to hybrid SDKs sentry-cocoa#9712
-
RNSentryInternal.swift: addcurrentProfilerId()wrappingSentrySDK.internal.profiling.currentProfilerId, with anilstub on watchOS/tvOS/visionOS (same#ifpattern asstartProfiler(forTrace:)) -
RNSentryInternalWrapper.{h,m}: add a passthrough -
RNSentry.mmstartProfiler: resolve with the current profiler ID instead ofnil, and remove the outdated comment - No JS or codegen change needed:
NativeRNSentry.startProfiler()is already typedPromise<string | undefined | null>, anduiProfilingIntegrationalready stampsprofiler_idwhen it gets one - Tests: native iOS test for the resolved value (
nilwhen sampled out); sample app/e2e check that an iOS transaction hascontexts.profile.profiler_idmatching the chunk'sprofiler_id
2. Send Hermes samples as UI profile chunks on iOS
- Enable
sendsHermesChunkson iOS inuiProfilingIntegration.ts - Check how Sentry merges the
javascriptchunk with Cocoa's sample-format chunks, and settle the JS thread ID. Android uses a synthetic2^32ID because Perfetto samples the JS thread under the same OS thread ID; check whether Cocoa's Mach-port thread IDs collide the same way. - Verify end to end on device: one profile with JS and native frames, and spans pointing to the JS thread
Acceptance criteria
- With UI profiling on iOS, transactions created during a profiler session have
contexts.profile.profiler_idequal to theprofiler_idof the uploaded chunks, and the transaction opens its profile in Sentry - When the profiler doesn't run (sampled out), nothing is stamped and nothing breaks
- (Task 2) iOS UI profiles show JS frames on the JS thread alongside native frames
- Works on both the New and Old Architecture
References
- fix(profiling): Drive the native UI profiler from JS #6916 Drive the native UI profiler from JS
- feat(profiling): Send Hermes samples as UI profile chunks on Android #6966 Send Hermes samples as UI profile chunks on Android
- Add UI Profiling Support (converted to project) #4667 UI Profiling Support (Linear project)
- feat: Expose the profiler ID to hybrid SDKs sentry-cocoa#9712
- Continuous Profiling for Flutter (iOS/Android) sentry-dart#3890: Flutter's continuous profiling tracking issue; also consumes cocoa#9712 for linking spans to the profile
Activity
linear-code commentedon Nov 23, 2026
RN-880
antonis commentedon Nov 26, 2026
Unblocked: #7114 bumps sentry-cocoa to 9.36.0, which ships getsentry/sentry-cocoa#9712 (
SentrySDK.internal.profiling.currentProfilerId). Work can start once #7114 merges.