diff --git a/CHANGELOG.md b/CHANGELOG.md index 71621ac1..25f148e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## Unreleased +### Breaking changes + +- Removed the `ClientOptions` struct's `trim_backtraces` and `extra_border_frames` fields ([#925](https://github.com/getsentry/sentry-rust/pull/925)). + - These fields configured backtrace trimming, which is being removed in this release. + +### Improvements + +- Removed backtrace trimming to align the Rust SDK with the general principle that Sentry SDKs should only truncate telemetry data when needed to comply with [documented size limits](https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits) ([#925](https://github.com/getsentry/sentry-rust/pull/925)). This change ensures that as much data as possible remains available for debugging. + - If you notice any new issues being created for existing errors after this change, please open an issue on [GitHub](https://github.com/getsentry/sentry-rust/issues/new/choose). + ### Fixes - fix: adjust sentry.origin for log integration ([#919](https://github.com/getsentry/sentry-rust/pull/919)) by @lcian diff --git a/sentry-backtrace/src/integration.rs b/sentry-backtrace/src/integration.rs index 5232cdd1..22ee452e 100644 --- a/sentry-backtrace/src/integration.rs +++ b/sentry-backtrace/src/integration.rs @@ -8,9 +8,7 @@ use crate::process::process_event_stacktrace; /// Integration to process Event stacktraces. /// -/// This integration will trim backtraces, depending on the `trim_backtraces` -/// and `extra_border_frames` options. -/// It will then classify each frame according to the `in_app_include` and +/// This integration will classify each frame according to the `in_app_include` and /// `in_app_exclude` options. #[derive(Debug, Default)] pub struct ProcessStacktraceIntegration; diff --git a/sentry-backtrace/src/lib.rs b/sentry-backtrace/src/lib.rs index 6b139a51..ee6c1850 100644 --- a/sentry-backtrace/src/lib.rs +++ b/sentry-backtrace/src/lib.rs @@ -18,7 +18,6 @@ pub use crate::integration::{ }; pub use crate::parse::parse_stacktrace; pub use crate::process::{backtrace_to_stacktrace, process_event_stacktrace}; -pub use crate::trim::trim_stacktrace; pub use sentry_core::protocol::{Frame, Stacktrace}; /// Returns the current backtrace as sentry stacktrace. diff --git a/sentry-backtrace/src/process.rs b/sentry-backtrace/src/process.rs index 90c00335..5b468cc5 100644 --- a/sentry-backtrace/src/process.rs +++ b/sentry-backtrace/src/process.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; use backtrace::Backtrace; use sentry_core::ClientOptions; -use crate::trim::{is_well_known_not_in_app, trim_stacktrace}; +use crate::trim::is_well_known_not_in_app; use crate::utils::{ demangle_symbol, filename, function_starts_with, parse_crate_name, strip_symbol, }; @@ -11,20 +11,8 @@ use crate::{Frame, Stacktrace}; /// Processes a `Stacktrace`. /// -/// Trims a `Stacktrace` and marks frames as in-app based on the provided -/// `ClientOptions`. +/// Marks frames as in-app based on the provided `ClientOptions`. pub fn process_event_stacktrace(stacktrace: &mut Stacktrace, options: &ClientOptions) { - // automatically trim backtraces - if options.trim_backtraces { - trim_stacktrace(stacktrace, |frame, _| { - if let Some(ref func) = frame.function { - options.extra_border_frames.contains(&func.as_str()) - } else { - false - } - }) - } - // automatically prime in_app and set package let mut any_in_app = false; for frame in &mut stacktrace.frames { diff --git a/sentry-backtrace/src/trim.rs b/sentry-backtrace/src/trim.rs index ec1087cc..2b1ce260 100644 --- a/sentry-backtrace/src/trim.rs +++ b/sentry-backtrace/src/trim.rs @@ -1,5 +1,3 @@ -use sentry_core::protocol::{Frame, Stacktrace}; - use crate::utils::function_starts_with; const WELL_KNOWN_NOT_IN_APP: &[&str] = &[ @@ -12,6 +10,7 @@ const WELL_KNOWN_NOT_IN_APP: &[&str] = &[ "sentry_core::", "sentry_types::", "sentry_backtrace::", + "sentry_tracing::", // these are not modules but things like __rust_maybe_catch_panic "__rust_", "___rust_", @@ -26,45 +25,9 @@ const WELL_KNOWN_NOT_IN_APP: &[&str] = &[ "futures_util::", ]; -const WELL_KNOWN_BORDER_FRAMES: &[&str] = &[ - "std::panicking::begin_panic", - "core::panicking::panic", - // well-known library frames - "anyhow::", - "::log", - "tracing_core::", -]; - -/// A helper function to trim a stacktrace. -pub fn trim_stacktrace(stacktrace: &mut Stacktrace, f: F) -where - F: Fn(&Frame, &Stacktrace) -> bool, -{ - let known_cutoff = stacktrace - .frames - .iter() - .rev() - .position(|frame| match frame.function { - Some(ref func) => is_well_known_border_frame(func) || f(frame, stacktrace), - None => false, - }); - - if let Some(cutoff) = known_cutoff { - let trunc = stacktrace.frames.len() - cutoff - 1; - stacktrace.frames.truncate(trunc); - } -} - /// Checks if a function is from a module that shall be considered not in-app by default pub fn is_well_known_not_in_app(func: &str) -> bool { WELL_KNOWN_NOT_IN_APP .iter() .any(|m| function_starts_with(func, m)) } - -/// Checks if a function is a well-known border frame -fn is_well_known_border_frame(func: &str) -> bool { - WELL_KNOWN_BORDER_FRAMES - .iter() - .any(|m| function_starts_with(func, m)) -} diff --git a/sentry-core/src/clientoptions.rs b/sentry-core/src/clientoptions.rs index 33b5bbd4..02d5d5a9 100644 --- a/sentry-core/src/clientoptions.rs +++ b/sentry-core/src/clientoptions.rs @@ -189,11 +189,6 @@ pub struct ClientOptions { /// Determine how Sessions are being tracked. #[cfg(feature = "release-health")] pub session_mode: SessionMode, - /// Border frames which indicate a border from a backtrace to - /// useless internals. Some are automatically included. - pub extra_border_frames: Vec<&'static str>, - /// Automatically trim backtraces of junk before sending. (defaults to true) - pub trim_backtraces: bool, /// The user agent that should be reported. pub user_agent: Cow<'static, str>, } @@ -283,11 +278,7 @@ impl fmt::Debug for ClientOptions { .field("enable_logs", &self.enable_logs) .field("before_send_log", &before_send_log); - debug_struct - .field("extra_border_frames", &self.extra_border_frames) - .field("trim_backtraces", &self.trim_backtraces) - .field("user_agent", &self.user_agent) - .finish() + debug_struct.field("user_agent", &self.user_agent).finish() } } @@ -320,8 +311,6 @@ impl Default for ClientOptions { auto_session_tracking: false, #[cfg(feature = "release-health")] session_mode: SessionMode::Application, - extra_border_frames: vec![], - trim_backtraces: true, user_agent: Cow::Borrowed(USER_AGENT), max_request_body_size: MaxRequestBodySize::Medium, #[cfg(feature = "logs")]