snix_tracing/propagate/reqwest.rs
1use reqwest_tracing::{SpanBackendWithUrl, TracingMiddleware};
2
3/// Returns a new tracing middleware which can be used with reqwest_middleware.
4/// It will then write the `traceparent` in the header on the request and additionally records the
5/// `url` into `http.url`.
6///
7/// If otlp feature is disabled, this will not insert a `traceparent` into the header. It will
8/// basically function as a noop.
9///
10/// `traceparent` => <https://www.w3.org/TR/trace-context/#trace-context-http-headers-format>
11pub fn tracing_middleware() -> TracingMiddleware<SpanBackendWithUrl> {
12 TracingMiddleware::<SpanBackendWithUrl>::new()
13}