Skip to content

Implement strict trace continuation (org_id validation) #5128

@giortzisg

Description

@giortzisg

Summary

Implement the strictTraceContinuation option as specified in the SDK spec.

This prevents unintended trace mixing across different Sentry organizations by validating the org_id in incoming baggage headers.

Requirements

1. Parse org_id from DSN

Extract the organization ID from the DSN host (e.g., o1234 from o1234.ingest.sentry.io"1234").

2. Add org_id configuration option

Allow explicit override of the DSN-derived org_id (needed for self-hosted / Relay setups).

3. Propagate org_id in baggage

Add sentry-org_id to the Dynamic Sampling Context (DSC) / baggage when creating head-of-trace.

4. Implement trace continuation validation

Add a strict_trace_continuation option (default: false) that validates incoming sentry-org_id against the SDK's org_id before continuing a trace. See the spec for the full decision matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions