mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(passthrough): log when streaming spend-tracking flush fails to schedule
Address Greptile feedback: the bare `except Exception: pass` in the finally blocks of _sync_streaming / _async_streaming silently dropped errors from executor.submit() / asyncio.create_task() (e.g. saturated thread pool, closed event loop). Since the entire point of the fix is that spend tracking should not silently lose data, mirror the peer streaming_handler.py logging pattern so any scheduling failure is diagnosable in production. Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
This commit is contained in:
parent
8759413312
commit
3791abf4bb
1 changed files with 15 additions and 4 deletions
|
|
@ -21,6 +21,7 @@ import httpx
|
|||
from httpx._types import CookieTypes, QueryParamTypes, RequestFiles
|
||||
|
||||
import litellm
|
||||
from litellm._logging import verbose_logger
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
|
||||
from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler
|
||||
|
|
@ -405,8 +406,13 @@ def _sync_streaming(
|
|||
raw_bytes=raw_bytes,
|
||||
provider_config=provider_config,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
verbose_logger.exception(
|
||||
"Failed to schedule passthrough spend-tracking flush "
|
||||
"in _sync_streaming; %d buffered chunks dropped: %s",
|
||||
len(raw_bytes),
|
||||
e,
|
||||
)
|
||||
|
||||
|
||||
async def _async_streaming(
|
||||
|
|
@ -450,5 +456,10 @@ async def _async_streaming(
|
|||
provider_config=provider_config,
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
verbose_logger.exception(
|
||||
"Failed to schedule passthrough spend-tracking flush "
|
||||
"in _async_streaming; %d buffered chunks dropped: %s",
|
||||
len(raw_bytes),
|
||||
e,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue