feat: Added grpc based health check (#6441)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sarthak Soni
2024-11-26 18:54:55 +05:30
committed by GitHub
parent 8fbb766308
commit e922f96cee
13 changed files with 285 additions and 17 deletions

View File

@ -20,6 +20,7 @@ v1 = ["common_utils/v1"]
v2 = ["common_utils/v2", "customer_v2"]
customer_v2 = ["common_utils/customer_v2"]
payment_methods_v2 = ["common_utils/payment_methods_v2"]
dynamic_routing = []
[dependencies]
actix-web = { version = "4.5.1", optional = true }

View File

@ -1,3 +1,4 @@
use std::collections::hash_map::HashMap;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RouterHealthCheckResponse {
pub database: bool,
@ -9,10 +10,22 @@ pub struct RouterHealthCheckResponse {
#[cfg(feature = "olap")]
pub opensearch: bool,
pub outgoing_request: bool,
#[cfg(feature = "dynamic_routing")]
pub grpc_health_check: HealthCheckMap,
}
impl common_utils::events::ApiEventMetric for RouterHealthCheckResponse {}
/// gRPC based services eligible for Health check
#[derive(Debug, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum HealthCheckServices {
/// Dynamic routing service
DynamicRoutingService,
}
pub type HealthCheckMap = HashMap<HealthCheckServices, bool>;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct SchedulerHealthCheckResponse {
pub database: bool,