@@ -1073,25 +1073,25 @@ pub fn init_cluster_metrics_schedular() -> Result<(), PostError> {
10731073 . run ( move || async {
10741074 let result: Result < ( ) , PostError > = async {
10751075 let cluster_metrics = fetch_cluster_metrics ( ) . await ;
1076- if let Ok ( metrics) = cluster_metrics {
1077- if !metrics. is_empty ( ) {
1078- info ! ( "Cluster metrics fetched successfully from all ingestors" ) ;
1079- if let Ok ( metrics_bytes) = serde_json:: to_vec ( & metrics) {
1080- if matches ! (
1081- ingest_internal_stream(
1082- INTERNAL_STREAM_NAME . to_string( ) ,
1083- bytes:: Bytes :: from( metrics_bytes) ,
1084- )
1085- . await ,
1086- Ok ( ( ) )
1087- ) {
1088- info ! ( "Cluster metrics successfully ingested into internal stream" ) ;
1089- } else {
1090- error ! ( "Failed to ingest cluster metrics into internal stream" ) ;
1091- }
1076+ if let Ok ( metrics) = cluster_metrics
1077+ && !metrics. is_empty ( )
1078+ {
1079+ info ! ( "Cluster metrics fetched successfully from all ingestors" ) ;
1080+ if let Ok ( metrics_bytes) = serde_json:: to_vec ( & metrics) {
1081+ if matches ! (
1082+ ingest_internal_stream(
1083+ INTERNAL_STREAM_NAME . to_string( ) ,
1084+ bytes:: Bytes :: from( metrics_bytes) ,
1085+ )
1086+ . await ,
1087+ Ok ( ( ) )
1088+ ) {
1089+ info ! ( "Cluster metrics successfully ingested into internal stream" ) ;
10921090 } else {
1093- error ! ( "Failed to serialize cluster metrics" ) ;
1091+ error ! ( "Failed to ingest cluster metrics into internal stream " ) ;
10941092 }
1093+ } else {
1094+ error ! ( "Failed to serialize cluster metrics" ) ;
10951095 }
10961096 }
10971097 Ok ( ( ) )
@@ -1186,21 +1186,21 @@ async fn get_available_querier() -> Result<QuerierMetadata, QueryError> {
11861186 } ) ;
11871187
11881188 // Find the next available querier using round-robin strategy
1189- if let Some ( selected_domain) = select_next_querier ( & mut map) . await {
1190- if let Some ( status) = map. get_mut ( & selected_domain) {
1191- status . available = false ;
1192- status. last_used = Some ( Instant :: now ( ) ) ;
1193- return Ok ( status . metadata . clone ( ) ) ;
1194- }
1189+ if let Some ( selected_domain) = select_next_querier ( & mut map) . await
1190+ && let Some ( status) = map. get_mut ( & selected_domain)
1191+ {
1192+ status. available = false ;
1193+ status . last_used = Some ( Instant :: now ( ) ) ;
1194+ return Ok ( status . metadata . clone ( ) ) ;
11951195 }
11961196
11971197 // If no querier is available, use least-recently-used strategy
1198- if let Some ( selected_domain) = select_least_recently_used_querier ( & mut map) {
1199- if let Some ( status) = map. get_mut ( & selected_domain) {
1200- status . available = false ;
1201- status. last_used = Some ( Instant :: now ( ) ) ;
1202- return Ok ( status . metadata . clone ( ) ) ;
1203- }
1198+ if let Some ( selected_domain) = select_least_recently_used_querier ( & mut map)
1199+ && let Some ( status) = map. get_mut ( & selected_domain)
1200+ {
1201+ status. available = false ;
1202+ status . last_used = Some ( Instant :: now ( ) ) ;
1203+ return Ok ( status . metadata . clone ( ) ) ;
12041204 }
12051205
12061206 // If no querier is available, return an error
0 commit comments