use async_log_proxy_authentication_errors

This commit is contained in:
Ishaan Jaff 2024-11-26 19:39:36 -08:00
parent 8d57ccb74e
commit 75dacd8859
2 changed files with 8 additions and 6 deletions

View file

@ -1197,13 +1197,15 @@ async def user_api_key_auth( # noqa: PLR0915
extra={"requester_ip": requester_ip},
)
# Log this exception to OTEL
if open_telemetry_logger is not None:
await open_telemetry_logger.async_post_call_failure_hook( # type: ignore
# Log this exception to OTEL, Datadog etc
asyncio.create_task(
proxy_logging_obj.async_log_proxy_authentication_errors(
original_exception=e,
request_data={},
user_api_key_dict=UserAPIKeyAuth(parent_otel_span=parent_otel_span),
request=request,
parent_otel_span=parent_otel_span,
api_key=api_key,
)
)
if isinstance(e, litellm.BudgetExceededError):
raise ProxyException(

View file

@ -899,7 +899,7 @@ class ProxyLogging:
- `post_call_failure_hook` calls `litellm_logging_obj.async_failure_handler`. This led to the Exception being logged twice
What does this handler do?
- Logs Authentication Errors (like invalid API Key passed) to CustomLogger compatible classes
- Logs Authentication Errors (like invalid API Key passed) to CustomLogger compatible classes (OTEL, Datadog etc)
- calls CustomLogger.async_post_call_failure_hook
"""