mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat: add deep health check for analytics (#3438)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -17,6 +17,7 @@ use storage_impl::config::Database;
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
use super::{
|
||||
health_check::HealthCheck,
|
||||
query::{Aggregate, ToSql, Window},
|
||||
types::{
|
||||
AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, QueryExecutionError,
|
||||
@ -164,6 +165,17 @@ impl AnalyticsDataSource for SqlxClient {
|
||||
.change_context(QueryExecutionError::RowExtractionFailure)
|
||||
}
|
||||
}
|
||||
#[async_trait::async_trait]
|
||||
impl HealthCheck for SqlxClient {
|
||||
async fn deep_health_check(&self) -> CustomResult<(), QueryExecutionError> {
|
||||
sqlx::query("SELECT 1")
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map(|_| ())
|
||||
.into_report()
|
||||
.change_context(QueryExecutionError::DatabaseError)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromRow<'a, PgRow> for super::refunds::metrics::RefundMetricRow {
|
||||
fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
|
||||
|
||||
Reference in New Issue
Block a user