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(profiling): Fix regression on making release optional and copy dist from transaction #2107

Merged
merged 4 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -33,6 +33,7 @@
- Parse profiles' metadata to check if it should be marked as invalid. ([#2104](https://github.com/getsentry/relay/pull/2104))
- Set release as optional by defaulting to an empty string for profiles. ([#2098](https://github.com/getsentry/relay/pull/2098))
- Accept source map debug images in debug meta for Profiling. ([#2097](https://github.com/getsentry/relay/pull/2097))
- Fix regression on release being optional and copy missing dist field from transactions.([#2107](https://github.com/getsentry/relay/pull/2107))

## 23.4.0

Expand Down
6 changes: 6 additions & 0 deletions relay-profiling/src/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub struct ProfileMetadata {

#[serde(default, skip_serializing_if = "String::is_empty")]
release: String,
#[serde(default, skip_serializing_if = "String::is_empty")]
dist: String,

version_code: String,
version_name: String,
Expand Down Expand Up @@ -203,6 +205,10 @@ pub fn parse_android_profile(
profile.metadata.release = release.to_owned();
}

if let Some(dist) = transaction_metadata.get("dist") {
profile.metadata.dist = dist.to_owned();
}

if let Some(environment) = transaction_metadata.get("environment") {
profile.metadata.environment = environment.to_owned();
}
Expand Down
3 changes: 3 additions & 0 deletions relay-profiling/src/extract_from_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub fn extract_transaction_metadata(event: &Event) -> BTreeMap<String, String> {
if let Some(release) = event.release.as_str() {
tags.insert("release".to_owned(), release.to_owned());
}
if let Some(dist) = event.dist.as_str() {
tags.insert("dist".to_owned(), dist.to_owned());
}
if let Some(dist) = event.dist.value() {
tags.insert("dist".to_owned(), dist.clone());
}
Expand Down
13 changes: 11 additions & 2 deletions relay-profiling/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ pub struct ProfileMetadata {
#[serde(alias = "profile_id")]
event_id: EventId,
platform: String,
release: String,
timestamp: DateTime<Utc>,

#[serde(default, skip_serializing_if = "String::is_empty")]
release: String,
#[serde(default, skip_serializing_if = "String::is_empty")]
dist: String,

#[serde(default, skip_serializing_if = "Vec::is_empty")]
transactions: Vec<TransactionMetadata>,
#[serde(default, skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -347,6 +351,10 @@ pub fn parse_sample_profile(
profile.metadata.release = release.to_owned();
}

if let Some(dist) = transaction_metadata.get("dist") {
profile.metadata.dist = dist.to_owned();
}

if let Some(environment) = transaction_metadata.get("environment") {
profile.metadata.environment = environment.to_owned();
}
Expand Down Expand Up @@ -401,7 +409,8 @@ mod tests {
event_id: EventId::new(),
transaction: Option::None,
transactions: Vec::new(),
release: "1.0 (9999)".to_string(),
release: "1.0".to_string(),
dist: "9999".to_string(),
measurements: None,
transaction_metadata: BTreeMap::new(),
transaction_tags: BTreeMap::new(),
Expand Down