From 8c9c749b364045b312f5c69f9769e2bcf01fa99e Mon Sep 17 00:00:00 2001 From: Jean SIMARD Date: Fri, 5 Jul 2024 11:33:09 +0200 Subject: [PATCH] editoast: add telemetry to core requests --- editoast/src/core/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/editoast/src/core/mod.rs b/editoast/src/core/mod.rs index 771953e4609..a0f94d38686 100644 --- a/editoast/src/core/mod.rs +++ b/editoast/src/core/mod.rs @@ -98,6 +98,12 @@ impl CoreClient { CoreError::UnparsableErrorOutput.into() } + #[tracing::instrument( + target = "editoast::coreclient", + name = "core:fetch", + skip(self, body), + err + )] async fn fetch( &self, method: reqwest::Method, @@ -105,8 +111,10 @@ impl CoreClient { body: Option<&B>, ) -> Result { let method_s = colored_method(&method); - info!(target: "editoast::coreclient", "{method_s} {path}"); - debug!(target: "editoast::coreclient", "Request content: {body}", body = body.and_then(|b| serde_json::to_string_pretty(b).ok()).unwrap_or_default()); + debug!( + target: "editoast::coreclient", + body = body.and_then(|b| serde_json::to_string_pretty(b).ok()).unwrap_or_default(), + "Request content"); match self { CoreClient::Direct(client) => { let mut i_try = 0;