From 7a09e335aa70be91e88de713eef0a0e34a4db15d Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 7 Nov 2022 09:39:03 +0100 Subject: [PATCH] Fix main builds (#66) * Remove unneeded derefs * Resolve reqwest_otel_span correctly in docs. Macros always resolve to the crate root. --- reqwest-tracing/src/reqwest_otel_span_builder.rs | 14 +++++++------- reqwest-tracing/src/reqwest_otel_span_macro.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/reqwest-tracing/src/reqwest_otel_span_builder.rs b/reqwest-tracing/src/reqwest_otel_span_builder.rs index 2d7cd6e..04f546f 100644 --- a/reqwest-tracing/src/reqwest_otel_span_builder.rs +++ b/reqwest-tracing/src/reqwest_otel_span_builder.rs @@ -59,10 +59,10 @@ pub fn default_on_request_success(span: &Span, response: &Response) { let status_code = response.status().as_u16() as i64; let user_agent = get_header_value("user_agent", response.headers()); if let Some(span_status) = span_status { - span.record(OTEL_STATUS_CODE, &span_status); + span.record(OTEL_STATUS_CODE, span_status); } - span.record(HTTP_STATUS_CODE, &status_code); - span.record(HTTP_USER_AGENT, &user_agent.as_str()); + span.record(HTTP_STATUS_CODE, status_code); + span.record(HTTP_USER_AGENT, user_agent.as_str()); } /// Populates default failure fields for a given [`reqwest_otel_span!`] span. @@ -70,13 +70,13 @@ pub fn default_on_request_success(span: &Span, response: &Response) { pub fn default_on_request_failure(span: &Span, e: &Error) { let error_message = e.to_string(); let error_cause_chain = format!("{:?}", e); - span.record(OTEL_STATUS_CODE, &"ERROR"); - span.record(ERROR_MESSAGE, &error_message.as_str()); - span.record(ERROR_CAUSE_CHAIN, &error_cause_chain.as_str()); + span.record(OTEL_STATUS_CODE, "ERROR"); + span.record(ERROR_MESSAGE, error_message.as_str()); + span.record(ERROR_CAUSE_CHAIN, error_cause_chain.as_str()); if let Error::Reqwest(e) = e { span.record( HTTP_STATUS_CODE, - &e.status() + e.status() .map(|s| s.to_string()) .unwrap_or_else(|| "".to_string()) .as_str(), diff --git a/reqwest-tracing/src/reqwest_otel_span_macro.rs b/reqwest-tracing/src/reqwest_otel_span_macro.rs index b6f0ed6..6917c0f 100644 --- a/reqwest-tracing/src/reqwest_otel_span_macro.rs +++ b/reqwest-tracing/src/reqwest_otel_span_macro.rs @@ -1,5 +1,5 @@ #[macro_export] -/// [`reqwest_otel_span!`] creates a new [`tracing::Span`]. +/// [`reqwest_otel_span!`](crate::reqwest_otel_span) creates a new [`tracing::Span`]. /// It empowers you to add custom properties to the span on top of the default properties provided by the macro /// /// Default Fields: @@ -26,7 +26,7 @@ /// /// # Macro syntax /// -/// The first argument passed to [`reqwest_otel_span!`] is a reference to an [`reqwest::Request`]. +/// The first argument passed to [`reqwest_otel_span!`](crate::reqwest_otel_span) is a reference to an [`reqwest::Request`]. /// /// ```rust /// use reqwest_middleware::Result;