diff --git a/CHANGELOG.md b/CHANGELOG.md index 4daab18199..b26195320f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ **Features**: +- Set `sdk.name` for events created from minidumps. ([#4313](https://github.com/getsentry/relay/pull/4313)) - Add check to ensure unreal user info is not empty. ([#4225](https://github.com/getsentry/relay/pull/4225)) - Retain empty string values in `span.data` and `event.contexts.trace.data`. ([#4174](https://github.com/getsentry/relay/pull/4174)) - Allow `sample_rate` to be float type when deserializing `DynamicSamplingContext`. ([#4181](https://github.com/getsentry/relay/pull/4181)) diff --git a/relay-server/src/utils/native.rs b/relay-server/src/utils/native.rs index 23d641b94f..bc9c32a169 100644 --- a/relay-server/src/utils/native.rs +++ b/relay-server/src/utils/native.rs @@ -9,7 +9,7 @@ use std::error::Error; use chrono::{TimeZone, Utc}; use minidump::{MinidumpAnnotation, MinidumpCrashpadInfo, MinidumpModuleList, Module}; use relay_event_schema::protocol::{ - Context, Contexts, Event, Exception, JsonLenientString, Level, Mechanism, Values, + ClientSdkInfo, Context, Contexts, Event, Exception, JsonLenientString, Level, Mechanism, Values, }; use relay_protocol::{Annotated, Value}; @@ -192,6 +192,23 @@ pub fn process_minidump(event: &mut Event, data: &[u8]) { } }; + let client_sdk_name = if minidump.get_stream::().is_ok() { + "minidump.crashpad" + } else if minidump + .get_stream::() + .is_ok() + { + "minidump.breakpad" + } else { + "minidump.unknown" + }; + + // Add sdk information for analytics. + event.client_sdk.get_or_insert_with(|| ClientSdkInfo { + name: Annotated::new(client_sdk_name.to_owned()), + ..ClientSdkInfo::default() + }); + // Use the minidump's timestamp as the event's primary time. This timestamp can lie multiple // days in the past, in which case the event may be rejected in store normalization. let timestamp = Utc diff --git a/tests/integration/test_minidump.py b/tests/integration/test_minidump.py index b4c4bba378..1d12c136bb 100644 --- a/tests/integration/test_minidump.py +++ b/tests/integration/test_minidump.py @@ -448,6 +448,9 @@ def test_minidump_with_processing( # Check information extracted from the minidump assert event["timestamp"] == 1574692481.0 # 11/25/2019 @ 2:34pm (UTC) + # Check that the SDK name is correctly detected + assert event["sdk"]["name"] == "minidump.unknown" + assert list(message["attachments"]) == [ { "id": attachment_id,