mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 01:57:45 +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] | ||||
| username = "db_user" | ||||
| password = "db_pass" | ||||
| host = "localhost" | ||||
| host = "pg" | ||||
| port = 5432 | ||||
| dbname = "hyperswitch_db" | ||||
| pool_size = 5 | ||||
|  | ||||
| @ -72,10 +72,13 @@ pub async fn deep_health_check_func( | ||||
|  | ||||
|     logger::debug!("Database health check begin"); | ||||
|  | ||||
|     let db_status = store.health_check_db().await.map(|_| true).map_err(|err| { | ||||
|         error_stack::report!(HealthCheckError::DbError { | ||||
|             message: err.to_string() | ||||
|         }) | ||||
|     let db_status = store | ||||
|         .health_check_db() | ||||
|         .await | ||||
|         .map(|_| true) | ||||
|         .map_err(|error| { | ||||
|             let message = error.to_string(); | ||||
|             error.change_context(HealthCheckError::DbError { message }) | ||||
|         })?; | ||||
|  | ||||
|     logger::debug!("Database health check end"); | ||||
| @ -86,10 +89,9 @@ pub async fn deep_health_check_func( | ||||
|         .health_check_redis(&conf.into_inner()) | ||||
|         .await | ||||
|         .map(|_| true) | ||||
|         .map_err(|err| { | ||||
|             error_stack::report!(HealthCheckError::RedisError { | ||||
|                 message: err.to_string() | ||||
|             }) | ||||
|         .map_err(|error| { | ||||
|             let message = error.to_string(); | ||||
|             error.change_context(HealthCheckError::RedisError { message }) | ||||
|         })?; | ||||
|  | ||||
|     logger::debug!("Redis health check end"); | ||||
|  | ||||
| @ -204,10 +204,15 @@ 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 { | ||||
|     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: err.to_string() | ||||
|                 message, | ||||
|             }) | ||||
|         })?; | ||||
|  | ||||
| @ -219,21 +224,24 @@ 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 | ||||
|     let outgoing_req_check = | ||||
|         state | ||||
|             .health_check_outgoing() | ||||
|             .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: "Outgoing Request", | ||||
|                 message: err.to_string() | ||||
|                     message, | ||||
|                 }) | ||||
|             })?; | ||||
|  | ||||
|  | ||||
| @ -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
	 Sanchith Hegde
					Sanchith Hegde