diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index 97168b19f..b06faac32 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -67,6 +67,8 @@ litellm_settings: general_settings: master_key: sk-1234 + alerting: ["slack"] + alerting_threshold: 10 # sends alerts if requests hang for 2 seconds # database_type: "dynamo_db" # database_args: { # 👈 all args - https://github.com/BerriAI/litellm/blob/befbcbb7ac8f59835ce47415c128decf37aac328/litellm/proxy/_types.py#L190 # "billing_mode": "PAY_PER_REQUEST", diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index d638d162d..94e86600a 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -162,6 +162,7 @@ class ProxyLogging: request_data is not None and request_data.get("litellm_status", "") != "success" ): + # only alert hanging responses if they have not been marked as success alerting_message = ( f"Requests are hanging - {self.alerting_threshold}s+ request time" ) @@ -173,9 +174,7 @@ class ProxyLogging: elif ( type == "slow_response" and start_time is not None and end_time is not None ): - slow_message = ( - f"Responses are slow - {round(end_time-start_time,2)}s response time" - ) + slow_message = f"Responses are slow - {round(end_time-start_time,2)}s response time > Alerting threshold: {self.alerting_threshold}s" if end_time - start_time > self.alerting_threshold: await self.alerting_handler( message=slow_message + request_info,