fix: Remove full url from default span & `http.url` -> `url.full` in `SpanBackendWithUrl`
parent
d401fc52e7
commit
d2286b5e79
|
@ -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<Response>, _: &mut Extensions) {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue