clip_client: log encode_text failures (URL + status/body or network error)

The CLIP encode failure reason was only ever returned in the HTTP response
body, never logged server-side, making 502s from /photos/search opaque. Log
the underlying cause — network error to the URL, or the Apollo HTTP status +
response body — so CLIP-service problems are diagnosable from the ImageApi log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-06-14 02:02:57 -04:00
parent 0a40e78528
commit 6c315edacc
+3
View File
@@ -191,11 +191,13 @@ impl ClipClient {
let resp = match self.client.post(&url).json(&body).send().await { let resp = match self.client.post(&url).json(&body).send().await {
Ok(r) => r, Ok(r) => r,
Err(e) if e.is_timeout() || e.is_connect() => { Err(e) if e.is_timeout() || e.is_connect() => {
log::warn!("clip encode_text network error to {url}: {e}");
return Err(ClipError::Transient(anyhow::anyhow!( return Err(ClipError::Transient(anyhow::anyhow!(
"clip client network: {e}" "clip client network: {e}"
))); )));
} }
Err(e) => { Err(e) => {
log::warn!("clip encode_text request error to {url}: {e}");
return Err(ClipError::Transient(anyhow::anyhow!( return Err(ClipError::Transient(anyhow::anyhow!(
"clip client request: {e}" "clip client request: {e}"
))); )));
@@ -210,6 +212,7 @@ impl ClipClient {
return Ok(body); return Ok(body);
} }
let body_text = resp.text().await.unwrap_or_default(); let body_text = resp.text().await.unwrap_or_default();
log::warn!("clip encode_text HTTP {status} from {url}: {body_text}");
Err(classify_error_response(status.as_u16(), &body_text)) Err(classify_error_response(status.as_u16(), &body_text))
} }