Skip to content
Merged
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
18 changes: 18 additions & 0 deletions objectstore-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ pub struct Sentry {
/// `OS__SENTRY__INHERIT_SAMPLING_DECISION`
pub inherit_sampling_decision: bool,

/// Whether to attach stack traces to captured errors and messages.
///
/// When enabled, the attached stack trace starts where the event is captured.
///
/// # Default
///
/// `false`
///
/// # Environment Variable
///
/// `OS__SENTRY__ATTACH_STACKTRACE`
pub attach_stacktrace: bool,

/// Enable Sentry SDK debug mode.
///
/// When enabled, the Sentry SDK will output debug information to stderr, which can be useful
Expand Down Expand Up @@ -326,6 +339,7 @@ impl Default for Sentry {
sample_rate: 1.0,
traces_sample_rate: 0.01,
inherit_sampling_decision: true,
attach_stacktrace: false,
debug: false,
tags: BTreeMap::new(),
}
Expand Down Expand Up @@ -780,6 +794,7 @@ mod tests {
jail.set_env("OS__SENTRY__ENVIRONMENT", "production");
jail.set_env("OS__SENTRY__SERVER_NAME", "objectstore-deadbeef");
jail.set_env("OS__SENTRY__TRACES_SAMPLE_RATE", "0.5");
jail.set_env("OS__SENTRY__ATTACH_STACKTRACE", "true");

let config = Config::load(None).unwrap();

Expand All @@ -801,6 +816,7 @@ mod tests {
);
assert_eq!(config.sentry.sample_rate, 0.5);
assert_eq!(config.sentry.traces_sample_rate, 0.5);
assert!(config.sentry.attach_stacktrace);

Ok(())
});
Expand All @@ -822,6 +838,7 @@ mod tests {
server_name: objectstore-deadbeef
sample_rate: 0.5
traces_sample_rate: 0.5
attach_stacktrace: true
"#,
)
.unwrap();
Expand All @@ -843,6 +860,7 @@ mod tests {
);
assert_eq!(config.sentry.sample_rate, 0.5);
assert_eq!(config.sentry.traces_sample_rate, 0.5);
assert!(config.sentry.attach_stacktrace);

Ok(())
});
Expand Down
1 change: 1 addition & 0 deletions objectstore-server/src/observability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub fn init_sentry(config: &Config) -> Option<sentry::ClientInitGuard> {
}))
},
enable_logs: true,
attach_stacktrace: config.attach_stacktrace,
debug: config.debug,
..Default::default()
});
Expand Down
Loading