Skip to content
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
6 changes: 6 additions & 0 deletions sentry-core/src/scope/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ impl Scope {

/// Applies the contained scoped data to fill a transaction.
pub fn apply_to_transaction(&self, transaction: &mut Transaction<'static>) {
if transaction.user.is_none() {
if let Some(user) = self.user.as_deref() {
transaction.user = Some(user.clone());
}
}

transaction
.extra
.extend(self.extra.iter().map(|(k, v)| (k.to_owned(), v.to_owned())));
Expand Down
5 changes: 5 additions & 0 deletions sentry-types/src/protocol/v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,9 @@ pub struct Transaction<'a> {
/// An optional environment identifier.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub environment: Option<Cow<'a, str>>,
/// Optionally user data to be sent along.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
/// Optional tags to be attached to the event.
#[serde(default, skip_serializing_if = "Map::is_empty")]
pub tags: Map<String, String>,
Expand Down Expand Up @@ -2002,6 +2005,7 @@ impl<'a> Default for Transaction<'a> {
Transaction {
event_id: event::default_id(),
name: Default::default(),
user: Default::default(),
tags: Default::default(),
extra: Default::default(),
release: Default::default(),
Expand All @@ -2028,6 +2032,7 @@ impl<'a> Transaction<'a> {
Transaction {
event_id: self.event_id,
name: self.name,
user: self.user,
tags: self.tags,
extra: self.extra,
release: self.release.map(|x| Cow::Owned(x.into_owned())),
Expand Down