Skip to content

Commit

Permalink
log startTime and EndTime for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-jaff committed Apr 30, 2024
1 parent 3aad034 commit 4b8fda4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions litellm/proxy/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b8fda4

Please sign in to comment.