This is an automated email from the ASF dual-hosted git repository.

piotr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 0cd275731 feat(connectors): log retry request with URL details (#2457)
0cd275731 is described below

commit 0cd27573187ee04db27e045830272955a060fdaa
Author: tungtose <[email protected]>
AuthorDate: Wed Dec 10 03:11:56 2025 +0700

    feat(connectors): log retry request with URL details (#2457)
---
 Cargo.lock                                             | 18 ++++++++++++++++++
 Cargo.toml                                             |  1 +
 DEPENDENCIES.md                                        |  1 +
 core/connectors/runtime/Cargo.toml                     |  1 +
 .../runtime/src/configs/connectors/http_provider.rs    |  4 +++-
 core/sdk/Cargo.toml                                    |  1 +
 core/sdk/src/http/http_client.rs                       |  2 ++
 7 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/Cargo.lock b/Cargo.lock
index 9f54f7466..d1d42d46f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4624,6 +4624,7 @@ dependencies = [
  "reqwest",
  "reqwest-middleware",
  "reqwest-retry",
+ "reqwest-tracing",
  "rustls",
  "serde",
  "tokio",
@@ -4736,6 +4737,7 @@ dependencies = [
  "reqwest",
  "reqwest-middleware",
  "reqwest-retry",
+ "reqwest-tracing",
  "serde",
  "serde_json",
  "serde_with",
@@ -7626,6 +7628,22 @@ dependencies = [
  "wasmtimer",
 ]
 
+[[package]]
+name = "reqwest-tracing"
+version = "0.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "d70ea85f131b2ee9874f0b160ac5976f8af75f3c9badfe0d955880257d10bd83"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "getrandom 0.2.16",
+ "http 1.4.0",
+ "matchit",
+ "reqwest",
+ "reqwest-middleware",
+ "tracing",
+]
+
 [[package]]
 name = "retry-policies"
 version = "0.5.1"
diff --git a/Cargo.toml b/Cargo.toml
index f5bd70985..68679eada 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -160,6 +160,7 @@ reqwest = { version = "0.12.25", default-features = false, 
features = [
 ] }
 reqwest-middleware = { version = "0.4.2", features = ["json"] }
 reqwest-retry = "0.8.0"
+reqwest-tracing = "0.5.8"
 rust-s3 = { version = "0.37.0", default-features = false, features = [
     "tokio-rustls-tls",
     "tags",
diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md
index 4ca793e0f..928173763 100644
--- a/DEPENDENCIES.md
+++ b/DEPENDENCIES.md
@@ -668,6 +668,7 @@ reqsign: 0.16.5, "Apache-2.0",
 reqwest: 0.12.25, "Apache-2.0 OR MIT",
 reqwest-middleware: 0.4.2, "Apache-2.0 OR MIT",
 reqwest-retry: 0.8.0, "Apache-2.0 OR MIT",
+reqwest-tracing: 0.5.8, "Apache-2.0 OR MIT",
 retry-policies: 0.5.1, "Apache-2.0 OR MIT",
 rfc6979: 0.4.0, "Apache-2.0 OR MIT",
 ring: 0.17.14, "Apache-2.0 AND ISC",
diff --git a/core/connectors/runtime/Cargo.toml 
b/core/connectors/runtime/Cargo.toml
index e6ed0d153..83f49d103 100644
--- a/core/connectors/runtime/Cargo.toml
+++ b/core/connectors/runtime/Cargo.toml
@@ -49,6 +49,7 @@ postcard = { workspace = true }
 reqwest = { workspace = true }
 reqwest-middleware = { workspace = true }
 reqwest-retry = { workspace = true }
+reqwest-tracing = { workspace = true }
 serde = { workspace = true }
 serde_json = { workspace = true }
 serde_with = { workspace = true }
diff --git a/core/connectors/runtime/src/configs/connectors/http_provider.rs 
b/core/connectors/runtime/src/configs/connectors/http_provider.rs
index 1df41225e..3ebffeeea 100644
--- a/core/connectors/runtime/src/configs/connectors/http_provider.rs
+++ b/core/connectors/runtime/src/configs/connectors/http_provider.rs
@@ -32,6 +32,7 @@ use async_trait::async_trait;
 use reqwest;
 use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
 use reqwest_retry::{Jitter, RetryTransientMiddleware, 
policies::ExponentialBackoff};
+use reqwest_tracing::{SpanBackendWithUrl, TracingMiddleware};
 use serde::{Deserialize, Serialize};
 use std::collections::HashMap;
 use std::str::FromStr;
@@ -78,7 +79,8 @@ impl HttpConnectorsConfigProvider {
                 RuntimeError::InvalidConfiguration(format!("Failed to build 
HTTP client: {err}"))
             })?;
 
-        let mut client_with_middleware = ClientBuilder::new(client);
+        let mut client_with_middleware =
+            
ClientBuilder::new(client).with(TracingMiddleware::<SpanBackendWithUrl>::new());
 
         if retry_config.enabled {
             tracing::trace!("Apply retry config: {:?}", retry_config);
diff --git a/core/sdk/Cargo.toml b/core/sdk/Cargo.toml
index 86a6285b6..81e8ef617 100644
--- a/core/sdk/Cargo.toml
+++ b/core/sdk/Cargo.toml
@@ -53,6 +53,7 @@ quinn = { workspace = true }
 reqwest = { workspace = true }
 reqwest-middleware = { workspace = true }
 reqwest-retry = { workspace = true }
+reqwest-tracing = { workspace = true }
 rustls = { workspace = true }
 serde = { workspace = true }
 tokio = { workspace = true }
diff --git a/core/sdk/src/http/http_client.rs b/core/sdk/src/http/http_client.rs
index 9703f55f2..05e63fab1 100644
--- a/core/sdk/src/http/http_client.rs
+++ b/core/sdk/src/http/http_client.rs
@@ -28,6 +28,7 @@ use iggy_common::{
 use reqwest::{Response, StatusCode, Url};
 use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
 use reqwest_retry::{RetryTransientMiddleware, policies::ExponentialBackoff};
+use reqwest_tracing::{SpanBackendWithUrl, TracingMiddleware};
 use serde::Serialize;
 use std::ops::Deref;
 use std::str::FromStr;
@@ -273,6 +274,7 @@ impl HttpClient {
         let api_url = api_url.unwrap();
         let retry_policy = 
ExponentialBackoff::builder().build_with_max_retries(config.retries);
         let client = ClientBuilder::new(reqwest::Client::new())
+            .with(TracingMiddleware::<SpanBackendWithUrl>::new())
             .with(RetryTransientMiddleware::new_with_policy(retry_policy))
             .build();
 

Reply via email to