From 391c9984c8ac3bde9aba383a0baef861ef4a19af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 20 Jun 2024 16:07:11 +0100 Subject: [PATCH] possibly useful, or not, logs for topology request --- .../validator-client/src/nym_api/mod.rs | 3 +++ common/http-api-client/src/lib.rs | 20 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/common/client-libs/validator-client/src/nym_api/mod.rs b/common/client-libs/validator-client/src/nym_api/mod.rs index 8c2f46d1d1..635b39101c 100644 --- a/common/client-libs/validator-client/src/nym_api/mod.rs +++ b/common/client-libs/validator-client/src/nym_api/mod.rs @@ -4,6 +4,7 @@ use crate::nym_api::error::NymAPIError; use crate::nym_api::routes::{CORE_STATUS_COUNT, SINCE_ARG}; use async_trait::async_trait; +use log::info; pub use nym_api_requests::{ coconut::{ models::{ @@ -100,7 +101,9 @@ pub trait NymApiClientExt: ApiClient { &self, semver_compatibility: Option, ) -> Result, NymAPIError> { + info!("attempting to query the mixnodes/skimmed endpoint"); let params = if let Some(semver_compatibility) = &semver_compatibility { + info!("attaching semver_compatibility param"); vec![("semver_compatibility", semver_compatibility.as_str())] } else { vec![] diff --git a/common/http-api-client/src/lib.rs b/common/http-api-client/src/lib.rs index 0102a019bb..bff4bc1062 100644 --- a/common/http-api-client/src/lib.rs +++ b/common/http-api-client/src/lib.rs @@ -3,13 +3,13 @@ use async_trait::async_trait; use reqwest::header::HeaderValue; -use reqwest::{RequestBuilder, Response, StatusCode}; +use reqwest::{Error, RequestBuilder, Response, StatusCode}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::fmt::Display; use std::time::Duration; use thiserror::Error; -use tracing::warn; +use tracing::{error, info, warn}; use url::Url; pub use reqwest::IntoUrl; @@ -207,6 +207,7 @@ impl Client { E: Display, { let url = sanitize_url(&self.base_url, path, params); + info!("sanitised the request url into {url}"); #[cfg(target_arch = "wasm32")] { @@ -222,7 +223,19 @@ impl Client { #[cfg(not(target_arch = "wasm32"))] { - Ok(self.reqwest_client.get(url).send().await?) + let req = self.reqwest_client.get(url); + match req.send().await { + Ok(response) => { + info!("request was succesfull"); + Ok(response) + } + Err(err) => { + error!("request failed: {err}"); + error!("url: {:?}", err.url()); + error!("status code: {:?}", err.status()); + Err(err.into()) + } + } } } @@ -282,6 +295,7 @@ impl Client { V: AsRef, E: Display + DeserializeOwned, { + info!("attempting to send the get request"); let res = self.send_get_request(path, params).await?; parse_response(res, false).await }