From 3c769475f394231e5bd269598efebfcdc3856227 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 6 Dec 2022 15:30:35 +0100 Subject: [PATCH 1/7] event level depending on asset/ensure --- relay-server/src/utils/unreal.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/relay-server/src/utils/unreal.rs b/relay-server/src/utils/unreal.rs index 868136fe2d..a0369f8ee6 100644 --- a/relay-server/src/utils/unreal.rs +++ b/relay-server/src/utils/unreal.rs @@ -6,8 +6,8 @@ use symbolic_unreal::{ use relay_config::Config; use relay_general::protocol::{ AsPair, Breadcrumb, ClientSdkInfo, Context, Contexts, DeviceContext, Event, EventId, - GpuContext, LenientString, LogEntry, Message, OsContext, TagEntry, Tags, Timestamp, User, - UserReport, Values, + GpuContext, LenientString, Level, LogEntry, Message, OsContext, TagEntry, Tags, Timestamp, + User, UserReport, Values, }; use relay_general::types::{self, Annotated, Array, Object, Value}; @@ -228,6 +228,14 @@ fn merge_unreal_context(event: &mut Event, context: Unreal4Context) { } } + if let Some(something) = runtime_props.is_assert { + event.level = Annotated::new(Level::Info) + } + + if let Some(something) = runtime_props.is_ensure { + event.level = Annotated::new(Level::Info) + } + // Modules are not used and later replaced with Modules from the Minidump or Apple Crash Report. runtime_props.modules.take(); From 2314a63614589e0ec6c98c49a78b94b94554b5d4 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 6 Dec 2022 15:45:53 +0100 Subject: [PATCH 2/7] naming and level --- relay-server/src/utils/unreal.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/relay-server/src/utils/unreal.rs b/relay-server/src/utils/unreal.rs index a0369f8ee6..5ef62fa7ac 100644 --- a/relay-server/src/utils/unreal.rs +++ b/relay-server/src/utils/unreal.rs @@ -228,12 +228,12 @@ fn merge_unreal_context(event: &mut Event, context: Unreal4Context) { } } - if let Some(something) = runtime_props.is_assert { - event.level = Annotated::new(Level::Info) + if let Some(is_assert) = runtime_props.is_assert { + event.level = Annotated::new(Level::Error) } - if let Some(something) = runtime_props.is_ensure { - event.level = Annotated::new(Level::Info) + if let Some(is_ensure) = runtime_props.is_ensure { + event.level = Annotated::new(Level::Warning) } // Modules are not used and later replaced with Modules from the Minidump or Apple Crash Report. From a9034696f8c84be58bdda96f71691f9a98c76300 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 6 Dec 2022 15:55:49 +0100 Subject: [PATCH 3/7] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d140f91b3..003522f3a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ **Features**: +- The level of events created from the Unreal Crash Reports is now depending whether it was an actual crash or an assert. ([#1677](https://github.com/getsentry/relay/pull/1677)) - Dynamic sampling is now based on the volume received by Relay by default and does not include the original volume dropped by client-side sampling in SDKs. This is required for the final dynamic sampling feature in the latest Sentry plans. ([#1591](https://github.com/getsentry/relay/pull/1591)) - Add OpenTelemetry Context ([#1617](https://github.com/getsentry/relay/pull/1617)) From 575cdee44278e71127a4346e5823e1e9ba540b9a Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 6 Dec 2022 16:18:13 +0100 Subject: [PATCH 4/7] simplify check --- relay-server/src/utils/unreal.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relay-server/src/utils/unreal.rs b/relay-server/src/utils/unreal.rs index 5554158191..24d4e9c505 100644 --- a/relay-server/src/utils/unreal.rs +++ b/relay-server/src/utils/unreal.rs @@ -226,11 +226,11 @@ fn merge_unreal_context(event: &mut Event, context: Unreal4Context) { } } - if let Some(is_assert) = runtime_props.is_assert { + if Some(runtime_props.is_assert) == true { event.level = Annotated::new(Level::Error) } - if let Some(is_ensure) = runtime_props.is_ensure { + if Some(runtime_props.is_ensure) == true { event.level = Annotated::new(Level::Warning) } From dd68c1082958d85b5bdfc2580b4979c544b80149 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 7 Dec 2022 10:37:23 +0100 Subject: [PATCH 5/7] if --- relay-server/src/utils/unreal.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relay-server/src/utils/unreal.rs b/relay-server/src/utils/unreal.rs index 24d4e9c505..a598157378 100644 --- a/relay-server/src/utils/unreal.rs +++ b/relay-server/src/utils/unreal.rs @@ -226,11 +226,11 @@ fn merge_unreal_context(event: &mut Event, context: Unreal4Context) { } } - if Some(runtime_props.is_assert) == true { + if runtime_props.is_assert.unwrap_or(false) { event.level = Annotated::new(Level::Error) } - if Some(runtime_props.is_ensure) == true { + if runtime_props.is_ensure.unwrap_or(false) { event.level = Annotated::new(Level::Warning) } From e5ecee45af27b704916c40ecab9152a543679bc1 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 12 Dec 2022 15:49:06 +0100 Subject: [PATCH 6/7] added tests --- relay-server/src/utils/unreal.rs | 37 +++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/relay-server/src/utils/unreal.rs b/relay-server/src/utils/unreal.rs index a598157378..68b411d1a6 100644 --- a/relay-server/src/utils/unreal.rs +++ b/relay-server/src/utils/unreal.rs @@ -322,10 +322,10 @@ pub fn process_unreal_envelope( #[cfg(test)] mod tests { + use super::*; - #[test] - fn test_merge_unreal_context() { + fn get_context() -> Unreal4Context { let raw_context = br##" @@ -354,7 +354,12 @@ mod tests { "##; - let context = Unreal4Context::parse(raw_context).unwrap(); + Unreal4Context::parse(raw_context).unwrap() + } + + #[test] + fn test_merge_unreal_context() { + let context = get_context(); let mut event = Event::default(); merge_unreal_context(&mut event, context); @@ -362,6 +367,32 @@ mod tests { insta::assert_snapshot!(Annotated::new(event).to_json_pretty().unwrap()); } + #[test] + fn test_merge_unreal_context_is_assert_level_error() { + let mut context = get_context(); + let mut runtime_props = context.runtime_properties.as_mut().unwrap(); + runtime_props.is_assert = Some(true); + + let mut event = Event::default(); + + merge_unreal_context(&mut event, context); + + assert_eq!(event.level, Annotated::new(Level::Error)); + } + + #[test] + fn test_merge_unreal_context_is_esure_level_warning() { + let mut context = get_context(); + let mut runtime_props = context.runtime_properties.as_mut().unwrap(); + runtime_props.is_ensure = Some(true); + + let mut event = Event::default(); + + merge_unreal_context(&mut event, context); + + assert_eq!(event.level, Annotated::new(Level::Warning)); + } + #[test] fn test_merge_unreal_logs() { let logs = br##"Log file open, 10/29/18 17:56:37 From f09a82170a21972c9318f40bee0eb598cefa85f2 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 12 Dec 2022 15:51:06 +0100 Subject: [PATCH 7/7] Updated CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b7c8128c9..80bfeb85d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ **Features**: -- The level of events created from the Unreal Crash Reports is now depending whether it was an actual crash or an assert. ([#1677](https://github.com/getsentry/relay/pull/1677)) +- The level of events created from Unreal Crash Reports now depends on whether it was an actual crash or an assert. ([#1677](https://github.com/getsentry/relay/pull/1677)) - Dynamic sampling is now based on the volume received by Relay by default and does not include the original volume dropped by client-side sampling in SDKs. This is required for the final dynamic sampling feature in the latest Sentry plans. ([#1591](https://github.com/getsentry/relay/pull/1591)) - Add OpenTelemetry Context ([#1617](https://github.com/getsentry/relay/pull/1617)) - Add `app.in_foreground` and `thread.main` flag to protocol. ([#1578](https://github.com/getsentry/relay/pull/1578))