Skip to content

Commit

Permalink
editoast: add telemetry to core requests
Browse files Browse the repository at this point in the history
  • Loading branch information
woshilapin committed Jul 5, 2024
1 parent 725b89a commit d057c76
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions editoast/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,18 @@ impl CoreClient {
CoreError::UnparsableErrorOutput.into()
}

#[tracing::instrument(target= "editoast::coreclient", name = "core:fetch", skip(self, body), err)]
async fn fetch<B: Serialize, R: CoreResponse>(
&self,
method: reqwest::Method,
path: &str,
body: Option<&B>,
) -> Result<R::Response> {
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;
Expand Down

0 comments on commit d057c76

Please sign in to comment.