fix: restore adding http.url as an attribute when deprecated_attributes feature is enabled

pull/173/head^2
Tom Finlayson 2024-08-22 15:55:22 +01:00 committed by Ethan Brierley
parent 603ef97144
commit 3ddfded9e3
1 changed files with 7 additions and 1 deletions

View File

@ -165,7 +165,13 @@ pub struct SpanBackendWithUrl;
impl ReqwestOtelSpanBackend for SpanBackendWithUrl { impl ReqwestOtelSpanBackend for SpanBackendWithUrl {
fn on_request_start(req: &Request, ext: &mut Extensions) -> Span { fn on_request_start(req: &Request, ext: &mut Extensions) -> Span {
let name = default_span_name(req, ext); let name = default_span_name(req, ext);
reqwest_otel_span!(name = name, req, url.full = %remove_credentials(req.url())) let url = remove_credentials(req.url());
let span = reqwest_otel_span!(name = name, req, url.full = %url);
#[cfg(feature = "deprecated_attributes")]
{
span.record(HTTP_URL, url.to_string());
}
span
} }
fn on_request_end(span: &Span, outcome: &Result<Response>, _: &mut Extensions) { fn on_request_end(span: &Span, outcome: &Result<Response>, _: &mut Extensions) {