mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
fix: log detailed error reports during deep health check failures (#5984)
This commit is contained in:
@ -503,7 +503,7 @@ database_name = "default"
|
|||||||
[analytics.sqlx]
|
[analytics.sqlx]
|
||||||
username = "db_user"
|
username = "db_user"
|
||||||
password = "db_pass"
|
password = "db_pass"
|
||||||
host = "localhost"
|
host = "pg"
|
||||||
port = 5432
|
port = 5432
|
||||||
dbname = "hyperswitch_db"
|
dbname = "hyperswitch_db"
|
||||||
pool_size = 5
|
pool_size = 5
|
||||||
|
|||||||
@ -72,11 +72,14 @@ pub async fn deep_health_check_func(
|
|||||||
|
|
||||||
logger::debug!("Database health check begin");
|
logger::debug!("Database health check begin");
|
||||||
|
|
||||||
let db_status = store.health_check_db().await.map(|_| true).map_err(|err| {
|
let db_status = store
|
||||||
error_stack::report!(HealthCheckError::DbError {
|
.health_check_db()
|
||||||
message: err.to_string()
|
.await
|
||||||
})
|
.map(|_| true)
|
||||||
})?;
|
.map_err(|error| {
|
||||||
|
let message = error.to_string();
|
||||||
|
error.change_context(HealthCheckError::DbError { message })
|
||||||
|
})?;
|
||||||
|
|
||||||
logger::debug!("Database health check end");
|
logger::debug!("Database health check end");
|
||||||
|
|
||||||
@ -86,10 +89,9 @@ pub async fn deep_health_check_func(
|
|||||||
.health_check_redis(&conf.into_inner())
|
.health_check_redis(&conf.into_inner())
|
||||||
.await
|
.await
|
||||||
.map(|_| true)
|
.map(|_| true)
|
||||||
.map_err(|err| {
|
.map_err(|error| {
|
||||||
error_stack::report!(HealthCheckError::RedisError {
|
let message = error.to_string();
|
||||||
message: err.to_string()
|
error.change_context(HealthCheckError::RedisError { message })
|
||||||
})
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
logger::debug!("Redis health check end");
|
logger::debug!("Redis health check end");
|
||||||
|
|||||||
@ -204,12 +204,17 @@ pub async fn deep_health_check_func(
|
|||||||
|
|
||||||
logger::debug!("Database health check begin");
|
logger::debug!("Database health check begin");
|
||||||
|
|
||||||
let db_status = state.health_check_db().await.map(|_| true).map_err(|err| {
|
let db_status = state
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
.health_check_db()
|
||||||
component: "Database",
|
.await
|
||||||
message: err.to_string()
|
.map(|_| true)
|
||||||
})
|
.map_err(|error| {
|
||||||
})?;
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
|
component: "Database",
|
||||||
|
message,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
logger::debug!("Database health check end");
|
logger::debug!("Database health check end");
|
||||||
|
|
||||||
@ -219,23 +224,26 @@ pub async fn deep_health_check_func(
|
|||||||
.health_check_redis()
|
.health_check_redis()
|
||||||
.await
|
.await
|
||||||
.map(|_| true)
|
.map(|_| true)
|
||||||
.map_err(|err| {
|
.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Redis",
|
component: "Redis",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let outgoing_req_check = state
|
let outgoing_req_check =
|
||||||
.health_check_outgoing()
|
state
|
||||||
.await
|
.health_check_outgoing()
|
||||||
.map(|_| true)
|
.await
|
||||||
.map_err(|err| {
|
.map(|_| true)
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
.map_err(|error| {
|
||||||
component: "Outgoing Request",
|
let message = error.to_string();
|
||||||
message: err.to_string()
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
})
|
component: "Outgoing Request",
|
||||||
})?;
|
message,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
logger::debug!("Redis health check end");
|
logger::debug!("Redis health check end");
|
||||||
|
|
||||||
|
|||||||
@ -48,10 +48,11 @@ async fn deep_health_check_func(
|
|||||||
|
|
||||||
logger::debug!("Database health check begin");
|
logger::debug!("Database health check begin");
|
||||||
|
|
||||||
let db_status = state.health_check_db().await.map_err(|err| {
|
let db_status = state.health_check_db().await.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Database",
|
component: "Database",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -59,10 +60,11 @@ async fn deep_health_check_func(
|
|||||||
|
|
||||||
logger::debug!("Redis health check begin");
|
logger::debug!("Redis health check begin");
|
||||||
|
|
||||||
let redis_status = state.health_check_redis().await.map_err(|err| {
|
let redis_status = state.health_check_redis().await.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Redis",
|
component: "Redis",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -70,10 +72,11 @@ async fn deep_health_check_func(
|
|||||||
|
|
||||||
logger::debug!("Locker health check begin");
|
logger::debug!("Locker health check begin");
|
||||||
|
|
||||||
let locker_status = state.health_check_locker().await.map_err(|err| {
|
let locker_status = state.health_check_locker().await.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Locker",
|
component: "Locker",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -82,10 +85,11 @@ async fn deep_health_check_func(
|
|||||||
logger::debug!("Analytics health check begin");
|
logger::debug!("Analytics health check begin");
|
||||||
|
|
||||||
#[cfg(feature = "olap")]
|
#[cfg(feature = "olap")]
|
||||||
let analytics_status = state.health_check_analytics().await.map_err(|err| {
|
let analytics_status = state.health_check_analytics().await.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Analytics",
|
component: "Analytics",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -94,10 +98,11 @@ async fn deep_health_check_func(
|
|||||||
logger::debug!("Opensearch health check begin");
|
logger::debug!("Opensearch health check begin");
|
||||||
|
|
||||||
#[cfg(feature = "olap")]
|
#[cfg(feature = "olap")]
|
||||||
let opensearch_status = state.health_check_opensearch().await.map_err(|err| {
|
let opensearch_status = state.health_check_opensearch().await.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Opensearch",
|
component: "Opensearch",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -105,10 +110,11 @@ async fn deep_health_check_func(
|
|||||||
|
|
||||||
logger::debug!("Outgoing Request health check begin");
|
logger::debug!("Outgoing Request health check begin");
|
||||||
|
|
||||||
let outgoing_check = state.health_check_outgoing().await.map_err(|err| {
|
let outgoing_check = state.health_check_outgoing().await.map_err(|error| {
|
||||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
let message = error.to_string();
|
||||||
|
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||||
component: "Outgoing Request",
|
component: "Outgoing Request",
|
||||||
message: err.to_string()
|
message,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user