-
Notifications
You must be signed in to change notification settings - Fork 120
feat(native): GA multi-exceptions #6241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4d33e85
d379c42
903f641
b4c86ea
d118def
d6c4046
07ace23
92d7982
f9678e0
26e91eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,15 +10,13 @@ use chrono::{TimeZone, Utc}; | |
| use minidump::{ | ||
| MinidumpAnnotation, MinidumpCrashpadInfo, MinidumpModuleList, Module, StabilityReport, | ||
| }; | ||
| use relay_dynamic_config::Feature; | ||
| use relay_event_schema::protocol::{ | ||
| ClientSdkInfo, Context, Contexts, Event, Exception, JsonLenientString, Level, Mechanism, | ||
| StabilityReportContext, Values, | ||
| }; | ||
| use relay_protocol::{Annotated, Value, get_value}; | ||
|
|
||
| use crate::envelope::{Item, ItemType}; | ||
| use crate::services::projects::project::ProjectInfo; | ||
|
|
||
| type Minidump<'a> = minidump::Minidump<'a, &'a [u8]>; | ||
|
|
||
|
|
@@ -40,6 +38,13 @@ struct NativePlaceholder { | |
| mechanism_type: &'static str, | ||
| } | ||
|
|
||
| #[derive(Clone, Copy)] | ||
| /// What to do with additional exceptions in a minidump / apple crash report event. | ||
| pub enum AdditionalExceptions { | ||
| Retain, | ||
| Delete, | ||
| } | ||
|
|
||
| /// Writes a placeholder to indicate that this event has an associated minidump or an apple | ||
| /// crash report. | ||
| /// | ||
|
|
@@ -48,7 +53,7 @@ struct NativePlaceholder { | |
| fn write_native_placeholder( | ||
| event: &mut Event, | ||
| placeholder: NativePlaceholder, | ||
| project_info: &ProjectInfo, | ||
| additional_exceptions: AdditionalExceptions, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This parameter exists to differentiate between the minidump and playstation cases?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I got test failures on the playstation endpoint and cursor complains about unreal. We might want to get rid of this parameter eventually but I didn't want to risk breaking any of those use cases for now (it could be that they implicitly rely on the deletion). |
||
| ) { | ||
| // Events must be native platform. | ||
| let platform = event.platform.value_mut(); | ||
|
|
@@ -71,21 +76,19 @@ fn write_native_placeholder( | |
| .value_mut() | ||
| .get_or_insert_with(Vec::new); | ||
|
|
||
| let allow_multiple_exceptions = project_info.has_feature(Feature::MinidumpMultiException); | ||
| if let Some(exc) = exceptions.first() { | ||
| relay_log::info!( | ||
| additional_exceptions = exceptions.len(), | ||
| native_exception_mechanism = placeholder.exception_type, | ||
|
Comment on lines
77
to
82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The logic to delete additional exceptions for Playstation and Unreal events has been removed, contradicting the stated requirement in the pull request description to preserve this behavior. Suggested FixRe-introduce logic to clear additional exceptions for Playstation and Unreal platforms. This could be achieved by passing platform information to the Prompt for AI AgentAlso affects:
Did we get this right? 👍 / 👎 to inform future reviews. |
||
| additional_exception_mechanism = ?get_value!(exc.mechanism.ty), | ||
| sentry_project = ?event.project, | ||
| event_id = ?event.id, | ||
| has_feature = allow_multiple_exceptions, | ||
| platform = ?event.platform, | ||
| "Native event has additional exceptions", | ||
| ) | ||
| } | ||
|
|
||
| if !allow_multiple_exceptions { | ||
| if matches!(additional_exceptions, AdditionalExceptions::Delete) { | ||
| exceptions.clear(); // clear previous errors if any | ||
| } | ||
|
|
||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
@@ -223,14 +226,18 @@ fn write_crashpad_annotations( | |
| /// | ||
| /// This function operates at best-effort. It always attaches the placeholder and returns | ||
|
jjbayer marked this conversation as resolved.
|
||
| /// successfully, even if the minidump or part of its data cannot be parsed. | ||
| pub fn process_minidump(event: &mut Event, item: &Item, project_info: &ProjectInfo) { | ||
| pub fn process_minidump( | ||
| event: &mut Event, | ||
| item: &Item, | ||
| additional_exceptions: AdditionalExceptions, | ||
| ) { | ||
| debug_assert_eq!(item.ty(), &ItemType::Attachment); | ||
| let placeholder = NativePlaceholder { | ||
| exception_type: "Minidump", | ||
| exception_value: "Invalid Minidump", | ||
| mechanism_type: "minidump", | ||
| }; | ||
| write_native_placeholder(event, placeholder, project_info); | ||
| write_native_placeholder(event, placeholder, additional_exceptions); | ||
|
|
||
| if item.is_attachment_ref() { | ||
| // We don't have a full minidump, just a placeholder for something that was uploaded | ||
|
|
@@ -293,11 +300,11 @@ pub fn process_minidump(event: &mut Event, item: &Item, project_info: &ProjectIn | |
|
|
||
| /// Writes minimal information into the event to indicate it is associated with an Apple Crash | ||
| /// Report. | ||
| pub fn process_apple_crash_report(event: &mut Event, project_info: &ProjectInfo) { | ||
| pub fn process_apple_crash_report(event: &mut Event, additional_exceptions: AdditionalExceptions) { | ||
| let placeholder = NativePlaceholder { | ||
| exception_type: "AppleCrashReport", | ||
| exception_value: "Invalid Apple Crash Report", | ||
| mechanism_type: "applecrashreport", | ||
| }; | ||
| write_native_placeholder(event, placeholder, project_info); | ||
| write_native_placeholder(event, placeholder, additional_exceptions); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add this to
GRADUATED_FEATURE_FLAGS: The feature flag was only used for minidumps, for which the native placeholder was only ever written in processing relays.