File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use crate::config::Config;
33use crate :: grpc:: protobuf:: uniffle:: coordinator_server_client:: CoordinatorServerClient ;
44use crate :: grpc:: protobuf:: uniffle:: { ShuffleServerHeartBeatRequest , ShuffleServerId } ;
55use crate :: health_service:: HealthService ;
6+ use crate :: metric:: SERVICE_IS_HEALTHY ;
67use crate :: runtime:: manager:: RuntimeManager ;
78use log:: info;
89use std:: time:: Duration ;
@@ -58,6 +59,8 @@ impl HeartbeatTask {
5859 all_tags. extend_from_slice ( & * tags) ;
5960
6061 let healthy = health_service. is_healthy ( ) . await . unwrap_or ( false ) ;
62+ SERVICE_IS_HEALTHY . set ( if healthy { 0 } else { 1 } ) ;
63+
6164 let memory_snapshot = app_manager
6265 . store_memory_snapshot ( )
6366 . await
Original file line number Diff line number Diff line change @@ -398,6 +398,9 @@ pub static GAUGE_LOCAL_DISK_IS_HEALTHY: Lazy<IntGaugeVec> = Lazy::new(|| {
398398 . unwrap ( )
399399} ) ;
400400
401+ pub static SERVICE_IS_HEALTHY : Lazy < IntGauge > =
402+ Lazy :: new ( || IntGauge :: new ( "service_is_healthy" , "service_is_healthy" ) . expect ( "" ) ) ;
403+
401404pub static GAUGE_RUNTIME_ALIVE_THREAD_NUM : Lazy < IntGaugeVec > = Lazy :: new ( || {
402405 register_int_gauge_vec ! (
403406 "runtime_thread_alive_gauge" ,
@@ -520,6 +523,9 @@ pub static EVENT_BUS_HANDLE_DURATION: Lazy<HistogramVec> = Lazy::new(|| {
520523} ) ;
521524
522525fn register_custom_metrics ( ) {
526+ REGISTRY
527+ . register ( Box :: new ( SERVICE_IS_HEALTHY . clone ( ) ) )
528+ . expect ( "" ) ;
523529 REGISTRY
524530 . register ( Box :: new ( GAUGE_MEMORY_SPILL_IN_QUEUE_BYTES . clone ( ) ) )
525531 . expect ( "" ) ;
You can’t perform that action at this time.
0 commit comments