Skip to content

JS-side integration: attach TurboModule stats to active spans #6165

Closed

Description

@alwx

Native gives us the data; the JS layer is where it has to land on the right span. Today, idle navigation spans (reactnavigation.ts, expoRouter.ts) and the user's own Sentry.startSpan(...) calls have no visibility into native module work that happened during them.

Goal

  • New integration: turboModulesIntegration() exported from packages/core/src/js/integrations/exports.ts.

  • On install, the integration:

    • Calls into the native sink (Issue 1) to start a logical "JS observation window" tied to the active span (using getActiveSpan()).
    • On span end, pulls a delta of aggregate stats since the window started and attaches them as attributes (turbo_module.<name>.<method>.call_count, ..._duration_ms, ..._error_count) — capped to top-N modules by duration to keep payload size sane.
    • Adds a breadcrumb (category: 'native.turbo_module', level: 'info') for any async call that exceeded a configurable threshold (slowCallThresholdMs, default 500ms) including module + method + duration.
  • Surface a tiny JS API for users who want explicit attribution:

    Sentry.startSpan({ name: 'load profile' }, async () => {
      // any TurboModule activity inside this callback is automatically attached
    });
  • Auto-enabled when enableTurboModuleTracking (Issue 1) is on; no-op otherwise.

Activity

  1. linear-code commented on May 18, 2026

    @linear-code
  2. self-assigned this
    on Jun 29, 2026
  3. added 2 commits that reference this issue on Jul 22, 2026
    d71786c
    5d90835
  4. added a commit that references this issue on Jul 27, 2026
    fa21fca
  5. github-actions commented on Jul 30, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #6478, which was included in the 8.21.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions