From a990c24c8df24365117c9450fab55cce1cfef042 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Thu, 25 Jun 2026 16:28:17 +0200 Subject: [PATCH] feat!(options): Add `org_id` and `strict_trace_continuation` options These options are needed for strict trace continuation. We will start using them in a follow up PR. Resolves [#1199](https://github.com/getsentry/sentry-rust/issues/1199) Resolves [RUST-251](https://linear.app/getsentry/issue/RUST-251) --- CHANGELOG.md | 4 ++++ sentry-core/src/clientoptions.rs | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2cc3f34a..8d856b41d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Breaking Changes + +- Added [`ClientOptions::org_id`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html#structfield.org_id) and [`ClientOptions::strict_trace_continuation`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html#structfield.strict_trace_continuation) for configuring strict trace continuation. Code that constructs `ClientOptions` with a full struct literal (without `..Default::default()`), or which exhaustively matches against it, must now include both fields ([#1203](https://github.com/getsentry/sentry-rust/pull/1203)). + ### New Features - Added [`Dsn::org_id`](https://docs.rs/sentry-types/latest/sentry_types/struct.Dsn.html#method.org_id), which parses the Sentry SaaS organization ID from DSN hosts such as `o123.ingest.sentry.io` ([#1202](https://github.com/getsentry/sentry-rust/pull/1202)). diff --git a/sentry-core/src/clientoptions.rs b/sentry-core/src/clientoptions.rs index cbb1f0bf3..7964f2a89 100644 --- a/sentry-core/src/clientoptions.rs +++ b/sentry-core/src/clientoptions.rs @@ -5,7 +5,7 @@ use std::time::Duration; use crate::constants::USER_AGENT; use crate::performance::TracesSampler; -use crate::protocol::{Breadcrumb, Event, Log, Metric}; +use crate::protocol::{Breadcrumb, Event, Log, Metric, OrganizationId}; use crate::types::Dsn; use crate::{Integration, IntoDsn, TransportFactory}; @@ -94,6 +94,17 @@ pub struct ClientOptions { // Common options /// The DSN to use. If not set the client is effectively disabled. pub dsn: Option, + /// The Sentry organization ID used for trace continuation decisions. + /// + /// The SDK can derive this value automatically from Sentry SaaS DSNs. Set this explicitly for + /// DSNs whose organization ID cannot be inferred, mainly self-hosted Sentry and local Relay + /// setups. + pub org_id: Option, + /// Enables strict trace continuation. + /// + /// When enabled, the SDK will only continue incoming traces whose organization ID matches this + /// SDK's organization ID. + pub strict_trace_continuation: bool, /// Enables debug mode. /// /// In debug mode debug information is printed to stderr to help you understand what @@ -312,6 +323,8 @@ impl fmt::Debug for ClientOptions { .field("before_send_log", &before_send_log) .field("enable_metrics", &self.enable_metrics) .field("before_send_metric", &before_send_metric) + .field("org_id", &self.org_id) + .field("strict_trace_continuation", &self.strict_trace_continuation) .field("user_agent", &self.user_agent) .finish() } @@ -321,6 +334,8 @@ impl Default for ClientOptions { fn default() -> ClientOptions { ClientOptions { dsn: None, + org_id: None, + strict_trace_continuation: false, debug: false, release: None, environment: None,