Skip to content

Commit

Permalink
feat: Expose tracing fields as span data (#445)
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <github@jessfraz.com>
  • Loading branch information
jessfraz committed May 20, 2022
1 parent 9c04fdf commit 25806c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sentry-tracing/src/layer.rs
Expand Up @@ -164,7 +164,7 @@ where
return;
}

let (description, _data) = extract_span_data(attrs);
let (description, data) = extract_span_data(attrs);
let op = span.name();

// Spans don't always have a description, this ensures our data is not empty,
Expand All @@ -186,6 +186,12 @@ where
sentry_core::start_transaction(ctx).into()
}
};
// Add the data from the original span to the sentry span.
// This comes from typically the `fields` in `tracing::instrument`.
for (key, value) in data {
sentry_span.set_data(&key, value);
}

sentry_core::configure_scope(|scope| scope.set_span(Some(sentry_span.clone())));

let mut extensions = span.extensions_mut();
Expand Down

0 comments on commit 25806c7

Please sign in to comment.