sentry-rust
sentry-rust copied to clipboard
Distributed tracing of outgoing request
I have several services which are written in Rust and communicate over HTTP APIs, all these services are going to be instrumented via Sentry. I am trying to setup distributed tracing among them, but have found out that the sentry SDK currently does not support outgoing requests.
I therefore have two questions:
Is support for popular client libraries such as reqwest planned?
I am aware that I "only" need to send the sentry-trace and baggage HTTP headers, which means that I (in theory) would be able to implement this quite easily myself, but I haven't found any documentation about how to obtain these values. What do these headers actually contain and how can I obtain these values to attach them to my HTTP requests?
Thanks so much in advance!
With Rust, it is not really possible to hook into this automatically, and thus has to be done manually, like so:
if let Some(span) = sentry::configure_scope(|scope| scope.get_span()) {
for (k, v) in span.iter_headers() {
request = request.header(k, v);
}
}
(from https://github.com/getsentry/symbolicator/blob/344e90f8c4aa07fe9bd1a311dd4320f33b7ee8f8/crates/symbolicator-service/src/services/download/sentry.rs#L187-L191 )
It might be possible to add a convenience method via an extension trait, for example builder.propagate_sentry_trace() or something…