feat(core): Extend TurboModule instrumentation to legacy NativeModules#6504
Draft
alwx wants to merge 1 commit into
Draft
feat(core): Extend TurboModule instrumentation to legacy NativeModules#6504alwx wants to merge 1 commit into
alwx wants to merge 1 commit into
Conversation
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Extend TurboModule instrumentation to legacy NativeModules ([#6504](https://github.com/getsentry/sentry-react-native/pull/6504))If none of the above apply, you can opt out of this check by adding |
Wraps `NativeModules.*` on the Old Architecture so bridge calls flow through the same aggregator, span-attribution, and slow-call breadcrumb surface as TurboModules on the New Architecture. - Adds `arch: 'new' | 'legacy'` to TurboModuleRecord / TurboModuleAggregate / TurboModuleCallStart, threaded through `wrapTurboModule`, and folded into the aggregate key so new-arch and legacy calls stay separate on flush. - New `wrapAllNativeModules` enumerates `NativeModules` on the Old Arch and wraps each registered module (skipping RNSentry, which the integration wraps explicitly with a curated recursion-safe skip list). - `turboModuleContextIntegration` auto-invokes it on the Old Arch. Opt out with `enableLegacyNativeModules: false`, or scope with `legacyModulesSkip` / `legacyModulesSkipMethods`. - Aggregate flush emits `turbo_modules.<name>.<method>.<kind>.arch`; attributed spans get a top-level `turbo_module.arch` derived from `isTurboModuleEnabled()` at integration construction (an app doesn't switch archs at runtime). Closes #6166. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e8e56a6. Configure here.
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.
📢 Type of change
📜 Description
Extends the TurboModule aggregate + span attribution + slow-call breadcrumb surface (from #6377 and #6478) to Old Architecture apps by wrapping
NativeModules.*at setup. Consumer side stays identical — only thearchfield distinguishes new-arch ('new') vs bridge ('legacy') sources.Approach
This ships the JS Proxy path. The native
BridgeNativeModulePerfLoggerpath (option 1) is symmetric but requires new C++/JNI code and a version gate — left for a follow-up. The JS approach works on every RN version we support and has the same shape as the existing TurboModule wrap; hot-path cost is bounded (one property access + function call per bridge invocation).💡 Motivation and Context
TurboModulePerfLoggeronly fires for TurboModules, so apps on the Old Architecture were dark to the entire aggregator / span-attribution / breadcrumb surface. This PR closes that gap so the long tail of un-migrated apps gets the same signals.Closes #6166.
💚 How did you test it?
There are a few tests added!
📝 Checklist
sendDefaultPIIis enabled.