Skip to content
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

feat(native): Set sdk.name for events created from minidumps #4313

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
19 changes: 18 additions & 1 deletion relay-server/src/utils/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -192,6 +192,23 @@ pub fn process_minidump(event: &mut Event, data: &[u8]) {
}
};

let client_sdk_name = if minidump.get_stream::<MinidumpCrashpadInfo>().is_ok() {
"minidump.crashpad"
} else if minidump
.get_stream::<minidump::MinidumpBreakpadInfo>()
.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
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_minidump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down