Skip to content

feat(tracing): Implement strict trace continuation#5829

Draft
antonis wants to merge 2 commits intomainfrom
worktree-strict-trace-continuation
Draft

feat(tracing): Implement strict trace continuation#5829
antonis wants to merge 2 commits intomainfrom
worktree-strict-trace-continuation

Conversation

@antonis
Copy link
Contributor

@antonis antonis commented Mar 17, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Add support for strictTraceContinuation and orgId options in the React Native SDK.

JS layer: No source changes needed — @sentry/core 10.43.0 already implements the full feature (option types, shouldContinueTrace(), org_id in DSC, continueTrace integration). Since ReactNativeOptions extends @sentry/core's Options, both options are automatically available.

Native bridge: Pass strictTraceContinuation and orgId through to native iOS/Android SDKs during initialization, so that native-layer trace propagation also respects org ID validation once native SDKs are bumped.

Changes:

  • RNSentryStart.java — Pass strictTraceContinuation (boolean) and orgId (string/number) to SentryAndroidOptions
  • RNSentryStart.m — Pass strictTraceContinuation (BOOL) and orgId (NSString) to SentryOptions
  • strictTraceContinuation.test.ts (new) — 10 tests covering the full decision matrix via @sentry/core's continueTrace
  • sdk.test.ts — 4 tests verifying options flow through Sentry.init()
  • wrapper.test.ts — 2 tests verifying options pass through the native bridge

💡 Motivation and Context

Implements Strict Trace Continuation spec. Prevents cross-org trace continuation by validating org IDs in distributed traces.

Part of the Strict Trace Continuation initiative.

💚 How did you test it?

  • All 1140 tests pass (101 suites)
  • 16 new tests covering option pass-through and decision matrix

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

Expose strictTraceContinuation and orgId options for cross-org trace
validation. The JS layer is handled by @sentry/core 10.43.0 which
already implements shouldContinueTrace and org_id propagation in DSC.

This commit adds native bridge support to pass these options through
to the Android (SentryAndroidOptions) and iOS (SentryOptions) native
SDKs during initialization, and adds comprehensive tests covering:
- Option pass-through to native SDK initialization
- Option pass-through via Sentry.init()
- continueTrace behavior with matching/mismatching org IDs
- strictTraceContinuation=true/false decision matrix

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(tracing): Implement strict trace continuation by antonis in #5829
  • fix(tracing): Fix native frames measurements dropped for idle transactions by antonis in #5813
  • feat(core): Support SENTRY_ENVIRONMENT in bare React Native builds by antonis in #5823
  • chore(deps): bump tar to ^7.5.11 by antonis in #5824
  • chore(deps): bump actions/create-github-app-token from 2.2.1 to 3.0.0 by dependabot in #5822
  • chore(deps): bump dorny/paths-filter from 3.0.2 to 4.0.1 by dependabot in #5820
  • chore(deps): bump reactivecircus/android-emulator-runner from 2.35.0 to 2.37.0 by dependabot in #5818
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.23.2 to 2.24.1 by dependabot in #5821
  • chore(deps): bump getsentry/craft from 2.23.2 to 2.24.1 by dependabot in #5819
  • chore(deps): bump undici from 6.23.0 to 6.24.1 by dependabot in #5817
  • chore(deps): bump flatted from 3.3.1 to 3.4.1 by dependabot in #5816
  • Ref: remove yarn from stub update by lucas-zimerman in #5811
  • Ref(CI): Unify stub update with android update by lucas-zimerman in #5807

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against d425efc

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant