mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix proxy pre call hook - only use if user is using alerting (#7683)
This commit is contained in:
parent
76c81f97d7
commit
a49ef48bcb
1 changed files with 19 additions and 4 deletions
|
@ -473,10 +473,8 @@ class ProxyLogging:
|
||||||
3. /image/generation
|
3. /image/generation
|
||||||
"""
|
"""
|
||||||
verbose_proxy_logger.debug("Inside Proxy Logging Pre-call hook!")
|
verbose_proxy_logger.debug("Inside Proxy Logging Pre-call hook!")
|
||||||
## ALERTING ###
|
|
||||||
asyncio.create_task(
|
self._init_response_taking_too_long_task(data=data)
|
||||||
self.slack_alerting_instance.response_taking_too_long(request_data=data)
|
|
||||||
)
|
|
||||||
|
|
||||||
if data is None:
|
if data is None:
|
||||||
return None
|
return None
|
||||||
|
@ -1012,6 +1010,23 @@ class ProxyLogging:
|
||||||
raise e
|
raise e
|
||||||
return new_response
|
return new_response
|
||||||
|
|
||||||
|
def _init_response_taking_too_long_task(self, data: Optional[dict] = None):
|
||||||
|
"""
|
||||||
|
Initialize the response taking too long task if user is using slack alerting
|
||||||
|
|
||||||
|
Only run task if user is using slack alerting
|
||||||
|
|
||||||
|
This handles checking for if a request is hanging for too long
|
||||||
|
"""
|
||||||
|
## ALERTING ###
|
||||||
|
if (
|
||||||
|
self.slack_alerting_instance
|
||||||
|
and self.slack_alerting_instance.alerting is not None
|
||||||
|
):
|
||||||
|
asyncio.create_task(
|
||||||
|
self.slack_alerting_instance.response_taking_too_long(request_data=data)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
### DB CONNECTOR ###
|
### DB CONNECTOR ###
|
||||||
# Define the retry decorator with backoff strategy
|
# Define the retry decorator with backoff strategy
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue