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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor: add payment id and merchant id to logs (#1548)
Narayan Bhat9a48c9ef723f
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex c8d69d7d51..353d508c28 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -581,7 +581,7 @@ pub enum AuthFlow {Merchant,}-#[instrument(skip(request, payload, state, func, api_auth))]+#[instrument(skip(request, payload, state, func, api_auth), fields(merchant_id))]pub async fn server_wrap_util<'a, 'b, A, U, T, Q, F, Fut, E, OErr>(flow: &'a impl router_env::types::FlowMetric,state: &'b A,@@ -606,7 +606,8 @@ where.authenticate_and_fetch(request.headers(), state).await.switch()?;- let metric_merchant_id = auth_out.get_merchant_id().unwrap_or("").to_string();+ let merchant_id = auth_out.get_merchant_id().unwrap_or("").to_string();+ tracing::Span::current().record("merchant_id", &merchant_id);let output = func(state, auth_out, payload).await.switch();@@ -615,11 +616,7 @@ whereErr(err) => err.current_context().status_code().as_u16().into(),};- metrics::request::status_code_metrics(- status_code,- flow.to_string(),- metric_merchant_id.to_string(),- );+ metrics::request::status_code_metrics(status_code, flow.to_string(), merchant_id.to_string());output}diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rsindex 20e01e52d5..47ffcbb9e2 100644--- a/crates/router/src/types/api/payments.rs+++ b/crates/router/src/types/api/payments.rs@@ -93,7 +93,7 @@ pub struct Verify;#[derive(Debug, Clone)]pub struct PreProcessing;-pub(crate) trait PaymentIdTypeExt {+pub trait PaymentIdTypeExt {fn get_payment_intent_id(&self) -> errors::CustomResult<String, errors::ValidationError>;}