Skip to content

Commit fcbd996

Browse files
authored
feat(profiling): Fix regression on making release optional and copy dist from transaction (#2107)
1 parent c38cd0a commit fcbd996

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
- On Linux, switch to `jemalloc` instead of the system memory allocator to reduce Relay's memory footprint. ([#2084](https://github.com/getsentry/relay/pull/2084))
3232
- Scrub sensitive cookies `__session`. ([#2105](https://github.com/getsentry/relay/pull/2105)))
3333
- Parse profiles' metadata to check if it should be marked as invalid. ([#2104](https://github.com/getsentry/relay/pull/2104))
34-
- Set release as optional by defaulting to an empty string for profiles. ([#2098](https://github.com/getsentry/relay/pull/2098))
34+
- Set release as optional by defaulting to an empty string and add a dist field for profiles. ([#2098](https://github.com/getsentry/relay/pull/2098), [#2107](https://github.com/getsentry/relay/pull/2107))
3535
- Accept source map debug images in debug meta for Profiling. ([#2097](https://github.com/getsentry/relay/pull/2097))
3636

3737
## 23.4.0

relay-profiling/src/android.rs

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ pub struct ProfileMetadata {
3737

3838
#[serde(default, skip_serializing_if = "String::is_empty")]
3939
release: String,
40+
#[serde(default, skip_serializing_if = "String::is_empty")]
41+
dist: String,
4042

4143
version_code: String,
4244
version_name: String,
@@ -203,6 +205,10 @@ pub fn parse_android_profile(
203205
profile.metadata.release = release.to_owned();
204206
}
205207

208+
if let Some(dist) = transaction_metadata.get("dist") {
209+
profile.metadata.dist = dist.to_owned();
210+
}
211+
206212
if let Some(environment) = transaction_metadata.get("environment") {
207213
profile.metadata.environment = environment.to_owned();
208214
}

relay-profiling/src/extract_from_transaction.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub fn extract_transaction_metadata(event: &Event) -> BTreeMap<String, String> {
1212
if let Some(release) = event.release.as_str() {
1313
tags.insert("release".to_owned(), release.to_owned());
1414
}
15+
if let Some(dist) = event.dist.as_str() {
16+
tags.insert("dist".to_owned(), dist.to_owned());
17+
}
1518
if let Some(dist) = event.dist.value() {
1619
tags.insert("dist".to_owned(), dist.clone());
1720
}

relay-profiling/src/sample.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ pub struct ProfileMetadata {
150150
#[serde(alias = "profile_id")]
151151
event_id: EventId,
152152
platform: String,
153-
release: String,
154153
timestamp: DateTime<Utc>,
155154

155+
#[serde(default, skip_serializing_if = "String::is_empty")]
156+
release: String,
157+
#[serde(default, skip_serializing_if = "String::is_empty")]
158+
dist: String,
159+
156160
#[serde(default, skip_serializing_if = "Vec::is_empty")]
157161
transactions: Vec<TransactionMetadata>,
158162
#[serde(default, skip_serializing_if = "Option::is_none")]
@@ -347,6 +351,10 @@ pub fn parse_sample_profile(
347351
profile.metadata.release = release.to_owned();
348352
}
349353

354+
if let Some(dist) = transaction_metadata.get("dist") {
355+
profile.metadata.dist = dist.to_owned();
356+
}
357+
350358
if let Some(environment) = transaction_metadata.get("environment") {
351359
profile.metadata.environment = environment.to_owned();
352360
}
@@ -401,7 +409,8 @@ mod tests {
401409
event_id: EventId::new(),
402410
transaction: Option::None,
403411
transactions: Vec::new(),
404-
release: "1.0 (9999)".to_string(),
412+
release: "1.0".to_string(),
413+
dist: "9999".to_string(),
405414
measurements: None,
406415
transaction_metadata: BTreeMap::new(),
407416
transaction_tags: BTreeMap::new(),

0 commit comments

Comments
 (0)