mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(consumer): add workflow_id field in traces for consumer tasks (#480)
This commit is contained in:
@ -198,13 +198,14 @@ pub async fn fetch_consumer_tasks(
|
||||
}
|
||||
|
||||
// Accept flow_options if required
|
||||
#[instrument(skip(state))]
|
||||
#[instrument(skip(state), fields(workflow_id))]
|
||||
pub async fn start_workflow(
|
||||
state: AppState,
|
||||
process: storage::ProcessTracker,
|
||||
_pickup_time: PrimitiveDateTime,
|
||||
runner: workflows::PTRunner,
|
||||
) {
|
||||
tracing::Span::current().record("workflow_id", Uuid::new_v4().to_string());
|
||||
workflows::perform_workflow_execution(&state, process, runner).await
|
||||
}
|
||||
|
||||
@ -233,12 +234,12 @@ pub async fn run_executor<'a>(
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub async fn some_error_handler<E: fmt::Display>(
|
||||
pub async fn consumer_error_handler<E: fmt::Display + fmt::Debug>(
|
||||
state: &AppState,
|
||||
process: storage::ProcessTracker,
|
||||
error: E,
|
||||
) -> CustomResult<(), errors::ProcessTrackerError> {
|
||||
logger::error!(pt.name = ?process.name, pt.id = %process.id, %error, "Failed while executing workflow");
|
||||
logger::error!(pt.name = ?process.name, pt.id = %process.id, ?error, "ERROR: Failed while executing workflow");
|
||||
|
||||
let db: &dyn StorageInterface = &*state.store;
|
||||
db.process_tracker_update_process_status_by_ids(
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use async_trait::async_trait;
|
||||
use router_env::{instrument, tracing};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::EnumString;
|
||||
|
||||
use crate::{core::errors, routes::AppState, scheduler::consumer, types::storage};
|
||||
|
||||
pub mod payment_sync;
|
||||
pub mod refund_router;
|
||||
|
||||
@ -22,6 +22,7 @@ macro_rules! runners {
|
||||
pub struct $body;
|
||||
} )*
|
||||
|
||||
#[instrument(skip(state))]
|
||||
pub async fn perform_workflow_execution<'a>(state: &AppState, process: storage::ProcessTracker, runner: PTRunner)
|
||||
where
|
||||
{
|
||||
|
||||
@ -85,7 +85,7 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow {
|
||||
process: storage::ProcessTracker,
|
||||
error: errors::ProcessTrackerError,
|
||||
) -> errors::CustomResult<(), errors::ProcessTrackerError> {
|
||||
consumer::some_error_handler(state, process, error).await
|
||||
consumer::consumer_error_handler(state, process, error).await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user