mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
fix proxy pre call hook - only use if user is using alerting (#7683)
This commit is contained in:
parent
9ac18caf24
commit
2d1c90b688
1 changed files with 19 additions and 4 deletions
|
@ -473,10 +473,8 @@ class ProxyLogging:
|
|||
3. /image/generation
|
||||
"""
|
||||
verbose_proxy_logger.debug("Inside Proxy Logging Pre-call hook!")
|
||||
## ALERTING ###
|
||||
asyncio.create_task(
|
||||
self.slack_alerting_instance.response_taking_too_long(request_data=data)
|
||||
)
|
||||
|
||||
self._init_response_taking_too_long_task(data=data)
|
||||
|
||||
if data is None:
|
||||
return None
|
||||
|
@ -1012,6 +1010,23 @@ class ProxyLogging:
|
|||
raise e
|
||||
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 ###
|
||||
# Define the retry decorator with backoff strategy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue