Skip to content

Commit 25806c7

Browse files
authored
feat: Expose tracing fields as span data (#445)
Signed-off-by: Jess Frazelle <[email protected]>
1 parent 9c04fdf commit 25806c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sentry-tracing/src/layer.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ where
164164
return;
165165
}
166166

167-
let (description, _data) = extract_span_data(attrs);
167+
let (description, data) = extract_span_data(attrs);
168168
let op = span.name();
169169

170170
// Spans don't always have a description, this ensures our data is not empty,
@@ -186,6 +186,12 @@ where
186186
sentry_core::start_transaction(ctx).into()
187187
}
188188
};
189+
// Add the data from the original span to the sentry span.
190+
// This comes from typically the `fields` in `tracing::instrument`.
191+
for (key, value) in data {
192+
sentry_span.set_data(&key, value);
193+
}
194+
189195
sentry_core::configure_scope(|scope| scope.set_span(Some(sentry_span.clone())));
190196

191197
let mut extensions = span.extensions_mut();

0 commit comments

Comments
 (0)