Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(logging): add an end log line for `LogSpanInitializer` (#3528)

Sampras Lopes13be7e6f8771
diff --git a/crates/router/src/middleware.rs b/crates/router/src/middleware.rs
index 702c3c70e6..9205f53a04 100644
--- a/crates/router/src/middleware.rs
+++ b/crates/router/src/middleware.rs
@@ -141,9 +141,14 @@ where
let response_fut = self.service.call(req);
Box::pin(
- response_fut.instrument(
+ async move {
+ let response = response_fut.await;
+ logger::info!(golden_log_line = true);
+ response
+ }
+ .instrument(
router_env::tracing::info_span!(
- "golden_log_line",
+ "ROOT_SPAN",
payment_id = Empty,
merchant_id = Empty,
connector_name = Empty,
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index 012030df6b..a20d2dd026 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -147,7 +147,7 @@ pub async fn get_customer_mandates(
customer_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -166,6 +166,6 @@ pub async fn get_customer_mandates(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/mandates.rs b/crates/router/src/routes/mandates.rs
index eafd61dcde..1203b766cb 100644
--- a/crates/router/src/routes/mandates.rs
+++ b/crates/router/src/routes/mandates.rs
@@ -118,7 +118,7 @@ pub async fn retrieve_mandates_list(
) -> HttpResponse {
let flow = Flow::MandatesList;
let payload = payload.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -132,6 +132,6 @@ pub async fn retrieve_mandates_list(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}