Skip to content

Commit

Permalink
Remove profile ID instead fo the whole context
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops committed Jun 19, 2024
1 parent 2df3da2 commit 20dd110
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions relay-event-schema/src/protocol/contexts/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ use crate::protocol::EventId;
#[cfg_attr(feature = "jsonschema", derive(JsonSchema))]
pub struct ProfileContext {
/// The profile ID.
#[metastructure(required = "false")]
pub profile_id: Annotated<EventId>,

/// The profiler ID.
#[metastructure(required = "false")]
pub profiler_id: Annotated<EventId>,
}

Expand Down Expand Up @@ -61,6 +59,7 @@ mod tests {
"type": "profile"
}"#;
let context = Annotated::new(Context::Profile(Box::new(ProfileContext {
profiler_id: Annotated::empty(),
profile_id: Annotated::new(EventId(
"4c79f60c11214eb38604f4ae0781bfb2".parse().unwrap(),
)),
Expand All @@ -77,6 +76,7 @@ mod tests {
"type": "profile"
}"#;
let context = Annotated::new(Context::Profile(Box::new(ProfileContext {
profiler_id: Annotated::empty(),
profile_id: Annotated::new(EventId(
"4c79f60c11214eb38604f4ae0781bfb2".parse().unwrap(),
)),
Expand Down
10 changes: 8 additions & 2 deletions relay-server/src/services/processor/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ pub fn transfer_id(
let contexts = event.contexts.get_or_insert_with(Contexts::new);
contexts.add(ProfileContext {
profile_id: Annotated::new(profile_id),
..Default::default()
profiler_id: Annotated::empty(),
});
}
_ => (),
None => {
if let Some(contexts) = event.contexts.value_mut() {
if let Some(profile_context) = contexts.get::<ProfileContext>() {
profile_context.profile_id = Annotated::empty();
}
}
}
}
}

Expand Down

0 comments on commit 20dd110

Please sign in to comment.