mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-09 08:18:12 +00:00
fix(cache): retain exception names in redacted tracebacks
Signed-off-by: LeizhenZhang <zhangleizhen645@gmail.com>
This commit is contained in:
parent
26631bca72
commit
c4fa1c5180
2 changed files with 4 additions and 1 deletions
|
|
@ -555,7 +555,9 @@ def log_redis_failure(
|
|||
if isinstance(exc, RedisCircuitBreakerOpenError):
|
||||
logger.debug("%s: %s", message, reason, stacklevel=2)
|
||||
return
|
||||
exc_info: Final = (type(exc), Exception(reason), exc.__traceback__) if with_traceback else None
|
||||
exc_info: Final = (
|
||||
(Exception, Exception(f"{type(exc).__name__}: {reason}"), exc.__traceback__) if with_traceback else None
|
||||
)
|
||||
if not is_redis_timeout_failure(exc):
|
||||
logger.log(level, "%s: %s", message, reason, exc_info=exc_info, stacklevel=2)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1784,6 +1784,7 @@ def test_log_redis_failure_redacts_traceback_and_exception_chain(
|
|||
assert SENSITIVE_CACHE_KEY not in caplog.text
|
||||
assert "private customer message" not in caplog.text
|
||||
assert "Traceback (most recent call last)" in caplog.text
|
||||
assert ("RuntimeError" if chained else "ResponseError") in caplog.text
|
||||
assert "Redis failed" in caplog.text
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue