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

refactor(router): added payment_method to golden log line (#3620)

Sahkal Poddarc5343dfcc20f
diff --git a/crates/router/src/middleware.rs b/crates/router/src/middleware.rs
index 6f3427bf7a..f1a3275ab2 100644
--- a/crates/router/src/middleware.rs
+++ b/crates/router/src/middleware.rs
@@ -152,6 +152,7 @@ where
payment_id = Empty,
merchant_id = Empty,
connector_name = Empty,
+ payment_method = Empty,
flow = "UNKNOWN"
)
.or_current(),
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index fbaaec6224..3730c5bf9a 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -265,7 +265,7 @@ pub enum CaptureSyncMethod {
/// Handle the flow by interacting with connector module
/// `connector_request` is applicable only in case if the `CallConnectorAction` is `Trigger`
/// In other cases, It will be created if required, even if it is not passed
-#[instrument(skip_all)]
+#[instrument(skip_all, fields(payment_method))]
pub async fn execute_connector_processing_step<
'b,
'a,
@@ -285,6 +285,7 @@ where
{
// If needed add an error stack as follows
// connector_integration.build_request(req).attach_printable("Failed to build request");
+ tracing::Span::current().record("payment_method", &req.payment_method.to_string());
logger::debug!(connector_request=?connector_request);
let mut router_data = req.clone();
match call_connector_action {
diff --git a/crates/router_env/src/logger/storage.rs b/crates/router_env/src/logger/storage.rs
index 036a73cf87..0d3eb1932c 100644
--- a/crates/router_env/src/logger/storage.rs
+++ b/crates/router_env/src/logger/storage.rs
@@ -92,7 +92,13 @@ impl Visit for Storage<'_> {
}
}
-const PERSISTENT_KEYS: [&str; 4] = ["payment_id", "connector_name", "merchant_id", "flow"];
+const PERSISTENT_KEYS: [&str; 5] = [
+ "payment_id",
+ "connector_name",
+ "merchant_id",
+ "flow",
+ "payment_method",
+];
impl<S: Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>> Layer<S>
for StorageSubscription