Skip to content

feat: Add strict trace continuation support#5136

Draft
giortzisg wants to merge 4 commits intomainfrom
feat/strict-trace-continuation
Draft

feat: Add strict trace continuation support#5136
giortzisg wants to merge 4 commits intomainfrom
feat/strict-trace-continuation

Conversation

@giortzisg
Copy link

Summary

  • Extract org ID from DSN host (e.g., o123.ingest.sentry.io"123")
  • Add strictTraceContinuation (boolean, default false) and orgId (String) options to SentryOptions
  • Propagate sentry-org_id in baggage / Dynamic Sampling Context
  • Validate incoming traces per the decision matrix (mismatched org → new trace; strict mode rejects missing org)

Decision Matrix

Baggage org SDK org strict=false strict=true
1 1 Continue Continue
None 1 Continue New trace
1 None Continue New trace
None None Continue Continue
1 2 New trace New trace

Changes

  • Dsn.java — org ID extraction from host using ^o(\d+)\. regex
  • SentryOptions.javastrictTraceContinuation, orgId, and getEffectiveOrgId()
  • Baggage.javaORG_ID DSCKey, getter/setter, population in setValuesFromTransaction/setValuesFromScope/fromEvent
  • PropagationContext.javashouldContinueTrace() logic in fromHeaders()
  • Scopes.java — pass options to fromHeaders()

Test plan

  • DSN org ID extraction tests (5 cases)
  • PropagationContext decision matrix tests (10 cases)

Closes #5128

🤖 Generated with Claude Code

Extract org ID from DSN host, add strictTraceContinuation and orgId
options, propagate sentry-org_id in baggage, and validate incoming
traces per the decision matrix.

Closes #5128
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

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


New Features ✨

  • (otel) Create sentry-opentelemetry-otlp module for combining OpenTelemetry SDK OTLP export with Sentry SDK by adinauer in #5100
  • (screenshot) Add screenshot masking using view hierarchy by romtsn in #5077
  • Add strict trace continuation support by giortzisg in #5136

Bug Fixes 🐛

  • (transport) Handle HTTP 413 with actionable log and use send_error for HTTP errors by adinauer in #5115
  • Trim DSN string before URI parsing by adinauer in #5113
  • Safe unregister SystemEventsBroadcastReceiver by kollesnica1337 in #5106

Internal Changes 🔧

Deps

  • Bump getsentry/craft from 2.21.7 to 2.23.1 by dependabot in #5129
  • Update Native SDK to v0.13.1 by github-actions in #5104
  • Bump actions/upload-artifact from 6 to 7 by dependabot in #5130
  • Bump actions/download-artifact from 7 to 8 by dependabot in #5132
  • Bump gradle/actions from 5.0.1 to 5.0.2 by dependabot in #5131
  • Bump github/codeql-action from 4.32.2 to 4.32.4 by dependabot in #5109
  • Bump getsentry/craft from 2.21.2 to 2.21.7 by dependabot in #5110

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 96a5ff2

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 348.85 ms 428.10 ms 79.25 ms
Size 1.58 MiB 2.29 MiB 723.70 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
91bb874 310.68 ms 359.24 ms 48.56 ms
e59e22a 368.02 ms 432.00 ms 63.98 ms
fc5ccaf 279.11 ms 353.34 ms 74.23 ms
d15471f 315.20 ms 370.22 ms 55.02 ms
d15471f 286.65 ms 314.68 ms 28.03 ms
d15471f 342.08 ms 415.44 ms 73.35 ms
ad8da22 314.38 ms 352.29 ms 37.91 ms
cf708bd 434.73 ms 502.96 ms 68.22 ms
abfcc92 309.54 ms 380.32 ms 70.78 ms
91bb874 314.47 ms 440.00 ms 125.53 ms

App size

Revision Plain With Sentry Diff
91bb874 1.58 MiB 2.13 MiB 559.07 KiB
e59e22a 1.58 MiB 2.20 MiB 635.34 KiB
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
cf708bd 1.58 MiB 2.11 MiB 539.71 KiB
abfcc92 1.58 MiB 2.13 MiB 557.31 KiB
91bb874 1.58 MiB 2.13 MiB 559.07 KiB

giortzisg and others added 2 commits March 2, 2026 17:02
Add public API declarations for new org ID and strict trace
continuation methods on Baggage, PropagationContext, and SentryOptions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Implement strict trace continuation (org_id validation)

2 participants