Skip to content

Commit

Permalink
feat(core): transaction.set_data sets context.trace.data
Browse files Browse the repository at this point in the history
  • Loading branch information
lcian committed Feb 5, 2025
1 parent 1d3212a commit 8117ef6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions sentry-core/src/performance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,7 @@ impl Transaction {
/// Set some extra information to be sent with this Transaction.
pub fn set_data(&self, key: &str, value: protocol::Value) {
let mut inner = self.inner.lock().unwrap();
if let Some(transaction) = inner.transaction.as_mut() {
transaction.extra.insert(key.into(), value);
}
inner.context.data.insert(key.into(), value);
}

/// Sets a tag to a specific value.
Expand Down
3 changes: 3 additions & 0 deletions sentry-types/src/protocol/v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,9 @@ pub struct TraceContext {
/// Describes the status of the span (e.g. `ok`, `cancelled`, etc.)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status: Option<SpanStatus>,
/// Optional extra information to be associated with the trace.
#[serde(default, skip_serializing_if = "Map::is_empty")]
pub data: Map<String, Value>,
}

macro_rules! into_context {
Expand Down

0 comments on commit 8117ef6

Please sign in to comment.