@@ -264,7 +264,6 @@ def __init__(
264264 self .project_id = project_id
265265 self .base_url = base_url .rstrip ("/" )
266266 self .timeout = timeout
267- # Reuse a single session for connection pooling and to avoid leaking FDs.
268267 self ._session = requests .Session ()
269268
270269 def search_logs (self , tags : List [str ], limit : int = 100 , hours_back : int = 24 ) -> List [Dict [str , Any ]]:
@@ -415,21 +414,19 @@ def get_evaluation_rows(
415414 result = None
416415 try :
417416 with self ._session .get (url , params = params , timeout = self .timeout , headers = headers ) as response :
418- response .raise_for_status ()
417+ if response .status_code >= 400 :
418+ error_msg : str = response .text
419+ try :
420+ payload = response .json ()
421+ if isinstance (payload , dict ) and "detail" in payload :
422+ detail = payload .get ("detail" )
423+ if detail :
424+ error_msg = str (detail )
425+ except Exception :
426+ pass
427+ logger .error ("Failed to fetch traces from proxy (HTTP %s): %s" , response .status_code , error_msg )
428+ return eval_rows
419429 result = response .json ()
420- except requests .exceptions .HTTPError as e :
421- error_msg = str (e )
422-
423- # Try to extract detail message from response
424- if e .response is not None :
425- try :
426- error_detail = e .response .json ().get ("detail" , {})
427- error_msg = error_detail or e .response .text
428- except Exception : # In case e.response.json() fails
429- error_msg = f"Proxy error: { e .response .text } "
430-
431- logger .error ("Failed to fetch traces from proxy (HTTP %s): %s" , e .response .status_code , error_msg )
432- return eval_rows
433430 except requests .exceptions .RequestException as e :
434431 # Non-HTTP errors (network issues, timeouts, etc.)
435432 logger .error ("Failed to fetch traces from proxy: %s" , str (e ))
0 commit comments