From db3c718ddc224a15b0dcbc208413c8a8a8242766 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 10 Jul 2024 20:27:17 +0000 Subject: [PATCH] add config for sentry stacktraces Signed-off-by: Jason Volk --- conduwuit-example.toml | 3 +++ src/core/config/mod.rs | 3 +++ src/main/sentry.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/conduwuit-example.toml b/conduwuit-example.toml index 7e5c9710..cb6dc8e6 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -57,6 +57,9 @@ # Defaults to 0.15 #sentry_traces_sample_rate = 0.15 +# Whether to attach a stacktrace to Sentry reports. +#sentry_attach_stacktrace = false + ### Database configuration diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index f9a5ec4c..8b864c84 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -356,6 +356,8 @@ pub struct Config { pub sentry_send_server_name: bool, #[serde(default = "default_sentry_traces_sample_rate")] pub sentry_traces_sample_rate: f32, + #[serde(default)] + pub sentry_attach_stacktrace: bool, #[serde(default)] pub tokio_console: bool, @@ -819,6 +821,7 @@ impl fmt::Display for Config { ("Sentry.io send server_name in logs", &self.sentry_send_server_name.to_string()), #[cfg(feature = "sentry_telemetry")] ("Sentry.io tracing sample rate", &self.sentry_traces_sample_rate.to_string()), + ("Sentry.io attach stacktrace", &self.sentry_attach_stacktrace.to_string()), ( "Well-known server name", self.well_known diff --git a/src/main/sentry.rs b/src/main/sentry.rs index 6ed4bb8a..59f88a0c 100644 --- a/src/main/sentry.rs +++ b/src/main/sentry.rs @@ -28,6 +28,7 @@ fn options(config: &Config) -> ClientOptions { debug: cfg!(debug_assertions), release: sentry::release_name!(), user_agent: conduit::version::user_agent().into(), + attach_stacktrace: config.sentry_attach_stacktrace, before_send: Some(Arc::new(before_send)), before_breadcrumb: Some(Arc::new(before_breadcrumb)), ..Default::default()