Skip to content

Legacy NativeModules wrapper for the old architecture #6166

@alwx

Description

@alwx

TurboModulePerfLogger only fires for TurboModules. Apps on the old architecture still talk to native through NativeModules.* over the bridge. To keep the feature useful for the long tail of un-migrated apps, mirror the same instrumentation surface on top of the legacy bridge.

Goal

  • Two paths, pick the one that gives us cleaner UX:
    1. Native: use React Native's BridgeNativeModulePerfLogger (analogous to TurboModulePerfLogger, available on old arch) and install a Sentry logger from RNSentryPackage / RNSentry.mm the same way Issue 1 does.
    2. JS proxy: wrap NativeModules at runtime by replacing the NativeModules[name] getter with a Proxy that records call start/end. Cheaper to ship but adds a JS-side hot-path cost on every native call.
  • Default to path (1); fall back to (2) only on RN versions where the bridge logger isn't accessible.
  • Feed the same aggregator + crash-context surface from Issues 2 & 3 — the consumer side should not care whether the data came from a TurboModule or a legacy NativeModule. Add turbo_module.arch: "new" | "legacy" so analyses can split them.
  • Respect isTurboModuleEnabled() / isFabricEnabled() detection from packages/core/src/js/utils/environment.ts to choose the right code path automatically.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions