[model-gateway] Improve Health Check Logging (#16930)
This commit is contained in:
@@ -838,21 +838,30 @@ impl Worker for BasicWorker {
|
|||||||
let url = self.normalised_url()?;
|
let url = self.normalised_url()?;
|
||||||
let health_url = format!("{}{}", url, self.metadata.health_config.endpoint);
|
let health_url = format!("{}{}", url, self.metadata.health_config.endpoint);
|
||||||
|
|
||||||
let mut req = WORKER_CLIENT.get(health_url).timeout(timeout);
|
let mut req = WORKER_CLIENT.get(&health_url).timeout(timeout);
|
||||||
if let Some(api_key) = &self.metadata.api_key {
|
if let Some(api_key) = &self.metadata.api_key {
|
||||||
req = req.bearer_auth(api_key);
|
req = req.bearer_auth(api_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
match req.send().await {
|
match req.send().await {
|
||||||
Ok(resp) => Ok(resp.status().is_success()),
|
Ok(resp) => {
|
||||||
Err(err) => {
|
let status = resp.status();
|
||||||
|
if status.is_success() {
|
||||||
|
Ok(true)
|
||||||
|
} else {
|
||||||
tracing::warn!(
|
tracing::warn!(
|
||||||
"HTTP health check failed for {}: {err:?}",
|
"HTTP health check returned non-success status for {}: {}",
|
||||||
self.metadata.url
|
health_url,
|
||||||
|
status
|
||||||
);
|
);
|
||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(err) => {
|
||||||
|
tracing::warn!("HTTP health check failed for {}: {err:?}", health_url);
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user