From d2286b5e7977df08913e179dc8e0d4bb43f278cd Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Wed, 10 Apr 2024 09:12:00 +0100 Subject: [PATCH] fix: Remove full url from default span & `http.url` -> `url.full` in `SpanBackendWithUrl` --- reqwest-tracing/src/reqwest_otel_span_builder.rs | 6 +++--- reqwest-tracing/src/reqwest_otel_span_macro.rs | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/reqwest-tracing/src/reqwest_otel_span_builder.rs b/reqwest-tracing/src/reqwest_otel_span_builder.rs index c006d9d..cf3772c 100644 --- a/reqwest-tracing/src/reqwest_otel_span_builder.rs +++ b/reqwest-tracing/src/reqwest_otel_span_builder.rs @@ -103,7 +103,7 @@ pub fn default_span_name<'a>(req: &'a Request, ext: &'a Extensions) -> Cow<'a, s } /// The default [`ReqwestOtelSpanBackend`] for [`TracingMiddleware`]. Note that it doesn't include -/// the `http.url` field in spans, you can use [`SpanBackendWithUrl`] to add it. +/// the `url.full` field in spans, you can use [`SpanBackendWithUrl`] to add it. /// /// [`TracingMiddleware`]: crate::middleware::TracingMiddleware pub struct DefaultSpanBackend; @@ -119,7 +119,7 @@ impl ReqwestOtelSpanBackend for DefaultSpanBackend { } } -/// Similar to [`DefaultSpanBackend`] but also adds the `http.url` attribute to request spans. +/// Similar to [`DefaultSpanBackend`] but also adds the `url.full` attribute to request spans. /// /// [`TracingMiddleware`]: crate::middleware::TracingMiddleware pub struct SpanBackendWithUrl; @@ -127,7 +127,7 @@ pub struct SpanBackendWithUrl; impl ReqwestOtelSpanBackend for SpanBackendWithUrl { fn on_request_start(req: &Request, ext: &mut Extensions) -> Span { let name = default_span_name(req, ext); - reqwest_otel_span!(name = name, req, http.url = %remove_credentials(req.url())) + reqwest_otel_span!(name = name, req, url.full = %remove_credentials(req.url())) } fn on_request_end(span: &Span, outcome: &Result, _: &mut Extensions) { diff --git a/reqwest-tracing/src/reqwest_otel_span_macro.rs b/reqwest-tracing/src/reqwest_otel_span_macro.rs index c6543e3..3f3d732 100644 --- a/reqwest-tracing/src/reqwest_otel_span_macro.rs +++ b/reqwest-tracing/src/reqwest_otel_span_macro.rs @@ -7,7 +7,6 @@ /// - url.scheme /// - server.address /// - server.port -/// - url.full /// - otel.kind /// - otel.name /// - otel.status_code @@ -54,7 +53,7 @@ /// /// If nothing else is specified, the span generated by `reqwest_otel_span!` is identical to the one you'd /// get by using [`DefaultSpanBackend`]. Note that to avoid leaking sensitive information, the -/// macro doesn't include `http.url`, even though it's required by opentelemetry. You can add the +/// macro doesn't include `url.full`, even though it's required by opentelemetry. You can add the /// URL attribute explicitly by using [`SpanBackendWithUrl`] instead of `DefaultSpanBackend` or /// adding the field on your own implementation. /// @@ -137,7 +136,6 @@ macro_rules! reqwest_otel_span { url.scheme = %scheme, server.address = %host, server.port = %host_port, - url.full = %url, user_agent.original = %user_agent, otel.kind = "client", otel.name = %otel_name,