Skip to content

Commit b043a75

Browse files
ingestor analytics response check
1 parent a717313 commit b043a75

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/analytics.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,14 @@ async fn fetch_ingestors_metrics(
287287
.send()
288288
.await
289289
.expect("should respond");
290-
291-
let data = serde_json::from_slice::<NodeMetrics>(&resp.bytes().await?)?;
292-
vec.push(data);
293-
active_ingestors += 1;
290+
// check if the response is valid
291+
if let Ok(data) = serde_json::from_slice::<NodeMetrics>(&resp.bytes().await?) {
292+
active_ingestors += 1;
293+
vec.push(data);
294+
} else {
295+
offline_ingestors += 1;
296+
continue;
297+
}
294298
}
295299

296300
node_metrics.accumulate(&mut vec);

0 commit comments

Comments
 (0)