feat: add deep health check for drainer (#3396)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: dracarys18 <karthikey.hegde@juspay.in>
This commit is contained in:
Chethan Rao
2024-02-02 16:29:35 +05:30
committed by GitHub
parent 91519d8462
commit 63c383f5a2
9 changed files with 396 additions and 3 deletions

View File

@ -1,4 +1,7 @@
use drainer::{errors::DrainerResult, logger::logger, services, settings, start_drainer};
use drainer::{
errors::DrainerResult, logger::logger, services, settings, start_drainer, start_web_server,
};
use router_env::tracing::Instrument;
#[tokio::main]
async fn main() -> DrainerResult<()> {
@ -24,6 +27,19 @@ async fn main() -> DrainerResult<()> {
[router_env::service_name!()],
);
#[allow(clippy::expect_used)]
let web_server = Box::pin(start_web_server(conf.clone(), store.clone()))
.await
.expect("Failed to create the server");
tokio::spawn(
async move {
let _ = web_server.await;
logger::error!("The health check probe stopped working!");
}
.in_current_span(),
);
logger::debug!(startup_config=?conf);
logger::info!("Drainer started [{:?}] [{:?}]", conf.drainer, conf.log);