Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix: add health metric to drainer (#2217)

Kartikeya Hegde4e8471be5018
diff --git a/crates/drainer/src/lib.rs b/crates/drainer/src/lib.rs
index ad77ebec4e..35ce4d2f87 100644
--- a/crates/drainer/src/lib.rs
+++ b/crates/drainer/src/lib.rs
@@ -42,6 +42,7 @@ pub async fn start_drainer(
let active_tasks = Arc::new(atomic::AtomicU64::new(0));
'event: loop {
+ metrics::DRAINER_HEALTH.add(&metrics::CONTEXT, 1, &[]);
match rx.try_recv() {
Err(mpsc::error::TryRecvError::Empty) => {
if utils::is_stream_available(stream_index, store.clone()).await {
diff --git a/crates/drainer/src/metrics.rs b/crates/drainer/src/metrics.rs
index 9ab98fb6fe..0839e8633c 100644
--- a/crates/drainer/src/metrics.rs
+++ b/crates/drainer/src/metrics.rs
@@ -11,6 +11,7 @@ counter_metric!(ERRORS_WHILE_QUERY_EXECUTION, DRAINER_METER);
counter_metric!(SUCCESSFUL_QUERY_EXECUTION, DRAINER_METER);
counter_metric!(SHUTDOWN_SIGNAL_RECEIVED, DRAINER_METER);
counter_metric!(SUCCESSFUL_SHUTDOWN, DRAINER_METER);
+counter_metric!(DRAINER_HEALTH, DRAINER_METER);
histogram_metric!(QUERY_EXECUTION_TIME, DRAINER_METER); // Time in (ms) milliseconds
histogram_metric!(REDIS_STREAM_READ_TIME, DRAINER_METER); // Time in (ms) milliseconds