mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
fix: log detailed error reports during deep health check failures (#5984)
This commit is contained in:
@ -204,12 +204,17 @@ pub async fn deep_health_check_func(
|
||||
|
||||
logger::debug!("Database health check begin");
|
||||
|
||||
let db_status = state.health_check_db().await.map(|_| true).map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Database",
|
||||
message: err.to_string()
|
||||
})
|
||||
})?;
|
||||
let db_status = state
|
||||
.health_check_db()
|
||||
.await
|
||||
.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");
|
||||
|
||||
@ -219,23 +224,26 @@ pub async fn deep_health_check_func(
|
||||
.health_check_redis()
|
||||
.await
|
||||
.map(|_| true)
|
||||
.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Redis",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
let outgoing_req_check = state
|
||||
.health_check_outgoing()
|
||||
.await
|
||||
.map(|_| true)
|
||||
.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Outgoing Request",
|
||||
message: err.to_string()
|
||||
})
|
||||
})?;
|
||||
let outgoing_req_check =
|
||||
state
|
||||
.health_check_outgoing()
|
||||
.await
|
||||
.map(|_| true)
|
||||
.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Outgoing Request",
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
logger::debug!("Redis health check end");
|
||||
|
||||
|
||||
@ -48,10 +48,11 @@ async fn deep_health_check_func(
|
||||
|
||||
logger::debug!("Database health check begin");
|
||||
|
||||
let db_status = state.health_check_db().await.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
let db_status = state.health_check_db().await.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Database",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -59,10 +60,11 @@ async fn deep_health_check_func(
|
||||
|
||||
logger::debug!("Redis health check begin");
|
||||
|
||||
let redis_status = state.health_check_redis().await.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
let redis_status = state.health_check_redis().await.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Redis",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -70,10 +72,11 @@ async fn deep_health_check_func(
|
||||
|
||||
logger::debug!("Locker health check begin");
|
||||
|
||||
let locker_status = state.health_check_locker().await.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
let locker_status = state.health_check_locker().await.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Locker",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -82,10 +85,11 @@ async fn deep_health_check_func(
|
||||
logger::debug!("Analytics health check begin");
|
||||
|
||||
#[cfg(feature = "olap")]
|
||||
let analytics_status = state.health_check_analytics().await.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
let analytics_status = state.health_check_analytics().await.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Analytics",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -94,10 +98,11 @@ async fn deep_health_check_func(
|
||||
logger::debug!("Opensearch health check begin");
|
||||
|
||||
#[cfg(feature = "olap")]
|
||||
let opensearch_status = state.health_check_opensearch().await.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
let opensearch_status = state.health_check_opensearch().await.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Opensearch",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -105,10 +110,11 @@ async fn deep_health_check_func(
|
||||
|
||||
logger::debug!("Outgoing Request health check begin");
|
||||
|
||||
let outgoing_check = state.health_check_outgoing().await.map_err(|err| {
|
||||
error_stack::report!(errors::ApiErrorResponse::HealthCheckError {
|
||||
let outgoing_check = state.health_check_outgoing().await.map_err(|error| {
|
||||
let message = error.to_string();
|
||||
error.change_context(errors::ApiErrorResponse::HealthCheckError {
|
||||
component: "Outgoing Request",
|
||||
message: err.to_string()
|
||||
message,
|
||||
})
|
||||
})?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user