From 4b8fda4ac408825cc0c80e1f81212c774aa6af87 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 30 Apr 2024 13:34:14 -0700 Subject: [PATCH] log startTime and EndTime for exceptions --- litellm/proxy/_types.py | 2 ++ litellm/proxy/proxy_server.py | 2 ++ schema.prisma | 2 ++ 3 files changed, 6 insertions(+) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 2b3a72250..c910664f1 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -921,6 +921,8 @@ class LiteLLM_ErrorLogs(LiteLLMBase): exception_type: Optional[str] = "" status_code: Optional[str] = "" exception_string: Optional[str] = "" + startTime: Union[str, datetime, None] + endTime: Union[str, datetime, None] class LiteLLM_SpendLogs_ResponseObject(LiteLLMBase): diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 530438b94..3a7821d27 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1263,6 +1263,8 @@ async def _PROXY_failure_handler( exception_type=_exception_type, status_code=_status_code, exception_string=_exception_string, + startTime=kwargs.get("start_time"), + endTime=kwargs.get("end_time"), ) # helper function to convert to dict on pydantic v2 & v1 diff --git a/schema.prisma b/schema.prisma index cd0219983..b362a0ec0 100644 --- a/schema.prisma +++ b/schema.prisma @@ -186,6 +186,8 @@ model LiteLLM_SpendLogs { // View spend, model, api_key per request model LiteLLM_ErrorLogs { request_id String @id @default(uuid()) + startTime DateTime // Assuming start_time is a DateTime field + endTime DateTime // Assuming end_time is a DateTime field api_base String @default("") model_group String @default("") // public model_name / model_group model_id String @default("") // ID of model in ProxyModelTable