From 7582266267ebcd62e240cbb9423426e2159e65b3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 5 Nov 2024 13:19:06 -0800 Subject: [PATCH] fix allow_requests_on_db_unavailable --- litellm/proxy/auth/auth_checks.py | 14 ++++---------- litellm/types/services.py | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index 50e22654a42..d2b04122b43 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -735,7 +735,7 @@ async def _handle_failed_db_connection_for_get_key_object( Use this if you don't want failed DB queries to block LLM API reqiests Returns: - - UserAPIKeyAuth: If general_settings.allow_failed_db_requests is True + - UserAPIKeyAuth: If general_settings.allow_requests_on_db_unavailable is True Raises: - Orignal Exception in all other cases @@ -743,21 +743,15 @@ async def _handle_failed_db_connection_for_get_key_object( from litellm.proxy.proxy_server import general_settings, proxy_logging_obj # If this flag is on, requests failing to connect to the DB will be allowed - if general_settings.get("allow_failed_db_requests", False) is True: + if general_settings.get("allow_requests_on_db_unavailable", False) is True: # log to prometheus - await proxy_logging_obj.service_logging_obj.async_service_failure_hook( - error=e, - service=ServiceTypes.ALLOW_FAILED_DB_REQUESTS, + proxy_logging_obj.service_logging_obj.service_success_hook( + service=ServiceTypes.ALLOW_REQUESTS_ON_DB_UNAVAILABLE, call_type="get_key_object", parent_otel_span=None, duration=0.0, start_time=None, end_time=None, - event_metadata={ - "function_name": "get_key_object", - "function_kwargs": {}, - "function_args": [], - }, ) return UserAPIKeyAuth( diff --git a/litellm/types/services.py b/litellm/types/services.py index 161832404c1..6ffdfc8916f 100644 --- a/litellm/types/services.py +++ b/litellm/types/services.py @@ -12,7 +12,7 @@ class ServiceTypes(str, enum.Enum): REDIS = "redis" DB = "postgres" - ALLOW_FAILED_DB_REQUESTS = "allow_failed_db_requests" + ALLOW_REQUESTS_ON_DB_UNAVAILABLE = "allow_requests_on_db_unavailable" BATCH_WRITE_TO_DB = "batch_write_to_db" LITELLM = "self" ROUTER = "router"