Litellm dev 02 07 2025 p2 (#8377)

* fix(caching_routes.py): mask redis password on `/cache/ping` route

* fix(caching_routes.py): fix linting erro

* fix(caching_routes.py): fix linting error on caching routes

* fix: fix test - ignore mask_dict - has a breakpoint

* fix(azure.py): add timeout param + elapsed time in azure timeout error

* fix(http_handler.py): add elapsed time to http timeout request

makes it easier to debug how long request took before failing
This commit is contained in:
Krish Dholakia 2025-02-07 17:30:38 -08:00 committed by GitHub
parent ff2529a994
commit 7363b072c1
7 changed files with 126 additions and 25 deletions

View file

@ -1,5 +1,6 @@
import asyncio
import os
import time
from typing import TYPE_CHECKING, Any, Callable, List, Mapping, Optional, Union
import httpx
@ -179,6 +180,7 @@ class AsyncHTTPHandler:
stream: bool = False,
logging_obj: Optional[LiteLLMLoggingObject] = None,
):
start_time = time.time()
try:
if timeout is None:
timeout = self.timeout
@ -207,6 +209,8 @@ class AsyncHTTPHandler:
finally:
await new_client.aclose()
except httpx.TimeoutException as e:
end_time = time.time()
time_delta = round(end_time - start_time, 3)
headers = {}
error_response = getattr(e, "response", None)
if error_response is not None:
@ -214,7 +218,7 @@ class AsyncHTTPHandler:
headers["response_headers-{}".format(key)] = value
raise litellm.Timeout(
message=f"Connection timed out after {timeout} seconds.",
message=f"Connection timed out. Timeout passed={timeout}, time taken={time_delta} seconds",
model="default-model-name",
llm_provider="litellm-httpx-handler",
headers=headers,