Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down
17 changes: 16 additions & 1 deletion sentry-core/src/clientoptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -94,6 +94,17 @@ pub struct ClientOptions {
// Common options
/// The DSN to use. If not set the client is effectively disabled.
pub dsn: Option<Dsn>,
/// 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<OrganizationId>,
/// 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
Expand Down Expand Up @@ -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()
}
Expand All @@ -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,
Expand Down
Loading