Skip to content

Commit 52a07a4

Browse files
authored
ref(profiling): make client sdk mandatory (#4853)
For continuous profiling (v2), the `client_sdk` is mandatory. If missing, validation should fail and the chunk should be dropped. Doc changes: getsentry/sentry-docs#14135
1 parent 9a637ea commit 52a07a4

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
**Features**:
66

77
- Add configuration to allow high cardinality tags in metrics. ([#4805](https://github.com/getsentry/relay/pull/4805))
8+
- Make client sdk mandatory for profile sample v2. ([#4853](https://github.com/getsentry/relay/pull/4853))
89

910
**Internal**:
1011

relay-profiling/src/sample/v2.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use crate::error::ProfileError;
2121
use crate::measurements::ChunkMeasurement;
2222
use crate::sample::{DebugMeta, Frame, ThreadMetadata, Version};
2323
use crate::types::ClientSdk;
24-
use crate::utils::default_client_sdk;
2524

2625
const MAX_PROFILE_CHUNK_DURATION_SECS: f64 = MAX_PROFILE_CHUNK_DURATION.as_secs_f64();
2726
#[derive(Debug, Serialize, Deserialize)]
@@ -39,8 +38,7 @@ pub struct ProfileMetadata {
3938
pub platform: String,
4039
pub release: Option<String>,
4140

42-
#[serde(skip_serializing_if = "Option::is_none")]
43-
pub client_sdk: Option<ClientSdk>,
41+
pub client_sdk: ClientSdk,
4442

4543
/// Hard-coded string containing "2" to indicate the format version.
4644
pub version: Version,
@@ -73,10 +71,6 @@ impl ProfileChunk {
7371
pub fn normalize(&mut self) -> Result<(), ProfileError> {
7472
let platform = self.metadata.platform.as_str();
7573

76-
if self.metadata.client_sdk.is_none() {
77-
self.metadata.client_sdk = default_client_sdk(platform);
78-
}
79-
8074
self.profile.normalize(platform)
8175
}
8276
}

relay-profiling/src/types.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ pub struct DebugMeta {
1212
#[derive(Debug, Serialize, Deserialize, Clone)]
1313
pub struct ClientSdk {
1414
pub name: String,
15-
16-
#[serde(default, skip_serializing_if = "String::is_empty")]
1715
pub version: String,
1816
}

0 commit comments

Comments
 (0)