From 183d257b8ec98aba5bac071c65b7f94be6090a96 Mon Sep 17 00:00:00 2001 From: sh3ll3x3c Date: Mon, 25 Sep 2023 18:11:20 +0200 Subject: [PATCH] health check gauge added --- src/light_client.rs | 2 ++ src/telemetry/mod.rs | 1 + src/telemetry/otlp.rs | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/light_client.rs b/src/light_client.rs index b8e4f7f10..6465b7565 100644 --- a/src/light_client.rs +++ b/src/light_client.rs @@ -370,6 +370,8 @@ pub async fn process_block( .await .context("Unable to dump network stats")?; + metrics.record(MetricValue::HealthCheck())?; + Ok(()) } diff --git a/src/telemetry/mod.rs b/src/telemetry/mod.rs index 1c0beb30c..d5b9b6755 100644 --- a/src/telemetry/mod.rs +++ b/src/telemetry/mod.rs @@ -25,6 +25,7 @@ pub enum MetricValue { DHTPutRowsDuration(f64), DHTPutRowsSuccess(f64), KadRoutingTablePeerNum(u32), + HealthCheck(), } #[automock] diff --git a/src/telemetry/otlp.rs b/src/telemetry/otlp.rs index 0fcd6fef2..9266de1cd 100644 --- a/src/telemetry/otlp.rs +++ b/src/telemetry/otlp.rs @@ -94,6 +94,9 @@ impl super::Metrics for Metrics { super::MetricValue::KadRoutingTablePeerNum(number) => { self.record_u64("kad_routing_table_peer_num", number.into())?; }, + super::MetricValue::HealthCheck() => { + self.record_u64("up", 1)?; + }, }; Ok(()) }