Skip to content

feat(tracing): Evaluate & confirm WebView trace-connection approach #6779

Description

@antonis

Problem

The mechanism is decided in principle — inject the RN SDK's trace context into an embedded WebView so the in-page @sentry/browser continues the same trace — but the injection timing against react-native-webview is the core risk, and the public API shape needs a decision.

In RN the trace lives in the JS layer (native scope-syncs from JS), so the integration injects the RN JS SDK's propagation context (getTraceData()) directly into the WebView. Both required primitives already ship in the bundled @sentry/core v10.74.0: getTraceData() / getTraceMetaTags() (produce) and browserTracingIntegration's meta-tag continuation (consume). This is glue, not new tracing machinery.

Confirm / decide

  • Vehicle (decided): meta tags. Write <meta name="sentry-trace"> + <meta name="baggage"> from getTraceData() via injectedJavaScriptBeforeContentLoaded, before the page's @sentry/browser pageload init reads them. Confirm empirically that document-start injection wins the race, including that the hook re-fires per full-document navigation.
  • Span links — decide whether to also link the WebView pageload span to the RN span that opened it.
  • API shape (needs sign-off): lightweight helper returning props to spread onto the user's own <WebView> (recommended — no component ownership) vs. a drop-in <SentryWebView> wrapper.
  • Barrel exposure: whether to also re-export getTraceData/getTraceMetaTags from packages/core/src/js/index.ts (public-API change, ask-first).

Acceptance criteria

  • A written recommendation covering vehicle, injection timing, span-link decision, and API shape.
  • A working proof-of-concept in the sample app showing a shared trace_id between RN and the in-WebView page.

Hands off to design-first.

References

Activity

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